API referenceGetting started
Rate limiting
Request limits per organization, the rate limit headers, and what to do when you hit a limit.
Default rate limits
Every organization has a per-minute request limit and a daily allowance. Once an organization uses up its daily allowance, its per-minute limit drops until the allowance resets, a day after the first request that counted toward it. The X-RateLimit-* response headers show the limit that applies to a request and how much of it is left. If your organization needs higher limits, contact us at developers@mothership.com.
Two endpoints have their own, lower limits on top of these.
| Endpoint | Limit |
|---|---|
| Create a quote | A per-minute limit that drops after a burst of quotes, until a few hours after the first quote in the burst. |
| Create a shipment | A per-minute limit. |
These endpoint limits only count requests that pass validation, so a malformed request doesn't use up your quota. A quote that fails before any carrier is rated, such as one whose address can't be found or that we can't ship, doesn't count toward the quote limit either. Sandbox requests are counted separately from production.
Response headers
Every API response includes the following rate limiting headers. On the two endpoints above, a request that counts toward the endpoint limit gets headers that describe it.
| Header | Description |
|---|---|
X-RateLimit-Limit | The maximum number of requests for the current time window. |
X-RateLimit-Remaining | The number of requests remaining for the current time window. |
X-RateLimit-Reset | A unix timestamp, in seconds, of when the request counter resets. |
Limit exceeded
If you exceed your rate limit, the API will respond with HTTP status code 429 and the header Retry-After. Retry-After is the length of the window you exceeded, in seconds. To wait no longer than needed, wait until the time in X-RateLimit-Reset.
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 60
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1773939660{
"code": 429,
"type": "RATE_LIMIT_EXCEEDED",
"message": "You have reached your minutely limit. Please try again in the next minute."
}| Limit | Message |
|---|---|
| Per minute | You have reached your minutely limit. Please try again in the next minute. |
| Daily allowance used up | You have reached your daily limit. Your per-minute limit is lower until it resets. Please try again in the next minute. |
| Quotes | You have hit your quote rate limit |
| Shipments | You have hit your shipping rate limit |