Closing Rates

Categories #

Closing Rates are Exchange Rates at which balances in closing-rates denominated in foreign currencies are translated to the Entity’s Reporting Currency. A Closing Rate is required for each Currency that the Entity posted Transactions in during the Reporting Period.

Properties #

Direct Properties #

A Closing Rate is only a relationship Resource and therefore has no direct properties of its own.

Indirect Properties #

PropertyTypeDefinition
Reporting PeriodDictionaryThe Reporting Period to which the Closing Rate belongs
Exchange RateDictionaryThe Actual Exchange Rate to be used when translating the Foreign Balances

Basics #

The parameters required to create a Closing Rate Resource are the Reporting Period and Exchange Rate Ids.

Request #

curl --location --request POST 'api.microbooks.io/books/v1/closing-rate' \
--data-raw '{
    "reporting_period_id": 1,
    "exchange_rate_id": 1
}'
import requests

url = "https://api.microbooks.io/books/v1/closing-rate"
body = {
    "reporting_period_id": 1,
    "exchange_rate_id": 1
}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("POST", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://api.microbooks.io/books/v1/closing-rate',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{
        "reporting_period_id": 1,
        "exchange_rate_id": 1
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "reporting_period_id": 1,
    "exchange_rate_id": 1
}';
$request = new Request('POST', 'https://api.microbooks.io/books/v1/closing-rate', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/closing-rate");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = "{
    \"reporting_period_id\": 1,
    \"exchange_rate_id\": 1
}";
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Response #

{
    "status": "success",
    "message": "Closing Rate: 2023 USD at 105.0 created successfully",
    "resource": {
        "entity_id": 1,
        "id": 3,
        "reporting_period": {
            "status": "OPEN",
            "calendar_year": 2023,
            "period_count": 2,
            "entity_id": 1,
            "id": 3
        },
        "Exchange_rate": {
            "valid_from": "2022-07-20T00:00:00.000000Z",
            "currency_id": 2,
            "rate": 105,
            "entity_id": 1,
            "id": 4,
            "currency": {
                "uuid": "7b87e7e9-0e23-44aa-9694-ba9ccfc0091b",
                "id": 2,
                "user_id": 1,
                "name": "US Dollar",
                "currency_code": "USD"
            }
        }
    }
}

Errors #

Below are the Errors that are returned by the Closing Rate Resource.

Detail CodeNameDefinition
101Missing EntityThe Category Resource requires an existing Entity because it is a means of Grouping the Balances of closing-rates in different Sections of the Financial Statements produced by the platform, which are scoped to an Entity
102Duplicate Closing RateA Closing Rate already exists for the selected Currency and Reporting Period