Response headers

Understanding rate limit and quota information in API response headers.

All Hiro APIs return response headers that provide important information about rate limits and usage quotas. These headers are separated by service type (Stacks vs Bitcoin) to provide more granular control over API usage.

The following headers are returned with every API response:

Terminal
$
curl -I https://api.hiro.so/extended/v1/info -H 'x-api-key: your-api-key'
HeaderDescription
ratelimit-limitThe rate limit ceiling for that endpoint
ratelimit-remainingThe number of requests left for the current window
ratelimit-resetThe time when the rate limit window resets (Unix timestamp)
retry-afterTime to wait before retrying (only present when rate limited)

Service-specific headers

Hiro APIs include additional headers that provide granular rate limit information per service type, reflecting the separation of rate limits between Stacks and Bitcoin services.

Stacks service headers

When calling Stacks-related endpoints (Stacks Blockchain API, Token Metadata API, etc), you'll receive:

// Example: Fetching Stacks account info
const response = await fetch('https://api.hiro.so/extended/v1/address/SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP/assets', {
headers: { 'x-api-key': apiKey }
});
console.log(response)
// New headers in response:
// x-ratelimit-cost-stacks: 1 // !mark
// x-ratelimit-limit-stacks-minute: 500
// x-ratelimit-remaining-stacks-minute: 499
HeaderDescription
x-ratelimit-cost-stacksThe quota cost for this specific request
x-ratelimit-limit-stacks-secondPer-second limit for Stacks services
x-ratelimit-remaining-stacks-secondRemaining requests this second
x-ratelimit-limit-stacks-minutePer-minute limit for Stacks services
x-ratelimit-remaining-stacks-minuteRemaining requests this minute
x-ratelimit-limit-stacks-monthMonthly limit for Stacks services
x-ratelimit-remaining-stacks-monthRemaining requests this month

Bitcoin service headers

When calling Bitcoin-related endpoints (Ordinals API, Runes API), you'll receive:

// Example: Fetching inscription data
const response = await fetch('https://api.hiro.so/ordinals/v1/inscriptions', {
headers: { 'x-api-key': apiKey }
});
console.log(response)
// New headers in response:
// x-ratelimit-cost-bitcoin: 1
// x-ratelimit-limit-bitcoin-minute: 500
// x-ratelimit-remaining-bitcoin-minute: 499
HeaderDescription
x-ratelimit-cost-bitcoinThe quota cost for this specific request
x-ratelimit-limit-bitcoin-secondPer-second limit for Bitcoin services
x-ratelimit-remaining-bitcoin-secondRemaining requests this second
x-ratelimit-limit-bitcoin-minutePer-minute limit for Bitcoin services
x-ratelimit-remaining-bitcoin-minuteRemaining requests this minute
x-ratelimit-limit-bitcoin-monthMonthly limit for Bitcoin services
x-ratelimit-remaining-bitcoin-monthRemaining requests this month

Migration timeline

To ensure a smooth transition, we're maintaining backward compatibility:

  • August 1, 2024: New headers are introduced alongside existing headers
  • September 1, 2024: Legacy headers will be deprecated and removed

Legacy headers (deprecated)

The following headers will be removed on September 1st, 2024:

  • x-ratelimit-limit-second
  • x-ratelimit-limit-minute
  • x-ratelimit-limit-month
  • x-ratelimit-remaining-second
  • x-ratelimit-remaining-minute
  • x-ratelimit-remaining-month

Service classification

APIs are classified into service types based on their URL path:

Service TypePath PatternExamples
Bitcoin/ordinals/*Ordinals API endpoints
Bitcoin/runes/*Runes API endpoints
StacksAll other pathsStacks Blockchain API, Token Metadata API, Signer Metrics API, Explorer, and other services

The x-ratelimit-cost-* header shows the exact quota cost for each request, which may vary based on the endpoint and parameters used. Platform services (Platform API, Devnet) have separate rate limiting.

Further reading

How is this guide?