Create or update many catalogue items
using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://api.azimea.com/v1/items/batch"), Headers = { { "Authorization", "Bearer <token>" }, }, Content = new StringContent("{ \"items\": [ { \"id\": \"plan-pro\", \"kind\": \"plan\", \"name\": \"Pro plan\", \"description\": \"Unlimited projects and priority support.\", \"url\": \"https://example.com/pricing#pro\", \"imageUrl\": \"https://example.com/img/pro.png\", \"price\": 49, \"comparePrice\": 59, \"currency\": \"EUR\", \"inStock\": true, \"stockQuantity\": null, \"categories\": [ \"plans\" ], \"attributes\": { \"billing\": \"monthly\", \"seats\": 5 }, \"active\": true } ] }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}const url = 'https://api.azimea.com/v1/items/batch';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"items":[{"id":"plan-pro","kind":"plan","name":"Pro plan","description":"Unlimited projects and priority support.","url":"https://example.com/pricing#pro","imageUrl":"https://example.com/img/pro.png","price":49,"comparePrice":59,"currency":"EUR","inStock":true,"stockQuantity":null,"categories":["plans"],"attributes":{"billing":"monthly","seats":5},"active":true}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.azimea.com/v1/items/batch \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "items": [ { "id": "plan-pro", "kind": "plan", "name": "Pro plan", "description": "Unlimited projects and priority support.", "url": "https://example.com/pricing#pro", "imageUrl": "https://example.com/img/pro.png", "price": 49, "comparePrice": 59, "currency": "EUR", "inStock": true, "stockQuantity": null, "categories": [ "plans" ], "attributes": { "billing": "monthly", "seats": 5 }, "active": true } ] }'The same as POST /items for up to 1,000 items in one call, which counts as a single call for the rate limit. Each item is written or refused on its own: the answer counts the created, updated and failed items and gives one result per item, by its position in the request, with the reasons as catalog.* codes. More than 1,000 items refuses the whole call with catalog.batch_too_large. Needs the items:write permission.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The items to write, up to 1,000. Each is written exactly as POST /items would write it.
object
Required. Your own id for the item, at most 100 characters. Sending the same id again updates the item.
Example
plan-proproduct, plan, service or other. A new item is a product unless you say otherwise.
Example
planRequired, at most 300 characters.
Example
Pro planAt most 5,000 characters.
Example
Unlimited projects and priority support.A full address starting with https://, at most 2,000 characters.
Example
https://example.com/pricing#proA full address starting with https://, at most 2,000 characters.
Example
https://example.com/img/pro.pngZero or more.
Example
49The price before a discount. Must be higher than price.
Example
59The three-letter currency code, such as EUR or GBP.
Example
EURA new item is in stock unless you say otherwise.
Example
trueA whole number of zero or more.
Example
nullAt most 20, each a short name.
Example
[ "plans"]At most 50 fields, each a short lowercase key with a text, number or yes/no value.
object
Example
{ "billing": "monthly", "seats": 5}A new item is active. false stops recommending it but keeps its history.
Example
trueExample
{ "id": "plan-pro", "kind": "plan", "name": "Pro plan", "description": "Unlimited projects and priority support.", "url": "https://example.com/pricing#pro", "imageUrl": "https://example.com/img/pro.png", "price": 49, "comparePrice": 59, "currency": "EUR", "inStock": true, "stockQuantity": null, "categories": [ "plans" ], "attributes": { "billing": "monthly", "seats": 5 }, "active": true}Example
[ { "id": "plan-pro", "kind": "plan", "name": "Pro plan", "description": "Unlimited projects and priority support.", "url": "https://example.com/pricing#pro", "imageUrl": "https://example.com/img/pro.png", "price": 49, "comparePrice": 59, "currency": "EUR", "inStock": true, "stockQuantity": null, "categories": [ "plans" ], "attributes": { "billing": "monthly", "seats": 5 }, "active": true }]Example
{ "items": [ { "id": "plan-pro", "kind": "plan", "name": "Pro plan", "description": "Unlimited projects and priority support.", "url": "https://example.com/pricing#pro", "imageUrl": "https://example.com/img/pro.png", "price": 49, "comparePrice": 59, "currency": "EUR", "inStock": true, "stockQuantity": null, "categories": [ "plans" ], "attributes": { "billing": "monthly", "seats": 5 }, "active": true } ]}Responses
Section titled “Responses”What happened to each item
object
true when the call worked, false when errors say why it did not.
The answer itself; null when the call failed.
object
How many items were created.
How many existing items were updated.
How many items were refused. The others were still written.
One entry per item, in the order you sent them.
object
The item’s position in your request, starting at 0.
created, updated or failed.
The item’s Azimea id; null when it failed.
Why the item was refused; null when it was written.
object
A stable error code, listed in the error codes catalog.
The request field the problem is about; null when it is about the whole item.
The numbers the code refers to (a minimum, a maximum), when there are any.
object
An internal result number. Rely on the HTTP status code instead.
What went wrong, one entry per problem; empty when the call worked.
object
A stable code such as audience.contact_not_found. Branch on this, never on message. Every code is listed in the error codes catalog.
An English sentence for your logs. Do not show it to end users: it can change.
The numbers the message mentions (a minimum, a maximum), when there are any.
object
The same problems grouped by the request field they belong to; null when none is tied to a field.
object
object
A stable code such as audience.contact_not_found. Branch on this, never on message. Every code is listed in the error codes catalog.
An English sentence for your logs. Do not show it to end users: it can change.
The numbers the message mentions (a minimum, a maximum), when there are any.
object
Example
{ "isSuccess": true, "value": { "created": 0, "updated": 1, "failed": 0, "results": [ { "index": 0, "status": "updated", "id": "01a10900-0000-7000-8000-000000000001", "errors": null } ] }, "status": 0, "errors": [], "fieldErrors": null}Validation failed: see errors[].code (catalog.batch_too_large)
object
true when the call worked, false when errors say why it did not.
The answer itself; null when the call failed.
An internal result number. Rely on the HTTP status code instead.
What went wrong, one entry per problem; empty when the call worked.
object
A stable code such as audience.contact_not_found. Branch on this, never on message. Every code is listed in the error codes catalog.
An English sentence for your logs. Do not show it to end users: it can change.
The numbers the message mentions (a minimum, a maximum), when there are any.
object
The same problems grouped by the request field they belong to; null when none is tied to a field.
object
object
A stable code such as audience.contact_not_found. Branch on this, never on message. Every code is listed in the error codes catalog.
An English sentence for your logs. Do not show it to end users: it can change.
The numbers the message mentions (a minimum, a maximum), when there are any.
object
Example
{ "isSuccess": false, "value": null, "status": 5, "errors": [ { "code": "validation.required", "message": "Fill in this field.", "params": null } ], "fieldErrors": { "email": [ { "code": "validation.required", "message": "Fill in this field.", "params": null } ] }}Missing or invalid API key
The key lacks the items:write permission
Too many requests for this key