POST /api/v1/{endpoint}
By using the POST API, you can submit content via the API.
Information
- Only the list format API is available. The object format API cannot be used, so please be aware.
- If no query parameters are specified, the status will be published and the content will be created.
Request Header
X-MICROCMS-API-KEY
This is the authentication key required for POST API requests.
Please enable "POST" with default permissions or individual permissions and include it in the request header when sending.
Caution
If the X-MICROCMS-API-KEY is identifiable, it may allow unauthorized manipulation of content by third parties. Please handle it with care. For more details, please refer to "API Key (API Authentication and Authorization Management)".
Content-Type
Specifies the format of the data being sent.
Since microCMS only handles data in JSON format, please specify application/json.
Query Parameters
status
This parameter is used to create content in draft or closed status.
- Draft status: Please add
status=draftas a parameter. - Closed status: Please add
status=closedas a parameter.
Request Body
Prepare the JSON of the content you want to send according to the API schema and pass it as a string.
Example:
{"title":"Sample Title","category": ["Sample Category"]}Field-Specific Specification Methods
Text Field
Please specify any string.
(Example: "Text 1")
Text Area
You can specify a multi-line string using newline characters.
(Example: "Input multiple lines of text\nInput multiple lines of text")
Rich Editor
You can specify decorations and images using HTML strings. For more details, please refer to the Rich Editor WRITE API.
(Example: "<h1>Heading</h1><p>You can submit in HTML like this</p>")
Old Rich Editor
You can specify a multi-line string using newline characters.
(Example: "Input multiple lines of text\nInput multiple lines of text")
Registration with HTML tags is not supported.
※If HTML is registered, it will be escaped as follows.<p>Text 1</p> → &lt;p&gt;Text 1&lt;/p&gt;
Image
Please specify the URL of the image uploaded to the same service of microCMS.
(Example: "https://images.microcms-assets.io/assets/xxxxxxxx/yyyyyyyy/sample.png")
About Specifiable Image URLs
If a custom domain for media is set, both the custom domain and the default domain (microcms-assets.io) are accepted.
Also, specifying an invalid URL as follows will result in an error.
- URL of an image not uploaded to microCMS
- URL of an image uploaded to a different service of microCMS (Note: Services created with the multiple environment feature are also treated as different services)
Multiple Images
Please specify the URLs of images uploaded to the same service of microCMS as an array.
(Example: ["https://images.microcms-assets.io/assets/xxxxxxxx/yyyyyyyy/sample1.png", "https://images.microcms-assets.io/assets/xxxxxxxx/yyyyyyyy/sample2.png"])
The specifications for image URLs are the same as for the image field.
Date and Time
Please specify as a string in ISO format (ISO 8601).
(Example: "2020-04-23T14:32:38.163Z")
Number
Please specify a number.
(Example: 123)
Boolean
Please specify a boolean value.
(Example: true)
Select Field
Please specify the elements of the select field as an array.
(Example: ["Element 1","Element 2"])
Content Reference
Please specify the contentId of the referenced content.
(Example: "referenced id")
Multiple Content References
Please specify the contentIds of the referenced contents as an array.
(Example: ["referenced id1","referenced id2"])
Custom Field
Please specify the target data in object format, including fieldId and the field value.
(Example: { "fieldId": "YOUR_FIELD_ID", "some_value": "" })
Repeating Field
Please specify the target data as an array of custom fields. Each element of the array must include fieldId and the field value.
Example:
[
{
"fieldId": "YOURFIRSTFIELDID",
"sometext_value": ""
},
{
"fieldId": "YOUR_SECOND_FIELD_ID",
"some_int_value": 10
}
]File
Please specify the URL of the media uploaded to the same service of microCMS.
(Example: "https://files.microcms-assets.io/assets/xxxxxxxx/yyyyyyyy/manual.pdf")
About Specifiable File URLs
If a custom domain for media is set, both the custom domain and the default domain (microcms-assets.io) are accepted.
Also, specifying an invalid URL as follows will result in an error.
- URL of a file not uploaded to microCMS
- URL of a file uploaded to a different service of microCMS (Note: Services created with the multiple environment feature are also treated as different services)
Extended Field
Please specify the content of the target data (message part) in object format. You can specify only the properties you want to register.
For details on each value, please check the Extended Field.
Example:
{
"id": "some-id",
"title": "some-title",
"description": "some-description",
"imageUrl": "https://images.microcms-assets.io/assets/xxxx/yyyy/{fileName}.png",
"updatedAt": "2024-01-01T00:00:00Z",
"data": { "id": "123" }
}How to Specify Automatically Assigned Fields
Published Date (publishedAt)
Please specify as a string in ISO format (ISO 8601).
(Example: "2024-01-01T00:00:00Z")
How to Register Fields with Empty Values
If you want to register a field with an empty value in the POST API, please omit the key of the relevant field from the request body.
Response
If the content is successfully created, a 201 response will be returned.
Response Body
If the request is successfully executed, the response body will look like this:
{
"id": "someId"
}Error Response
Please refer to the Content API Error Response.