Skip to content

Create an Entry

Creates a new content entry in a collection.

POST /api/{projectId}/{collectionSlug}

Parameters

ParameterTypeDescription
projectIduuidYour project UUID
collectionSlugstringThe collection slug

Request body

{
"status": "published",
"locale": "en",
"fields": {
"title": "My new post",
"slug": "my-new-post",
"body": "<p>Content here...</p>"
}
}
FieldTypeDefaultDescription
statusstringdraftdraft or published
localestringproject defaultEntry locale
fieldsobject{}Field values keyed by field slug

Request

Terminal window
curl -X POST https://your-domain.com/api/{projectId}/posts \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "published",
"locale": "en",
"fields": {
"title": "My new post",
"slug": "my-new-post"
}
}'

Response

Returns the created entry with HTTP 201 Created:

{
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"status": "published",
"locale": "en",
"created_at": "2024-01-15T10:30:00+00:00",
"updated_at": "2024-01-15T10:30:00+00:00",
"fields": {
"title": "My new post",
"slug": "my-new-post"
}
}

Status codes

StatusDescription
201Created successfully
403Insufficient permissions
404Collection not found
409Singleton collection already has an entry
422Invalid locale or field values