Learn how to store arbitrary custom metadata in various objects in Monite.

Overview

Payables, Receivables, Entity, Counterpart, and Counterpart bank account objects can have arbitrary metadata associated with them. Monite API Partners can use metadata to store additional structured information about these objects, such as the object IDs from other systems.

The way to work with metadata varies depending on the object type. Refer to the corresponding section below:

Entity and counterpart metadata

The metadata is not part of the Entity and Counterpart objects themselves. Instead, it is accessed via the /partner_metadata subresource of the corresponding resources:

/entities/{entity_id}/partner_metadata
/counterparts/{counterpart_id}/partner_metadata

Use the HTTP PUT method to set the metadata, and GET to read it.

Metadata format

The <resource>/partner_metadata endpoint accepts and returns the metadata in the following format, where metadata can be an arbitrary JSON object up to 2000 bytes in size:

1{
2 "metadata": {
3
4 // Metadata goes here
5 "custom_field_1": "value",
6 "custom_field_2": 42,
7 "custom_field_3": true,
8 ...
9
10 }
11}

Set metadata

Use PUT <resource>/partner_metadata to add metadata or replace existing metadata for a specific entity or counterpart. For example:

1curl -X PUT 'https://api.sandbox.monite.com/v1/counterparts/3a9c5...8df/partner_metadata' \
2 -H 'X-Monite-Version: 2024-01-31' \
3 -H 'X-Monite-Entity-Id: ENTITY_ID' \
4 -H 'Authorization: ACCESS_TOKEN' \
5 -H 'Content-Type: application/json' \
6 -d '{
7 "metadata": {
8 "external_id": "id_6c8f1262fdbc",
9 "comment": ""
10 }
11 }'

A 200 OK response means the metadata was successfully saved. If the metadata exceeds the 2 KB limit, a 422 response is returned.

Get metadata

Use GET <resource>/partner_metadata to get existing metadata for a specific entity or counterpart. For example:

1curl -X GET 'https://api.sandbox.monite.com/v1/counterparts/3a9c5...8df/partner_metadata' \
2 -H 'X-Monite-Version: 2024-01-31' \
3 -H 'X-Monite-Entity-Id: ENTITY_ID' \
4 -H 'Authorization: ACCESS_TOKEN'

If there is no metadata associated with the specified entity or counterpart, the metadata field in the response is an empty object {}.

Partially update metadata

If you need to add, modify, or delete individual fields within a metadata object, you can use this approach:

  1. Call GET <resource>/partner_metadata to read existing metadata.
  2. Modify the returned object as needed.
  3. Call PUT <resource>/partner_metadata to save the modified metadata.

Delete metadata

To delete the metadata associated with a specific entity or counterpart, you can call PUT <resource>/partner_metadata and pass an empty object {} as the metadata value:

1curl -X PUT 'https://api.sandbox.monite.com/v1/counterparts/3a9c5...8df/partner_metadata' \
2 -H 'X-Monite-Version: 2024-01-31' \
3 -H 'X-Monite-Entity-Id: ENTITY_ID' \
4 -H 'Authorization: ACCESS_TOKEN' \
5 -H 'Content-Type: application/json' \
6 -d '{"metadata": {}}'

Payables, receivables, and counterpart bank account metadata

Metadata format

Payable, Receivable, and Counterpart Bank Account objects have the partner_metadata field to store partner-provided metadata. The value can be an arbitrary JSON object up to 2000 bytes in size:

Example: Payable object metadata
1{
2 "currency": "EUR",
3 ...
4
5 "partner_metadata": {
6 "custom_field_1": "value",
7 "custom_field_2": 42,
8 "custom_field_3": true,
9 ...
10 }
11}

If there is no metadata associated with a specific payable, receivable, or bank account, the partner_metadata field returns an empty object—{}.

Set metadata

When creating a payable, receivable, or counterpart bank account, you can provide the metadata by using the partner_metadata field directly in the request object as shown:

Example: Set metadata for a payable
1curl -X POST 'https://api.sandbox.monite.com/v1/payables' \
2 -H 'X-Monite-Version: 2024-01-31' \
3 -H 'X-Monite-Entity-Id: ENTITY_ID' \
4 -H 'Authorization: Bearer ACCESS_TOKEN' \
5 -H 'Content-Type: application/json' \
6 -d '{
7 "currency": "EUR",
8 "amount": 11900,
9 ...
10 "partner_metadata": {
11 "external_id": "id_6c8f1262fdbc",
12 "comment": ""
13 }
14 }'

In case of already existing payables, receivables, or counterpart bank accounts, you can add metadata by sending a PATCH request to the respective endpoint and including the partner_metadata field as shown:

Example: Update metadata of a payable
1curl -X PATCH 'https://api.sandbox.monite.com/v1/payables/aa314...5c0' \
2 -H 'X-Monite-Version: 2024-01-31' \
3 -H 'X-Monite-Entity-Id: ENTITY_ID' \
4 -H 'Authorization: Bearer ACCESS_TOKEN' \
5 -H 'Content-Type: application/json' \
6 -d '{
7 "partner_metadata": {
8 "external_id": "id_6c8f1262fdbc",
9 "comment": ""
10 }
11 }'

Get metadata

To retrieve the metadata of a payable, receivable, or counterpart bank account, send a GET request to the corresponding resource.

The following snippet demonstrates a response from the GET /payables request, which includes the partner_metadata of each payable:

1{
2 "data": [
3 {
4 "id": "aa314fdd-a763-4920-a8c8-6285fc1745c0",
5 ...
6 "partner_metadata": {
7 "external_id": "id_6c8f1262fdbc",
8 "comment": ""
9 }
10 },
11 {
12 "id": "f6d57e58-5703-47d4-80c0-2aa2ba0b36c4",
13 ...
14 "partner_metadata": {}
15 },
16 ...
17 ],
18 "prev_pagination_token": null,
19 "next_pagination_token": null
20}

Partially update metadata

To add, modify, or delete individual fields within the metadata of a Payable, Receivable, or Counterpart Bank Account object, you can use this approach:

  1. Retrieve the object by using the corresponding GET request (such as GET /payables/{payable_id}).
  2. Extract the partner_metadata response field to get existing metadata.
  3. Modify the partner_metadata value as needed.
  4. Send a PATCH request to update the object and provide the updated partner_metadata value in the request.

Delete metadata

To delete existing metadata from a Payable, Receivable or Counterpart Bank Account object, send a PATCH request to the corresponding endpoint and set partner_metadata to an empty object {} as shown:

Example: Delete a payable's metadata
1curl -X PATCH 'https://api.sandbox.monite.com/v1/payables/aa314...5c0' \
2 -H 'X-Monite-Version: 2024-01-31' \
3 -H 'X-Monite-Entity-Id: ENTITY_ID' \
4 -H 'Authorization: Bearer ACCESS_TOKEN' \
5 -H 'Content-Type: application/json' \
6 -d '{ "partner_metadata": {} }'