Learn how to associate comments with payables.

Overview

Payables stored in Monite can have comments associated with them. Monite API Partners can use comments to store additional information about payables.

Webhooks are sent every time a comment is created, updated, or deleted.

Roles and permissions

To use the /comments* endpoints with an entity user token, this entity user must have a role with the comment permission.

If using a partner-level token, no special permissions are needed.

Create a comment

To create a comment, call POST /comments with the request body containing the comment text and the ID of the payable object to which the comment is related. The object_type field must be set to "payable". If the comment is a reply to another user, you can include the reply_to_entity_user_id field:

1curl -X POST 'https://api.sandbox.monite.com/v1/comments' \
2 -H 'X-Monite-Version: 2024-05-25' \
3 -H 'X-Monite-Entity-Id: ENTITY_ID' \
4 -H 'Authorization: Bearer ACCESS_TOKEN' \
5 -H 'Content-Type: application/json' \
6 -d '{
7 "text": "Comment about a payable.",
8 "reply_to_entity_user_id": "6e8b3d61-edc6-41d5-94ff-e3980606dc0f",
9 "object_type": "payable",
10 "object_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
11 }'

The successful response contains information about the newly created comment and the object to which the comment is related:

1{
2 "id": "d95eb59f-2781-4c58-b763-4526b3b27b0d",
3 "created_at": "2023-09-06T07:10:53.879Z",
4 "updated_at": "2023-09-06T07:10:53.879Z",
5 "created_by_entity_user_id": "9fabf3e8-76bd-400e-85cc-776d42e71c07",
6 "entity_id": "ba2ee5e3-b29d-4594-942c-d962ae9765ed",
7 "object_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
8 "object_type": "payable",
9 "reply_to_entity_user_id": "6e8b3d61-edc6-41d5-94ff-e3980606dc0f",
10 "status": "active",
11 "text": "Comment about a payable."
12}

List all comments

To get a list of all the comments related to a specific object, call GET /comments passing the object_type and the object_id of the object to which the comments are related as query parameters:

1curl -X POST 'https://api.sandbox.monite.com/v1/comments?object_type=payable&object_id=9d2b4c8f-2087-4738-ba91-7359683c49a4&order=asc&limit=100' \
2 -H 'X-Monite-Version: 2024-05-25' \
3 -H 'X-Monite-Entity-Id: ENTITY_ID' \
4 -H 'Authorization: Bearer ACCESS_TOKEN'

The successful response contains information about all the comments associated with the supplied object:

1{
2 "data": [
3 {
4 "id": "d95eb59f-2781-4c58-b763-4526b3b27b0d",
5 "created_at": "2023-09-06T07:10:53.879Z",
6 "updated_at": "2023-09-06T07:10:53.879Z",
7 "created_by_entity_user_id": "9fabf3e8-76bd-400e-85cc-776d42e71c07",
8 "entity_id": "ba2ee5e3-b29d-4594-942c-d962ae9765ed",
9 "object_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
10 "object_type": "payable",
11 "reply_to_entity_user_id": "6e8b3d61-edc6-41d5-94ff-e3980606dc0f",
12 "status": "active",
13 "text": "Comment about a payable."
14 }
15 ],
16 "prev_pagination_token": null,
17 "next_pagination_token": null
18}

Retrieve a comment

To get information about a specific comment associated with a specific object, call GET /comments/{comment_id}.

Edit a comment

To edit an existing comment, call PATCH /comments/{comment_id}. Only the creator of the comment is allowed to change it.

1curl -X PATCH 'https://api.sandbox.monite.com/v1/comments/d95eb59f-2781-4c58-b763-4526b3b27b0d' \
2 -H 'X-Monite-Version: 2024-05-25' \
3 -H 'X-Monite-Entity-Id: ENTITY_ID' \
4 -H 'Authorization: Bearer ACCESS_TOKEN' \
5 -H 'Content-Type: application/json' \
6 -d '{
7 "text": "Updated comment about a payable.",
8 "reply_to_entity_user_id": "9fabf3e8-76bd-400e-85cc-776d42e71c07"
9 }'

Delete a comment

To delete an existing comment, call DELETE /comments/{comment_id}.