Important: Transaction records have a dependency on shops. The system
validates the
shop_id field against existing records in the database. You
should upload shops before uploading transactions to ensure proper data
validation.Authentication Required
This endpoint requires API key authentication via Bearer token in the Authorization header.About the Data API
This endpoint is part of the Cobi Data API (/v1/data/:type), which provides a consistent interface for uploading different types of structured data.
Request Body
An array of transaction records (up to 5000)
Response
The API returns a JSON response with the following fields:| Field | Type | Description |
|---|---|---|
request_id | string | Unique ID for the overall request |
type | string | Type of data being processed (e.g., “transactions”) |
batches | array | Array of batch results |
batches[].batch | int | Sequential batch number |
batches[].status | int | HTTP-like status code (200, 207, 400, 500) |
batches[].data | object | Batch result details |
batches[].data.status | string | ”success”, “partial”, or “error” |
batches[].data.type | string | Matches the top-level type |
batches[].data.message | string | Summary message of the batch result |
batches[].data.request_id | string | Unique request ID for the batch |
batches[].data.batch_id | string | Unique batch ID |
batches[].data.error | string | Error details (empty or null on success) |
Error Codes
| Status Code | Description | data.status value |
|---|---|---|
| 200 | All records processed successfully | success |
| 207 | Some records failed, others succeeded | partial |
| 400 | Validation or dependency error | error |
| 500 | Internal or unexpected server error | error |
| 401 | Unauthorized - Invalid or missing API key | error |
Example
Best Practices
- Upload Order: Upload shops before transactions to ensure references exist
- Batch Size: Upload up to 5000 records at a time for optimal performance
- Data Validation: Ensure all required fields are present and properly formatted
- Error Handling: Implement proper error handling for failed requests
- Rate Limiting: Be mindful of API rate limits