Skip to main content
PUT
/
currencies
/
exchange-rates
/
{id}
Update a single exchange rate
curl --request PUT \
  --url https://api.royalti.io/currencies/exchange-rates/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "base": "<string>",
  "quoted": "<string>",
  "rate": 123,
  "period": "<string>",
  "source": "<string>",
  "effectiveDate": "2023-11-07T05:31:56Z",
  "expiryDate": "2023-11-07T05:31:56Z",
  "isDefault": true,
  "memo": "<string>"
}
'
import requests

url = "https://api.royalti.io/currencies/exchange-rates/{id}"

payload = {
"base": "<string>",
"quoted": "<string>",
"rate": 123,
"period": "<string>",
"source": "<string>",
"effectiveDate": "2023-11-07T05:31:56Z",
"expiryDate": "2023-11-07T05:31:56Z",
"isDefault": True,
"memo": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
base: '<string>',
quoted: '<string>',
rate: 123,
period: '<string>',
source: '<string>',
effectiveDate: '2023-11-07T05:31:56Z',
expiryDate: '2023-11-07T05:31:56Z',
isDefault: true,
memo: '<string>'
})
};

fetch('https://api.royalti.io/currencies/exchange-rates/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.royalti.io/currencies/exchange-rates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'base' => '<string>',
'quoted' => '<string>',
'rate' => 123,
'period' => '<string>',
'source' => '<string>',
'effectiveDate' => '2023-11-07T05:31:56Z',
'expiryDate' => '2023-11-07T05:31:56Z',
'isDefault' => true,
'memo' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.royalti.io/currencies/exchange-rates/{id}"

payload := strings.NewReader("{\n \"base\": \"<string>\",\n \"quoted\": \"<string>\",\n \"rate\": 123,\n \"period\": \"<string>\",\n \"source\": \"<string>\",\n \"effectiveDate\": \"2023-11-07T05:31:56Z\",\n \"expiryDate\": \"2023-11-07T05:31:56Z\",\n \"isDefault\": true,\n \"memo\": \"<string>\"\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.royalti.io/currencies/exchange-rates/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base\": \"<string>\",\n \"quoted\": \"<string>\",\n \"rate\": 123,\n \"period\": \"<string>\",\n \"source\": \"<string>\",\n \"effectiveDate\": \"2023-11-07T05:31:56Z\",\n \"expiryDate\": \"2023-11-07T05:31:56Z\",\n \"isDefault\": true,\n \"memo\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.royalti.io/currencies/exchange-rates/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"base\": \"<string>\",\n \"quoted\": \"<string>\",\n \"rate\": 123,\n \"period\": \"<string>\",\n \"source\": \"<string>\",\n \"effectiveDate\": \"2023-11-07T05:31:56Z\",\n \"expiryDate\": \"2023-11-07T05:31:56Z\",\n \"isDefault\": true,\n \"memo\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": "success",
  "message": "<string>",
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "TenantId": 123,
    "source": "manual",
    "period": "202607",
    "base": "EUR",
    "quoted": "USD",
    "rate": 1.0842,
    "effectiveDate": "2023-11-07T05:31:56Z",
    "expiryDate": "2023-11-07T05:31:56Z",
    "isDefault": true,
    "memo": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}
{
"status": "error",
"message": "Validation failed",
"errors": [
"Base and quoted currencies must be different",
"Period must be in YYYYMM format with valid month (01-12)"
]
}
{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}
{
"status": "error",
"message": "<string>",
"code": "<string>",
"details": {}
}
This endpoint requires authentication. Include your Bearer token in the Authorization header.

Description

PUT /currencies/exchange-rates/ Partial update — only provided fields are changed. The merged (existing + update) row is re-validated through the same shared validator POST uses, so an update cannot introduce an invalid currency code, period, or date even if the original row predates stricter validation. Authorization: admin or higher (requireAdmin).

Code Examples

const response = await fetch('https://api.royalti.io/currencies/exchange-rates/example-id', {
  method: 'PUT',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "base": "sample-base",
    "quoted": "sample-quoted",
    "rate": 1,
    "period": "sample-period",
    "source": "sample-source",
    "effectiveDate": "2024-01-21T12:00:00Z",
    "expiryDate": "2024-01-21T12:00:00Z",
    "isDefault": true,
    "memo": "sample-memo"
  })
});

const data = await response.json();
console.log(data);
import requests

response = requests.put(
  'https://api.royalti.io/currencies/exchange-rates/example-id',
  headers={
    'Authorization': f'Bearer {token}'
  },
  json={"base":"sample-base","quoted":"sample-quoted","rate":1,"period":"sample-period","source":"sample-source","effectiveDate":"2024-01-21T12:00:00Z","expiryDate":"2024-01-21T12:00:00Z","isDefault":true,"memo":"sample-memo"}
)

data = response.json()
print(data)
curl -X PUT https://api.royalti.io/currencies/exchange-rates/example-id \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"base":"sample-base","quoted":"sample-quoted","rate":1,"period":"sample-period","source":"sample-source","effectiveDate":"2024-01-21T12:00:00Z","expiryDate":"2024-01-21T12:00:00Z","isDefault":true,"memo":"sample-memo"}'

Authorizations

Authorization
string
header
required

JWT Authorization header using the Bearer scheme. Format: "Bearer {token}"

Path Parameters

id
string<uuid>
required

Body

application/json

Partial ExchangeRateInput — any subset of fields.

base
string
quoted
string
rate
number
period
string
source
string
effectiveDate
string<date-time>
expiryDate
string<date-time>
isDefault
boolean
memo
string

Response

Exchange rate updated

status
string
Example:

"success"

message
string
data
object

A stored exchange rate (ExchangeRate model).