API v2  (/api/v2)

If your custom type has 3 fields configured, as soon as content is populated and published for these 3 fields, the API will return data for the 3 fields:

data: {
field_1: [ … ]
field_2: [ … ]
field_3: [ … ]
}

Renaming fields is not supported. If you ever rename the API ID of a field in the JSON editor of a custom type, Prismic will interpret this as deleting the initial field and creating a new one. For instance, if you change "field_3" API ID to "field_3_renamed", in the Prismic UI (editor), you'll see a new field (with the same configuration as the "field_3" one), but the data will be empty, it won't be migrated from the old field.

If you do a publication after this, the API won't return the data for "field_3" as it has been treated as having been deleted from the model. You'll see a new field called "field_3_renamed" but this will be empty (or showing a default empty value depending of the type of the field):

data: {
field_1: [ … ]
field_2: [ … ]
field_3_renamed: null
}

However you can always recover data that was populated in a field that has been removed from the custom type. To achieve this:

  • Add the old field back to your Custom Type making sure to add the exact same field type and the exact same API ID that was previously used.
  • If you made a publication after removing the field from the custom type, the data won't be shown on the UI (the document editor) of the published document but you can find it back in the version history of the given document (just browse the history and "restore" and then publish the version that shows the data in the field you added back).
  • If you did not publish after removing the field, the data will be displayed on the latest published version of the document. Note that you might have to do a publication on your repo for the data to be available again in the API responses.

API v1 (/api)

Read: difference between API v1 & v2 https://user-guides.prismic.io/api-application-and-token-management/difference-between-api-v1-v2

Did this answer your question?