Contentful Images API

Development / API Key Intermediate HTTPS CORS
Varies by plan (check documentation)

Overview

The Contentful Images API lets you retrieve, resize, crop, convert format, and apply other transformations to images stored in your Contentful media library by simply appending query parameters to the image URL. An API key (delivery token) is required to access images from your Contentful space. It eliminates the need for a separate image-processing service when your content is already managed in Contentful.

💡

Beginner Tip

Image transformations are applied via URL query parameters—for example, append ?w=400&h=300&fit=fill to resize and crop an image. You need your Contentful Space ID and Delivery API token to construct the correct base URL.

Available Data

Contentful Images data via REST API
JSON-formatted response data
Requires API key authentication

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from Contentful Images",
    "description": "Used to retrieve and apply transformations to images",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

(binary image data) The transformed image is returned as raw binary content with the appropriate Content-Type header (e.g., image/webp).
Content-Type header MIME type of the returned image, reflecting the requested format conversion.
Content-Length header Size of the returned image in bytes.
Cache-Control header Caching directives set by Contentful's CDN for the transformed image.

Implementation Example

const url = "https://www.contentful.com/developers/docs/references/images-api/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

401 Unauthorized The Delivery API token is missing or incorrect in the request.
Include your delivery token as the Authorization: Bearer YOUR_TOKEN header, or as the access_token query parameter.
404 Not Found The asset ID in the URL does not exist in your Contentful space, or the space ID is wrong.
Verify the asset ID from the Contentful web app, and ensure the space ID in the URL matches your target environment.
Invalid transformation parameters Using an unsupported image format or out-of-range resize dimensions.
Supported formats are jpg, png, webp, gif, and avif; dimensions must be between 1 and 4000 pixels. Remove invalid parameters and retry.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 10/20
🔒 Security 15/15
🛠 Developer XP 17/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS YES
Category Development
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →