Rate Limits

Understanding user limits for API calls.

The following rate limits are in place for all ScienceIO accounts:

  • Users may make up to 10 API calls (or POST requests) every 1 minute.
  • Users may make up to 300 GET requests every 1 minute.
  • Users will be rate limited when they exceed either of these caps.

In addition:

Remember that the API can only accept a maximum of 10,000 characters per API call.

Disable Automatic Retries (Python SDK)

You may disable automatic retries when the rate limit is hit by using the following code:

# Import the HTTP Status library
from http import HTTPStatus
# Import time functions
import time

from scienceio import ScienceIO, HTTPError
scio = ScienceIO(enable_rate_limit_retry=False)

query_text = "ALS is often called Lou Gehrig's disease, after the baseball player who was diagnosed with it. Doctors usually do not know why ALS occurs."

    response = scio.structure(query_text)
except HTTPError as e:
    # Retry time is based on the response.headers value
    # Max retry time is 60 seconds
    if e.status_code == HTTPStatus.TOO_MANY_REQUESTS:
        retry_after = int(e.headers.get('retry-after', 0)) 
        response = scio.structure(query_text)



If you disable automatic handling, you will receive a 429 HTTP status code in the header containing the retry-after value (for example, "Rate limit exceeded: 10 requests per 1 minute").

Retry Manually (HTTP)

If you hit the rate limit, add verbose to your code as shown below. This will enable you to access the retry-after header, which contains the number of seconds you must wait to try your call again. Learn more about the Retry-After header here.

Remember that the retry-after value can be accessed at any time, so you should wait to retrieve this value after you have received a 429 error; this value is not applicable unless an error has occurred.


This example is for the structure endpoint. For help structuring your code for other endpoints, see Call a Different Endpoint

curl https://api.aws.science.io/v2/structure \
  --request POST \
  --verbose \
  --header "Content-type: application/json" \
  --header "x-api-id: $SCIENCEIO_KEY_ID" \
  --header "x-api-secret: $SCIENCEIO_KEY_SECRET" \
  --data '{ "text": "ALS is often called Lou Gehrigs disease, after the baseball player who was diagnosed with it. Doctors usually do not know why ALS occurs."}'