When to Use This
The batch endpoint is useful when:- Running an initial sync where many accounts need to be created from scratch.
- A large number of new accounts have been added to the AS since the last sync cycle.
Prerequisites
Before you begin:- You have completed How to Sync Accounts and identified which accounts need to be created in Pleo.
- Your integration is authenticated using one of the supported authentication methods.
- Your integration can call Pleo’s Chart of Accounts API endpoints.
Steps
1. Build the Batch Request
API Endpoint: POST/v1/chart-of-accounts/batch
Collect all accounts that need to be created and include them as items in the request body. Each item requires externalId, name, and archived. The code and taxCodeExternalId fields are optional.
A single request can include between 1 and 1000 accounts. If you have more than 1000 accounts to create, split them across multiple requests.
Example Pseudo:
Example Request
- OAuth 2.0
- API Key
2. Handle the Response
The API returns a201 even when some items fail. Always check both the created and failed arrays in the response.
Example Response
Handling Failures
Items that fail validation are returned in thefailed array with a reasons field explaining what went wrong. Successfully validated items are still created: the batch does not roll back.
Related Reading
- How to Create, Update, and Archive Accounts
- How to Sync Accounts
- Chart of Accounts Sync Periodicity and Scheduling