Create Content
Creates a new content entry of a given model.
This endpoint is useful for creating content from scripts, migrations, integrations or CI/CD pipelines.
Endpoint
curl -X POST https://api.contentisland.net/api/1.0/content \--header 'Authorization: Bearer YOUR_WRITE_TOKEN' \--header 'Content-Type: application/json' \--data '{ ... }'Body
The endpoint expects a JSON body with the following structure:
interface CreateContentPayload { contentType: string; // model name (e.g. "post") name: string; // display name of the new content entry content: CreateContentLanguageEntry[];}
interface CreateContentLanguageEntry { language?: LanguageCode; // optional — defaults to the project's first language fields: CreateContentField[];}
interface CreateContentField { name: string; // field name as defined in the model value: any; // field value (type depends on the field)}| Name | Description |
|---|---|
contentType | The name of the model the new content belongs to. Must match an existing model in the project. |
name | The human-readable name of the new content entry, used in the dashboard. |
content | Array of language entries. Each entry contains the fields to populate for that language. If language is omitted, the project’s default is applied. |
Example
curl -X POST https://api.contentisland.net/api/1.0/content \--header 'Authorization: Bearer YOUR_WRITE_TOKEN' \--header 'Content-Type: application/json' \--data '{ "contentType": "post", "name": "My first post", "content": [ { "language": "en", "fields": [ { "name": "title", "value": "Hello world" }, { "name": "body", "value": "This was created via the REST API." }, { "name": "order", "value": 1 } ] } ]}'Response
On success the endpoint returns 201 Created with the ID of the new content:
interface CreateContentResponse { id: string;}{ "id": "660f5b8a3a1c2d4e7f8b9012"}Status Codes
| Code | Description |
|---|---|
| 201 | The content was created successfully. The response body contains the new content id. |
| 400 | Invalid payload. The response includes an error message and, when applicable, a fieldErrors map describing each problem. |
| 401 | Unauthorized. The token is missing, malformed or expired. |
| 403 | Forbidden. The token does not have write permissions — use a Write Token. |
| 404 | The provided contentType does not match any model in the project. |
| 500 | Internal server error. An error occurred while processing the request. |