API reference
Counterparty roles
What a counterparty is to the books: customer, vendor, employee, investor, lender or founder.
- GET
/v1/counterparties/{counterparty_id}/rolesList the roles a counterparty holds - POST
/v1/counterparties/{counterparty_id}/rolesGive a counterparty a role - GET
/v1/counterparties/{counterparty_id}/roles/{role_id}Get a counterparty's role - PATCH
/v1/counterparties/{counterparty_id}/roles/{role_id}Change a counterparty's role - DELETE
/v1/counterparties/{counterparty_id}/roles/{role_id}Take a role away from a counterparty
Guides: Keep track of vendors and customers
List the roles a counterparty holds
GET/v1/counterparties/{counterparty_id}/roles
client.partyRoles.list()
The roles a counterparty holds in these books, by role. A journal line may name a counterparty only once it holds one (decision 0086).
Parameters
| Name | Type | Description |
|---|---|---|
counterparty_idPath · Required | string | An id that starts with |
limitQuery | integer | Page size, 1–200. |
cursorQuery | string or null | The |
Response
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl "https://api.ledgerit.ai/v1/counterparties/{counterparty_id}/roles" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Give a counterparty a role
POST/v1/counterparties/{counterparty_id}/roles· Idempotent
client.partyRoles.create()
Give a counterparty a role in these books: make them an investor, a lender, a vendor. Giving the customer or vendor role marks them one.
Refused with conflict when they hold it already (change that one), and
with counterparty_merged for one merged into another.
Parameters
| Name | Type | Description |
|---|---|---|
counterparty_idPath · Required | string | An id that starts with |
Request body
Response
201PartyRoleOut
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X POST "https://api.ledgerit.ai/v1/counterparties/{counterparty_id}/roles" \
-H "Authorization: Bearer $LEDGERIT_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"role":"customer"}'Get a counterparty's role
GET/v1/counterparties/{counterparty_id}/roles/{role_id}
client.partyRoles.get()
One role a counterparty holds.
Parameters
| Name | Type | Description |
|---|---|---|
counterparty_idPath · Required | string | An id that starts with |
role_idPath · Required | string | An id that starts with |
Response
200PartyRoleOut
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl "https://api.ledgerit.ai/v1/counterparties/{counterparty_id}/roles/{role_id}" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Change a counterparty's role
PATCH/v1/counterparties/{counterparty_id}/roles/{role_id}· Idempotent
client.partyRoles.update()
Record whether a vendor is paid on a 1099, and on which form. Turning 1099 off clears the form.
Parameters
| Name | Type | Description |
|---|---|---|
counterparty_idPath · Required | string | An id that starts with |
role_idPath · Required | string | An id that starts with |
Request body
Response
200PartyRoleOut
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X PATCH "https://api.ledgerit.ai/v1/counterparties/{counterparty_id}/roles/{role_id}" \
-H "Authorization: Bearer $LEDGERIT_TOKEN" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'Take a role away from a counterparty
DELETE/v1/counterparties/{counterparty_id}/roles/{role_id}
client.partyRoles.delete()
Take a role away. Lines already posted keep naming them; a new line naming them needs them to hold some role. Removing the customer or vendor role unmarks them as one.
Parameters
| Name | Type | Description |
|---|---|---|
counterparty_idPath · Required | string | An id that starts with |
role_idPath · Required | string | An id that starts with |
Response
204No content
Errors
- 400
- The request was malformed or a parameter is invalid.
- 401
- No valid credential was sent.
- 403
- The credential or the member's role does not allow this.
- 404
- No such resource in this ledger.
- 409
- A conflicting request, e.g. one with the same Idempotency-Key still running.
- 422
- A well-formed request a business rule refused.
- 429
- Too many requests; retry after the Retry-After header.
- 500
- Something failed on our side; the request_id identifies it.
Example
curl -X DELETE "https://api.ledgerit.ai/v1/counterparties/{counterparty_id}/roles/{role_id}" \
-H "Authorization: Bearer $LEDGERIT_TOKEN"Objects
The objects these operations take and return.
PartyRolePage
| Name | Type | Description |
|---|---|---|
dataRequired | array of PartyRoleOut | |
has_moreRequired | boolean | |
next_cursorRequired | string or null |
NewPartyRole
| Name | Type | Description |
|---|---|---|
form_1099_category | string or null |
nec, misc |
is_1099_eligible | boolean | A vendor paid on a 1099. |
roleRequired | string | customer, vendor, employee, investor, lender or founder. customer, vendor, employee, investor, lender, founder |
PartyRoleOut
| Name | Type | Description |
|---|---|---|
counterparty_idRequired | string | The counterparty holding the role. |
created_atRequired | string (date-time) | |
form_1099_categoryRequired | string or null |
nec, misc |
idRequired | string | An id that starts with |
is_1099_eligibleRequired | boolean | A vendor paid on a 1099. Only a vendor role can be. |
roleRequired | string | customer, vendor, employee, investor, lender or founder. customer, vendor, employee, investor, lender, founder |
updated_atRequired | string (date-time) |
PartyRoleChanges
Only the fields sent change.
| Name | Type | Description |
|---|---|---|
form_1099_category | string or null |
nec, misc |
is_1099_eligible | boolean | A vendor paid on a 1099. |