This section applies to services (API keys) created by October 22, 2021. Those who created services after that date do not need to perform any migration work.
This article explains how to migrate from legacy API Keys (X-API-KEY, X-WRITE-API-KEY, and X-DRAFT-API-KEY) to X-MICROCMS-API-KEY.
For more information about X-MICROCMS-API-KEY, see this page.
Previously, requests had to be made using headers such as X-API-KEY.
// Retrieve regular content
$ curl "https://<subdomain>.microcms.io/api/v1/<endpoint>" \
-H "X-API-KEY: <旧APIキー>"
// Retrieve draft content
$ curl "https://<subdomain>.microcms.io/api/v1/<endpoint>" \
-H "X-API-KEY: <旧APIキー>" \
-H "X-GLOBAL-DRAFT-KEY: <旧APIキー>"
// Write content
$ curl -X POST "https://<subdomain>.microcms.io/api/v1/<endpoint>" \
-H "X-WRITE-API-KEY: <旧APIキー>"Following the specification change, API Keys have been consolidated into the X-MICROCMS-API-KEY header. You can manage permissions for retrieving drafts and writing content by configuring API Keys in the Administration console, allowing you to standardize the request headers.
After migration, specify the API Key as follows:
$ curl "https://<subdomain>.microcms.io/api/v1/<endpoint>" \
-H "X-MICROCMS-API-KEY: <旧APIキー>"If you are using an SDK, update it to the latest version and specify the API Key as described in the README.
If you created X-API-KEY, X-WRITE-API-KEY, and X-DRAFT-API-KEY as legacy API Keys, three corresponding X-MICROCMS-API-KEYs have been generated.
The default permissions for each legacy API Key are as follows:
Currently, it is still possible to use the old headers such as X-API-KEY. However, we are considering phasing them out in the future, so please proceed with the migration as soon as possible.