Switch Developer Documentation
  • Welcome
  • ⚠️Migration to Auth0
    • Overview
    • Status
    • Switch API
      • Client Credentials Flow
      • Organization Client
      • Token Endpoint
    • OpenADR 3 VTN API
      • VTN Credentials
      • Token Endpoint
  • Getting Started
    • Concepts
    • Guides
      • How to send readings
      • Market operations
      • Conditional agreements
    • Support
  • Switch API
    • Overview
    • Terms of Use
    • Authentication
      • Client Credentials Flow
      • Organization Client
      • Token Endpoint
    • Rate Limiting
    • Errors
    • API Reference
      • Market Zones
      • Products
      • Resources
      • Meters
      • Readings
  • OpenADR 3
    • Overview
    • Authentication
      • VTN Credentials
      • Token Endpoint
    • API Reference
      • Programs
      • Events
      • Reports
      • Subscriptions
      • Vens
    • Webhooks
      • Callback URL verification
      • Domain and IP addresses
      • Best practices
    • Payloads
    • Code samples
  • Libraries
    • .NET SDK
      • SDK Reference
        • IAuthService.Auth
        • IProgramsService.Programs
        • IEventsService.Events
        • IReportsService.Reports
        • ISubscriptionsService.Subscriptions
        • IVensService.Vens
Powered by GitBook
On this page
  • About rate limits
  • Rate limit for authenticated users
  • Rate limit for OAuth 2.0 applications
  • Rate limit status
  • Exceeding the rate limit

Was this helpful?

  1. Switch API

Rate Limiting

Learn about Switch API rate limits, how to avoid exceeding them, and what to do if you do exceed them.

About rate limits

To ensure that the API remains available for all users, and help prevent abuse and denial-of-service attacks, Switch limits the number of API requests that you can make within a specific amount of time.

Not all endpoints of the Switch API apply rate limits. Some endpoints, like the save readings endpoint for example, have more restrictive limits and some are unrestriced.

In general, the rate limit for the Switch API is based on the method of authentication, as described below.

Rate limit for authenticated users

The Switch app uses users personal access token to make API requests. All of these requests count towards the users personal rate limit which is unrestricted at the moment.

Rate limit for OAuth 2.0 applications

Applications that make requests to the Switch API use OAuth 2.0 Client Credentials flow to get an access token which is then used to authenticate with the API. These types of requests have separate rate limits applied to them, depending on the endpoint.

The following rate limits are applied for these types of requests per endpoint:

Method
Endpoint
Limit

POST

/api/readings

5 requests per second and/or 20 requests per minute

ALL

rest of the endpoints

no limit

Rate limit status

The response's HTTP headers are the authoritative source for the current number of API calls available to your application at any given time. The returned HTTP headers of any API request show your current rate limit status, as described below.

Header Name
Description

X-Rate-Limit-Limit

The maximum number of requests that you can make per minute

X-Rate-Limit-Remaining

The number of requests remaining in the current rate limit window

X-Rate-Limit-Reset

The time at which the current rate limit window resets, represented using ISO 8601 format and is always in UTC

Retry-After

The time in seconds after which you can retry your request

Exceeding the rate limit

If you exceed your rate limit for a given rate limit window, you will receive a 429 Too Many Requests response, and the Retry-After header will contain the time in seconds after which you can retry your request. You should not retry your request until this time has passed.

The body of the response will also contain message in plain text informing you about the current rate limit and the time after which you can retry your request as shown below.

HTTP/2 429
Retry-After: 41

Save readings API interface quota exceeded. Maximum allowed is 20 requests per 1m. Please try again in 41 second.

Continuing to make requests while you are rate limited may result in the deactivation of your integration.

PreviousToken EndpointNextErrors

Last updated 9 months ago

Was this helpful?