# Items API Best Practice

## Messages

### Mini-batches and rate limiting

The items API has a rate limiter of 250 messages per second per tenant and per environment. To maximise the throughput of items, for example when sending a new catalogue, it is recommended to group multiple items in a single message.

## Recommended message size

It is recommended to keep the size of a message under 1MB. The average size of an item allows to calculate the maximum number of items to send in each message.

## Connection settings and latency

To maximise the number of messages to send, it is recommended to:

* Use http Keep-Alive through the header Connection:Keep-Alive
* Send messages in an asyncronous way.
* The items API is hosted in EU (GCP Belgium), please make sure that the sender is as close as possible to reduce the latency.
* Ensure your code can detect errors and resend the message.

## Dealing with item rejections

The items api can actively reject items under certain conditions, for example if the required attributes haven't been provided for an item, if the attributes provided have the incorrect basetype or if a product hasn't been assigned to a valid category.

It is therefore advised to log error messages returned by the items api and have a strategy to define under what conditions a new catalogue should or should not be activated.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://crownpeak.gitbook.io/product-discovery/sending-and-managing-product-data/what-is-the-items-api/best-practice/items-api-best-practices.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
