Change the category of transactions
const url = 'https://app.commitly.com/api/transactions/';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '[{"id":7003,"category":1003}]'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://app.commitly.com/api/transactions/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '[ { "id": 7003, "category": 1003 } ]'Changes the category of up to 1000 transactions in one call. The body is a JSON
array of {"id": <transaction id>, "category": <category id>} objects.
categorymust be a leaf category of the same company.- Items with an unknown transaction
idare skipped silently. - The response contains the updated transactions.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Transaction ID. Unknown IDs are skipped.
ID of a leaf category of the same company.
Example
[ { "id": 7003, "category": 1003 }]Responses
Section titled “Responses”The updated transactions.
object
Short form of a bank account, embedded in transactions.
object
Bank name. Present in the create-transactions response only.
Present in the create-transactions response only.
Extended category representation, embedded as predicted_category in transactions.
object
AG aggregating, EX expenses, IN incomes.
Display position.
Internal; can be ignored.
Internal; can be ignored.
Internal; can be ignored.
Internal; can be ignored.
ID of the parent category.
Invoice linked to the transaction, or null.
Negative for outflows, positive for inflows.
Present in list responses.
Example
[ { "predicted_category": { "type": "AG" } }]Invalid request body or parameters. The body lists the errors per field; errors
not tied to a field are listed under non_field_errors. For request bodies
that are arrays, the body is a list with one error object per item. Messages
are localized (see Accept-Language).
Validation errors. Each key is a field of the request body; its value is the
list of messages for that field. Errors not tied to a field are listed under
non_field_errors.
object
Validation errors. Each key is a field of the request body; its value is the
list of messages for that field. Errors not tied to a field are listed under
non_field_errors.
object
Example
{ "settlement_date": [ "This field is required." ]}The access token is invalid or has expired. Request a new token. The message is
localized (see Accept-Language).
object
Error message.
Present only if the company’s edition does not include the function; value billing_plan_permission_denied.
Example
{ "detail": "Invalid token."}Headers
Section titled “Headers”Authentication scheme, Bearer.
Example
BearerNo access token was sent, or the credentials are not allowed to call this
endpoint. If the company’s COMMITLY edition does not include the requested
function, the body additionally contains
"code": "billing_plan_permission_denied".
object
Error message.
Present only if the company’s edition does not include the function; value billing_plan_permission_denied.
Example
{ "detail": "User must be authenticated to access this resource."}
