# documentId should be used instead of id in API calls

> Source: https://docs.strapi.io/cms/migration/v4-to-v5/breaking-changes/use-document-id

In Strapi 5, the `documentId` field replaces `id` for identifying documents in Content API calls (REST API and GraphQL) as part of the Document Service API transition.

In Strapi 5, the underlying API handling content is the [Document Service API](/cms/api/document-service) and documents should be called by their `documentId` in Content API calls (REST API & GraphQL).

This page is part of the [breaking changes database](/cms/migration/v4-to-v5/breaking-changes) and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

- Is this breaking change affecting plugins? Yes
- Is this breaking change automatically handled by a codemod? Partly
  - Codemod: [entity-service-document-service](https://github.com/strapi/strapi/blob/develop/packages/utils/upgrade/resources/codemods/5.0.0/entity-service-document-service.code.ts)

## Breaking change description

**In Strapi v4**

Entries were identified by their `id`:

```json {4}
{
  "data": {
    // system fields
    "id": 14,
    "attributes": {
      // user fields
      "title": "Article A"
      "relation": {
        "data": {
          "id": 15
          "name": "Category A"
        }
      }
    }
  }
  "meta": {
    // …
  }
}
```

**In Strapi 5**

Documents are identified by their `documentId`:

```json {4}
{
  "data": {
    // system fields
    "documentId": "a1b2c3d4e5f6g7h8i9j0klmn",
    "locale": "en",
    // user fields
    "title": "Article A"
    "relation": {
      // system fields
      "documentId": "j9k8l7m6n5o4p3q2r1s0tuvw"
      // user fields
      "name": "Category A"
    }
  }
  "meta": {
    // …
  }
}
```

## Migration

This section regroups useful notes and procedures about the introduced breaking change.

### Notes

- This breaking change impacts routes and relations.
- To ease the transition from v4 to Strapi 5, API calls to entries might still include an `id` field in their response, especially with the [Document Service API](/cms/api/document-service). But it's recommended that you start making an habit of using `documentId` instead of `id` as it will ease handling the transition to future Strapi versions.

### Migration procedure 

A codemod will partly handle the change, but might probably add `__TODO__` items to your code since it's impossible for the codemod to automatically guess the new `documentId` of your content.

For additional information, please refer to the following resources:

- related [breaking change entry for Entity Service API deprecation](/cms/migration/v4-to-v5/breaking-changes/entity-service-deprecated),
- [step-by-step guide](/cms/migration/v4-to-v5/step-by-step) to upgrade to Strapi 5,
- and dedicated migration guide for the [Entity Service API to Document Service API transition](/cms/migration/v4-to-v5/additional-resources/from-entity-service-to-document-service) if your custom code is affected by these changes.
