Subchapter 3.3
references/content-delivery/localization.mdMarkdown4 KBView on GitHub
How to fetch content in specific locales via the Content Delivery API.
Without the locale parameter, the API returns content in the space’s default locale:
curl "https://cdn.contentful.com/spaces/{space_id}/environments/master/entries/{entry_id}" \
-H "Authorization: Bearer {cda_token}"Response fields contain resolved values directly:
{
"fields": {
"title": "Hello World",
"body": "Post content"
}
}Request content in a specific locale:
curl "https://cdn.contentful.com/spaces/{space_id}/environments/master/entries/{entry_id}?locale=de-DE" \
-H "Authorization: Bearer {cda_token}"{
"fields": {
"title": "Hallo Welt",
"body": "Beitragsinhalt"
}
}curl "https://cdn.contentful.com/spaces/{space_id}/environments/master/entries?content_type=blogPost&locale=fr-FR" \
-H "Authorization: Bearer {cda_token}"Use locale=* to get all locales in a single response:
curl "https://cdn.contentful.com/spaces/{space_id}/environments/master/entries/{entry_id}?locale=*" \
-H "Authorization: Bearer {cda_token}"Response fields become locale-keyed (same structure as CMA):
{
"fields": {
"title": {
"en-US": "Hello World",
"de-DE": "Hallo Welt",
"fr-FR": "Bonjour le monde"
},
"body": {
"en-US": "English content",
"de-DE": "German content"
}
}
}Non-localized fields only appear under the default locale.
Each locale can have a fallback locale configured in space settings. If content doesn’t exist in the requested locale, Contentful returns the fallback locale’s value instead.
Example fallback chain:
fr-FR → en-US → null
de-DE → en-US → null
ja-JP → en-US → nullIf a German translation doesn’t exist for a field, the English value is returned.
Use locale=* to see which locales actually have content:
curl "...?locale=*" -H "Authorization: Bearer {cda_token}"If fields.title only has {"en-US": "Hello"} and no de-DE key, the German locale is using the English fallback.
# Search German titles
curl "...?content_type=blogPost&locale=de-DE&fields.title[match]=Hallo" \
-H "Authorization: Bearer {cda_token}"Full-text query searches all locales by default:
curl "...?content_type=blogPost&query=contentful" \
-H "Authorization: Bearer {cda_token}"Combine with locale to search within a specific locale:
curl "...?content_type=blogPost&locale=fr-FR&fields.title[match]=bonjour" \
-H "Authorization: Bearer {cda_token}"curl "https://cdn.contentful.com/spaces/{space_id}/environments/master/locales" \
-H "Authorization: Bearer {cda_token}"Response:
{
"sys": { "type": "Array" },
"items": [
{
"code": "en-US",
"name": "English (United States)",
"default": true,
"fallbackCode": null
},
{
"code": "de-DE",
"name": "German (Germany)",
"default": false,
"fallbackCode": "en-US"
},
{
"code": "fr-FR",
"name": "French (France)",
"default": false,
"fallbackCode": "en-US"
}
]
}Assets can have different files per locale:
curl "...?locale=*" -H "Authorization: Bearer {cda_token}"{
"fields": {
"title": { "en-US": "User Guide", "de-DE": "Benutzerhandbuch" },
"file": {
"en-US": { "url": "//images.ctfassets.net/.../guide-en.pdf", "fileName": "guide-en.pdf" },
"de-DE": { "url": "//images.ctfassets.net/.../guide-de.pdf", "fileName": "guide-de.pdf" }
}
}
}locale for default — don’t specify locale for the default languagelocale=* sparingly — significantly increases response size/locales endpoint — fetch available locales dynamically rather than hardcoding