microCMS

GET /api/v1/{endpoint}/{content_id}

This is an API that allows you to retrieve content specified by the id in a list-type API.

Request Header

X-MICROCMS-API-KEY

This is the authentication key required for GET API requests.
Please enable "GET" 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)".

Query Parameters

This API allows you to specify parameters.

informationInformation

If query parameters are added but no values are specified, the following behavior will occur:

  • depth: This will behave the same as if a value of 0 were specified.
  • Other than depth: This will behave the same as if no query parameters were specified.

draftKey

This parameter is used to retrieve content in draft status. Please add the draftKey that can be confirmed in the content editing screen as a parameter.
The draft content that can be retrieved using draftKey is usually only one.
If you want to retrieve multiple pieces of content in draft status at the same time, please enable "Retrieve All Drafts" with default permissions or individual permissions and make the request.

fields

Specify the elements to retrieve from the content.
List the values separated by commas, like fields=title,main_image,updatedAt,author.name. You can also specify elements of referenced content by connecting keys with dots, like author.organization.name. If fields is not specified, all elements will be retrieved.

depth

Specify the depth of the hierarchy to retrieve referenced content.
The minimum value is 0 and the maximum value is 3.
The default value is 1.

For example, if you are recursively referencing yourself to display related articles in blog content.

Example) When depth = 0

{
  "id": "id1",
  "title": "title1",
  "body": "body1",
  "related_blog": {
    "id": "id2"
  }
}


Example) When depth = 1

{
  "id": "id1",
  "title": "title1",
  "body": "body1",
  "related_blog": {
    "id": "id2",
    "title": "title2",
    "body": "body2",
    "related_blog": {
      "id": "id3"
    }
  }
}


Example) When depth = 2

{
  "id": "id1",
  "title": "title1",
  "body": "body1",
  "related_blog": {
    "id": "id2",
    "title": "title2",
    "body": "body2",
    "related_blog": {
      "id": "id3",
      "title": "title3",
      "body": "body3",
      "related_blog": {
        "id": "id4"
      }
    }
  }
}

richEditorFormat

Deprecated Rich Editor allows you to change the response format.

html (default)

If you specify html for richEditorFormat, you can retrieve it as HTML.
This is the default setting, and it will be applied even if no parameters are specified.

{
    "title": "Update Information",
    "content": "<h2 id=\"h5ca2740170\">Hello World</h2><p>You can now <strong>change</strong> the format of the rich editor.<br><br><img src=\"https://images.microcms-assets.io/assets/9f54a34e853e4bee98b47ce18c0713f1/c22bcc0296204e81889119c2ffa9a883/domenico-loia-hGV2TfOh0ns-unsplash.jpg\" alt=\"\"><br></p>",
}

object

object for richEditorFormat, you can retrieve it in object format.

informationInformation

richEditorFormat is not supported by the rich editor.

Response Body

Below is an example of a response.

{
  "id": "ywsd1lc_z",
  "createdAt": "2022-04-27T02:44:50.280Z",
  "updatedAt": "2022-04-27T02:44:50.280Z",
  "publishedAt": "2022-04-27T02:44:50.280Z",
  "revisedAt": "2022-04-27T02:44:50.280Z",
  "name": "Update Information"
}
informationInformation
informationInformation

Only some of the response headers are listed. Please note that there are additional items that may be included beyond those mentioned.

x-current-date-time

This is the server-side time value at the time of the response. The format is ISO 8601.

x-current-date-time: 2023-01-01T00:00:00.000Z

Error Response

Please refer to the Content API error response.