A Contentful Delivery API token lets a client read the published content of a Contentful space: pages, articles, product copy and the assets linked to them. It is designed for websites and apps that display content to the public, so it is less sensitive than a management token. The risk is still real. A leaked delivery token can be used to pull content that is not yet published if a preview token is also exposed, and it lets someone make many requests against your space in your name. Rotate it, then check what the traffic looked like.
Check your GitHub account for leaked secrets — free
- Provider
- Contentful
- Severity
- High
- Impact
- SaaS account access and billing
- Checked live by LeakWatch
- No
What a Contentful Delivery API token looks like
A delivery token is a long string of letters, digits, underscores, hyphens and equals signs, usually 43 characters in its common form. It has no fixed prefix. It is normally stored in a variable whose name contains the word contentful, in a site build configuration, in a hosting provider’s environment settings or in a .env file:
CONTENTFUL_DELIVERY_TOKEN=<43-character value, masked as XXXX…>
Contentful issues delivery and preview keys in pairs, and it can also issue personal access tokens for its management API. Those management tokens are more powerful and have their own rules. If the value you found was used to read published pages, treat it as a delivery token. If it was used to change content, treat it as a management token and read the notes below with that in mind.
How Contentful delivery tokens get leaked
- Front-end builds. A token inlined into a JavaScript bundle at build time. Anyone who opens the site can read it in the browser’s developer tools.
- Environment files committed to a repository. A
.envfile with the token, pushed because the ignore rules did not cover it. - Hosting dashboards shared with contractors. An environment variable copied into a ticket or a chat when a developer asked for help with a build.
- CI logs. A build step that prints its environment, or a verbose mode that echoes the configuration.
- Copied examples. A starter project or a tutorial with a real token left in place of the placeholder.
What to do in the first hour
- Delete the API key in the space. Open the space settings in the Contentful web app, go to the API keys section, open the key that holds the leaked token and delete it. Deleting a key also removes its preview token, so you will need to create a new key pair for the preview environment as well. Do this before you clean the repository.
- Create a new key pair and store the new delivery token in your hosting provider’s secret settings, not in the code. Rebuild and redeploy the site so the new value is used.
- Check the content. Look at the recent changes in the space and confirm that nothing unexpected was published. A delivery token cannot publish content by itself, but a management token can, so check for that separately if your team has one.
- Review the traffic. If your site or CDN keeps request logs, look at the period since the token may have been exposed. Unusual volumes of content requests, or requests from unexpected places, are the signs to watch.
- Check the other secrets in the same build configuration. Hosting and CI settings often hold several tokens together, so rotate any that sit next to it.
- Clean the repository after the rotation: remove the value from the files, add the file to
.gitignoreand decide whether to rewrite history. An old clone still holds the value until it is deleted.
Not sure what else leaked? Run a free scan.
Revoke it at Contentful
Sign in to the Contentful web app and open the account settings for the space. The API keys area is reached through the settings menu of the space. Delete the key that holds the leaked token, then create a new pair. Contentful’s management API also has a revocation endpoint for personal access tokens, which is useful for teams that manage tokens from a script. We confirmed the endpoint in Contentful’s reference, but we did not confirm the current menu wording in the web app during this review, so follow what the interface shows when you act.
How LeakWatch detects it
The rule is called Contentful Delivery API Token. It looks for the word contentful, optionally followed by a short label, a separator such as an equals sign or a colon, and then a value of exactly 43 letters, digits, underscores, hyphens or equals signs. The word contentful must appear close to the value, so a 43-character string on its own is not reported. The severity is high, with the impact class for SaaS services. This type is not checked live: LeakWatch does not send the token to Contentful.
LeakWatch detects this format but does not check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.
FAQ
Is a delivery token as dangerous as a management token?
No. A delivery token reads published content, while a management token can create and change content. The steps above still apply, because a leaked delivery token shows how your build is set up and can be used to make many requests.
Will my site stop working after I delete the key?
It will stop fetching content until it is rebuilt with the new token. Deploy the new value first if you can, then delete the old key. If the leak is active, the short gap is worth it.
Does the preview token matter?
Yes. Deleting a key also removes its preview token, and the preview token can show unpublished content. Make sure the preview environment gets the new value too, and that the old one is no longer used anywhere.