Skip to content

Introduction

The Storyblok Content Delivery API is organized around REST. It has predictable, resource-oriented URLs and uses HTTP response codes to indicate API errors. The API uses built-in HTTP features, such as HTTP query parameters and HTTP verbs, which are understood by off-the-shelf HTTP clients. Further, it supports cross-origin resource sharing, allowing for secure interaction with the API from a client-side web application. All API responses, including errors, return JSON.

The base URL for the Content Delivery API depends on the server location of the space. Below are the available endpoints for different regions:

https://api.storyblok.com/v2/cdn

API requests must be authenticated by providing an API access token as a query parameter. Learn more in the access tokens concept.

Consider the following example on how to fetch published stories:

curl "https://api.storyblok.com/v2/cdn/stories\
?token=wANpEQEsMYGOwLxwXQ76Ggtt\
&version=published"

The Content Delivery API uses HTTP response codes to indicate the success or failure of an API request.

In general, codes in the 2xx range indicate success. Codes in the 4xx range indicate a request that failed given the information provided (for example, a required parameter was omitted, a content entry was not published but the version requested was set to published, etc.). Codes in the 5xx range indicate an error with Storyblok’s servers (these are rare).

Some 4xx errors that could be handled programmatically (for example, if a story was not found) include an error message that briefly explains the error reported.

CodeStatusDescription
200OKEverything worked as expected.
400Bad RequestThe wrong format was sent (e.g., XML instead of JSON).
401UnauthorizedNo valid API key was provided.
404Not FoundThe requested resource doesn’t exist (e.g., due to not yet published content entries).
422Unprocessable EntityThe request was unacceptable, often due to missing a required parameter.
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requests.
500, 502, 503, 504Server ErrorsSomething went wrong on Storyblok’s end (these errors are rare).

Caching is the process of storing data so that future requests for that data can be served faster. Instead of generating a response from scratch for every request, a cached copy is served, reducing the load on the server and speeding up response times. To deliver content and assets as fast as possible, Storyblok leverages a content delivery network (CDN) powered by Amazon CloudFront.

AWS CloudFront edge server locations on a world map

AWS CloudFront edge server locations on a world map

The Storyblok Content Delivery API is subject to rate limits to ensure fair usage and optimal performance. The following rate limits apply:

Type of requestRate limit
Cached requests from the CDN1000 per second
Single content entries50 per second
Listings with fewer than or equal to 25 entries50 per second
Listings with 25 to 50 entries15 per second
Listings with 50 to 75 entries10 per second
Listings with 75 to 100 entries6 per second

The rate limit per second will be proportionately reduced when opting for more than 25 entries per request via the pagination parameters.

To ensure compliance with the rate limits, consider the following practices:

  • Throttling: If a 429 status code is received, slow down requests by introducing delays to allow graceful recovery.
  • Caching: Use cached requests whenever possible, as they have higher rate limits. Learn more in the caching concept.
  • Retrying: Implement a retry strategy with exponential backoff for failed requests due to rate limit errors.
  • Monitoring: Set up monitoring and alerting to track API usage and detect rate limit breaches early.

To efficiently handle large datasets, the Content Delivery API supports pagination for all the stories, links, and datasource entries endpoints. This allows users to navigate through large datasets by retrieving a specific number of entries per page and requesting subsequent pages as needed.

Paginated endpoints accept two parameters:

  • page: An integer value representing the page number to retrieve. Increase this value to receive the next page of entries. Default is 1.
  • per_page: The number of entries per page. Default is 25. Maximum is 100 (1000 for datasource entries).

Paginated API requests include two properties in the response headers:

  • total: Indicates the total number of items available across all pages.
  • per_page: Specifies the number of items per page as per your request.

These values can be leveraged to implement efficient pagination strategies.

Was this page helpful?

What went wrong?

This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window) . Terms of Service (opens in a new window) apply.