curl --request POST \
--url https://api.exowpee.com/v1/accounting/organization/exchange-rates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source_currency_code": "<string>",
"source_currency_exponent": 9,
"target_currency_code": "<string>",
"target_currency_exponent": 9,
"rate": "<string>",
"valid_from": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.exowpee.com/v1/accounting/organization/exchange-rates"
payload = {
"source_currency_code": "<string>",
"source_currency_exponent": 9,
"target_currency_code": "<string>",
"target_currency_exponent": 9,
"rate": "<string>",
"valid_from": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source_currency_code: '<string>',
source_currency_exponent: 9,
target_currency_code: '<string>',
target_currency_exponent: 9,
rate: '<string>',
valid_from: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.exowpee.com/v1/accounting/organization/exchange-rates', 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.exowpee.com/v1/accounting/organization/exchange-rates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source_currency_code' => '<string>',
'source_currency_exponent' => 9,
'target_currency_code' => '<string>',
'target_currency_exponent' => 9,
'rate' => '<string>',
'valid_from' => '2023-11-07T05:31:56Z'
]),
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.exowpee.com/v1/accounting/organization/exchange-rates"
payload := strings.NewReader("{\n \"source_currency_code\": \"<string>\",\n \"source_currency_exponent\": 9,\n \"target_currency_code\": \"<string>\",\n \"target_currency_exponent\": 9,\n \"rate\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.exowpee.com/v1/accounting/organization/exchange-rates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source_currency_code\": \"<string>\",\n \"source_currency_exponent\": 9,\n \"target_currency_code\": \"<string>\",\n \"target_currency_exponent\": 9,\n \"rate\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/accounting/organization/exchange-rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_currency_code\": \"<string>\",\n \"source_currency_exponent\": 9,\n \"target_currency_code\": \"<string>\",\n \"target_currency_exponent\": 9,\n \"rate\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"source_currency_code": "<string>",
"source_currency_exponent": 123,
"target_currency_code": "<string>",
"target_currency_exponent": 123,
"direction": "<string>",
"rate": "<string>",
"valid_from": "2023-12-25",
"valid_to": "2023-12-25",
"created_by": "<string>",
"created_by_type": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}Add an exchange rate
Defines a new open-ended exchange rate between two currencies, used to convert foreign-currency amounts.
curl --request POST \
--url https://api.exowpee.com/v1/accounting/organization/exchange-rates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source_currency_code": "<string>",
"source_currency_exponent": 9,
"target_currency_code": "<string>",
"target_currency_exponent": 9,
"rate": "<string>",
"valid_from": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://api.exowpee.com/v1/accounting/organization/exchange-rates"
payload = {
"source_currency_code": "<string>",
"source_currency_exponent": 9,
"target_currency_code": "<string>",
"target_currency_exponent": 9,
"rate": "<string>",
"valid_from": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source_currency_code: '<string>',
source_currency_exponent: 9,
target_currency_code: '<string>',
target_currency_exponent: 9,
rate: '<string>',
valid_from: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.exowpee.com/v1/accounting/organization/exchange-rates', 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.exowpee.com/v1/accounting/organization/exchange-rates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source_currency_code' => '<string>',
'source_currency_exponent' => 9,
'target_currency_code' => '<string>',
'target_currency_exponent' => 9,
'rate' => '<string>',
'valid_from' => '2023-11-07T05:31:56Z'
]),
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.exowpee.com/v1/accounting/organization/exchange-rates"
payload := strings.NewReader("{\n \"source_currency_code\": \"<string>\",\n \"source_currency_exponent\": 9,\n \"target_currency_code\": \"<string>\",\n \"target_currency_exponent\": 9,\n \"rate\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.exowpee.com/v1/accounting/organization/exchange-rates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source_currency_code\": \"<string>\",\n \"source_currency_exponent\": 9,\n \"target_currency_code\": \"<string>\",\n \"target_currency_exponent\": 9,\n \"rate\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/accounting/organization/exchange-rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_currency_code\": \"<string>\",\n \"source_currency_exponent\": 9,\n \"target_currency_code\": \"<string>\",\n \"target_currency_exponent\": 9,\n \"rate\": \"<string>\",\n \"valid_from\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"source_currency_code": "<string>",
"source_currency_exponent": 123,
"target_currency_code": "<string>",
"target_currency_exponent": 123,
"direction": "<string>",
"rate": "<string>",
"valid_from": "2023-12-25",
"valid_to": "2023-12-25",
"created_by": "<string>",
"created_by_type": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>",
"errors": {}
}exchange_rates.create
Conditions
- The accounting module must be included in the plan of the organization.
- Exchange rates belong to the organization, not to a book.
- The caller needs an accounting access grant on the organization’s own book (a grant on a company book is not enough). This is checked before validation.
- target_currency_code must differ from source_currency_code; both codes must be three upper-case letters.
- rate must be a decimal string with up to 20 digits before the point and 18 after, and greater than zero.
- Exponents must be integers from 0 to 18.
- The new rate must not overlap an existing one: it is refused when a rate for the same source, target and direction is still open (no end date) or ends on or after the new valid_from. The previous rate must be closed first, and the new one must start after its end date.
- At most one rate exists for a given pair, direction and start date (a deleted rate leaves no trace).
- Two concurrent creations for the organization are serialised.
- Stores an open-ended rate (valid_to empty) and records the creating member or agent account in created_by and created_by_type (both null when the actor cannot be identified). Later conversions of payments and refunds between the two currencies use it from valid_from.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Response mode. Default none; none answers 204 No Content.
none, resource Comma-separated JSON keys of the root resource (id is always rendered). Available: id, source_currency_code, source_currency_exponent, target_currency_code, target_currency_exponent, direction, rate, valid_from, valid_to, created_by, created_by_type, created_at.
Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: .
Body
Three-letter upper-case code of the currency converted from, for example XOF.
Number of decimal places of the source currency, from 0 to 18.
0 <= x <= 18Three-letter upper-case code of the currency converted to. It must differ from the source currency.
Number of decimal places of the target currency, from 0 to 18.
0 <= x <= 18Exchange rate: how many units of the target currency one unit of the source currency is worth, as a decimal string with a dot. Required; up to 20 digits before the dot and up to 18 after.
Money flow the rate applies to: incoming or outgoing. Defaults to incoming when omitted.
incoming, outgoing First day the rate applies (ISO 8601 date); only the date part is used. Defaults to today. It must come after the end of any existing rate for the same pair and direction, and open rates must be closed first.
Response
Resource (only with response=resource).
Identifier of the exchange rate (27-character KSUID).
Three-letter code of the currency converted from.
Number of decimal places of the source currency (divide an amount in minor units by 10 to this power).
Three-letter code of the currency converted to.
Number of decimal places of the target currency.
Money flow the rate applies to: incoming (money received) or outgoing (money paid out, such as refunds).
Exchange rate: how many units of the target currency one unit of the source currency is worth, as an exact decimal string with no trailing zeros.
First day the rate applies (YYYY-MM-DD).
Last day the rate applies (YYYY-MM-DD); null while the rate is open-ended.
Identifier of the member or agent account that created the rate; null when it could not be identified.
Type of the creator (member or agent account); null when unknown.
Date and time the record was created (ISO 8601, UTC).