Skip to main content
PUT
/
api
/
currencies
/
{id}
Edit an existing currency
curl --request PUT \
  --url https://api.example.com/api/currencies/{id} \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --header 'organization-id: <organization-id>' \
  --data '
{
  "currencyName": "USD",
  "currencySign": "$"
}
'
import requests

url = "https://api.example.com/api/currencies/{id}"

payload = {
"currencyName": "USD",
"currencySign": "$"
}
headers = {
"Authorization": "<authorization>",
"organization-id": "<organization-id>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PUT',
headers: {
Authorization: '<authorization>',
'organization-id': '<organization-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({currencyName: 'USD', currencySign: '$'})
};

fetch('https://api.example.com/api/currencies/{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.example.com/api/currencies/{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([
'currencyName' => 'USD',
'currencySign' => '$'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"organization-id: <organization-id>"
],
]);

$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.example.com/api/currencies/{id}"

payload := strings.NewReader("{\n \"currencyName\": \"USD\",\n \"currencySign\": \"$\"\n}")

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

req.Header.Add("Authorization", "<authorization>")
req.Header.Add("organization-id", "<organization-id>")
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.example.com/api/currencies/{id}")
.header("Authorization", "<authorization>")
.header("organization-id", "<organization-id>")
.header("Content-Type", "application/json")
.body("{\n \"currencyName\": \"USD\",\n \"currencySign\": \"$\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/api/currencies/{id}")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = '<authorization>'
request["organization-id"] = '<organization-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currencyName\": \"USD\",\n \"currencySign\": \"$\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": 1,
  "currencyName": "US Dollar",
  "currencyCode": "USD",
  "currencySign": "$",
  "isBaseCurrency": true,
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-20T10:00:00Z"
}

Headers

Authorization
string
required

Value must be 'Bearer ' where is an API key prefixed with 'bc_' or a JWT token.

Example:

"Bearer bc_1234567890abcdef"

organization-id
string
required

Required if Authorization is a JWT token. The organization ID to operate within.

Path Parameters

id
number
required

Currency ID

Body

application/json
currencyName
string
required

The currency name

Example:

"USD"

currencySign
string
required

The currency sign

Example:

"$"

Response

The currency has been successfully updated.

id
number
required

The unique identifier of the currency

Example:

1

currencyName
string
required

The name of the currency

Example:

"US Dollar"

currencyCode
string
required

The code of the currency

Example:

"USD"

currencySign
string
required

The sign/symbol of the currency

Example:

"$"

isBaseCurrency
boolean
required

Whether this is the base currency for the organization

Example:

true

createdAt
string<date-time>
required

The creation timestamp

Example:

"2024-03-20T10:00:00Z"

updatedAt
string<date-time>
required

The last update timestamp

Example:

"2024-03-20T10:00:00Z"