Introduction
The Wagtail Bakery Demo provides a RESTful API built on Wagtail’s API v2 framework. The API allows you to programmatically access pages, images, and documents from the CMS.Base URL
All API endpoints are available under the/api/v2/ base path:
Available Endpoints
The API exposes three main endpoints:| Endpoint | URL | Description |
|---|---|---|
| Pages | /api/v2/pages/ | Access all page content |
| Images | /api/v2/images/ | Access image assets |
| Documents | /api/v2/documents/ | Access document files |
API Configuration
The API is configured using Wagtail’sWagtailAPIRouter in bakerydemo/api.py:
Authentication
The API endpoints are publicly accessible by default. For production deployments, consider implementing authentication and rate limiting.
Response Format
All API responses are returned in JSON format with the following structure:Metadata about the response, including pagination information
Total number of items available
Array of objects matching the query
Example Response
Common Query Parameters
All endpoints support standard query parameters:Number of items to return per page (max 100)
Number of items to skip before returning results
Comma-separated list of fields to include in the response. Use
* for all fields.Field name to order results by. Prefix with
- for descending order.Example with Parameters
Pagination
The API uses limit/offset pagination. Navigate through results using thelimit and offset parameters:
Error Responses
API errors are returned with appropriate HTTP status codes:| Status Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 404 | Not Found - Resource doesn’t exist |
| 500 | Internal Server Error |
Next Steps
Pages API
Access page content and metadata
Images API
Retrieve image assets and renditions
Documents API
Access document files

