/{organizationId}/finance/accounting/accounts/importImport accounts
Import accounts to the accounting plan from a CSV file. The "mode" field controls how accounts are imported: "upsert" will add or update accounts, while "replace" will replace all accounts with the imported ones: custom accounts that are not included in the imported file will be removed, and built-in accounts that are not included will be marked as not bookable.
Required permissions:
accountingPlan.insert
accountingPlan.edit
Path Parameters
organizationIdstringrequired Request Body required
Content-Type: application/json
csvStringstringrequired modestringrequired Options:
upsertreplaceAuthentication: X-API-Key
Request
curl --request POST 'https://cloud.campai.com/api/{organizationId}/finance/accounting/accounts/import' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"csvString": "string",
"mode": "upsert"
}'Responses
This endpoint returns different response codes based on the request outcome.
200Successful response
Content-Type: application/json
successbooleanrequired updatedintegerrequired minimum: 0
maximum: 9007199254740991
addedintegerrequired minimum: 0
maximum: 9007199254740991
removedintegerrequired minimum: 0
maximum: 9007199254740991
Response
{
"invalidRows": [
{
"row": -9007199254740991,
"cell": "string",
"value": "string",
"error": "string"
}
],
"success": true,
"updated": 0,
"added": 0,
"removed": 0
}400Invalid input data
Content-Type: application/json
The error information
messagestringrequired The error message
codestringrequired The error code
An array of issues that were responsible for the error
Response
{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}401Authorization not provided
Content-Type: application/json
The error information
messagestringrequired The error message
codestringrequired The error code
An array of issues that were responsible for the error
Response
{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}403Insufficient access
Content-Type: application/json
The error information
messagestringrequired The error message
codestringrequired The error code
An array of issues that were responsible for the error
Response
{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}500Internal server error
Content-Type: application/json
The error information
messagestringrequired The error message
codestringrequired The error code
An array of issues that were responsible for the error
Response
{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}