Custom Records · 2 min read
Create or Update Records in Bulk
Create or update up to 1,000 custom records of one record type in a single request
Creates or updates up to 1,000 records of one record type. Each record works the same way as Create or update a record, and each one succeeds or fails on its own, so one bad row doesn't stop the rest.
POST
/api/v1/objects/{api_name}/records/batchHeaders#
| Name | Required | Description |
|---|---|---|
X-API-Key | Yes | An API key from your organization. See Authentication. |
Content-Type | Yes | application/json |
Path parameters#
| Name | Type | Required | Description |
|---|---|---|---|
api_name | string | Yes | The record type's API name, for example subscription. |
Request body#
| Field | Type | Required | Description |
|---|---|---|---|
records | array | Yes | Between 1 and 1,000 records. Each one accepts the fields below. |
Each record:
| Field | Type | Description |
|---|---|---|
key | string | The record's key. If you leave it out, the value of the key field in data is used. |
data | object | The record's fields. See field values. |
phone, email, external_id, shopify_customer_id, contact_id | The owner, as in Choosing the owner. Needed for a new record of a normal record type. |
If the same key appears more than once in one request, the last one is saved and the earlier ones are reported as errors.
Example request:
curl -X POST https://app.lemuai.com/api/v1/objects/subscription/records/batch \
-H "X-API-Key: lemu_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"records": [
{
"key": "SUB-1042",
"email": "priya@example.com",
"data": { "plan": "Gold", "status": "active", "renews_on": "2026-11-30" }
},
{
"phone": "+919812345678",
"data": { "subscription_id": "SUB-1043", "plan": "Silver", "status": "paused" }
},
{
"key": "SUB-1044",
"data": { "plan": "Platinum" }
}
]
}'Response#
200: the request was processed. Check each result to see which records were saved.
{
"results": [
{ "key": "SUB-1042", "status": "updated", "record_id": 18342, "contact_id": 901 },
{ "key": "SUB-1043", "status": "created", "record_id": 18343, "contact_id": 1207 },
{
"key": "SUB-1044",
"status": "error",
"error": "A new record needs its owner: phone, email, external_id, shopify_customer_id or contact_id"
}
],
"counts": { "updated": 1, "created": 1, "error": 1 }
}| Field | Type | Description |
|---|---|---|
results | array | One entry per record you sent, in the same order. |
results[].key | string | The record's key. Missing when the row had no key at all. |
results[].status | string | created, updated, unchanged or error. |
results[].record_id | integer | The record's id. Not included for rows with an error. |
results[].contact_id | integer | The record's owner. Not included for catalog records or rows with an error. |
results[].error | string | Why the row failed. Only included when status is error. |
counts | object | How many rows ended with each status. |
Errors#
These apply to the whole request. Problems with a single record are reported in results instead.
| Status | When |
|---|---|
400 | There's no record type with this api_name, or the record type is archived. |
401 | The API key is missing or not valid. |
402 | The new records would take your organization over its plan's record limit. Nothing is saved. |
422 | records is missing, empty or has more than 1,000 items, or a field has the wrong type. |
See Errors for the error format.
Was this page helpful?
Docs