microCMS

PUT /api/v1/{endpoint}/{content_id}

By using the PUT API, you can submit content via the API.
Unlike the POST API, it allows you to specify the content ID to create content.

informationInformation
  • 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 PUT API requests.
Please enable "PUT" with default permissions or individual permissions and include it in the request header when sending.

cautionCaution

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=draft as a parameter.
  • Closed status: Please add status=closed as 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: "2024-01-01T00:00:00Z")

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": "YOURFIELDID", "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 PUT API, please make the request without including the key of the relevant field in the request body.

Response

If the content is created successfully, a 201 response will be returned.

Response Body

If the request is executed successfully, the response body will look like this:

{
    "id": "someId"
}

Error Response

Please refer to the Content API Error Response.