Work with API limits

Completed

To manage the performance of the Business Central SaaS servers, Microsoft limits the usage of the API. You should be aware of these limitations so that you can optimize your code when you connect by using the API. Limits also apply to OData and SOAP web services. For API requests, an HTTP response code 429 - Too Many Requests means that a rate limit was exceeded. Implement retry logic with a cool-off period, such as exponential backoff. API request execution is limited to 10 minutes; if a response can't be provided within that time, the service aborts the request and returns 504 - Gateway Timeout.

Current operational limits for Business Central online OData requests include:

  • Request rate - Each user or service principal can submit up to 6,000 requests within a five-minute sliding window. Exceeding the limit returns 429 - Too Many Requests.

  • Concurrent requests and connections - Up to five requests per user can be processed at a time. Up to 100 connections per user can be active or queued; exceeding the connection limit returns 429 - Too Many Requests.

  • Page size - A response can contain up to 20,000 entities. Use continuation tokens to retrieve additional pages.

  • Operation timeout - An OData request has an eight-minute operation timeout.

  • Batch size - A $batch request can contain up to 100 operations. Large batches can time out.

For current details, see Working with API limits and Operational limits for Business Central online.

To reduce the number of calls from a client or integration and to reduce the run time, use the following approaches:

  • Webhooks should receive changes when they occur. Your application can get a push message when an entity is modified instead of you having to check for changes every few minutes. Try to convert your solution from a pull to a push model. If that option isn't possible, you can apply other recommendations.

  • Use batching to perform multiple operations in one call.

  • Use the $filter OData filter expression to reduce the number of returned entities.

  • Use the $expand OData query option to retrieve related entities in one request.

  • When you post data, you can also use deep inserts. You can send details in one request. When you create a new sales order, you can send all of your sales lines in the same POST request and have them created in one call.