UID Field Reference

This article explains what the UID field is and how to configure it in the Custom Type builder.


The UID field is a unique identifier used to create SEO-friendly website URLs. These are the characteristics of the UID field:

  • The value is unique to the Custom Type and locale.
  • It is space-free and written in lowercase, such as about-us. Spaces are replaced with dashes.
  • It can't contain special characters (except hyphens and underscores).
  • The Prismic development kits provide special helper functions for querying by UID.
  • When a UID is changed, the old value is permanently saved, so documents can always be queries by old UIDs. (This prevents links on your website from breaking.)
Screenshot of the UID field in the drag-and-drop editor.

Edit UIDs

To learn more about how to create and edit UIDs, see Edit a Document's Unique Identifier.

The visual builder

The UID field has two options: name and placeholder.

Slice Machine vs. Legacy Editor

Editing fields is almost identical in Slice Machine and the Legacy editor. But it is important to know that the mock config option (to add data to preview content fields in the Slice Simulator) is only available in Slice Machine.

Screenshot of the UID editor in the Custom Type Builder.

JSON model

The following table displays the JSON keys and values of the field’s 'API response.

Edit the JSON model with caution

Only edit the JSON model to make changes to the Rich Text field labels. Making abrupt changes can cause conflicts when synchronizing changes with your documents.

type

string (required)

Must be UID

config

object

Object for the configuration options

config.label

string

The label that shows up for the field in the entry editor

config.placeholder

string

A user-friendly placeholder for the field in the entry editor

Example JSON configuration

The following JSON defines a UID field with label and placeholder:

Copy
"uid":{
  "type":"UID",
  "config":{
    "label":"Unique ID",
    "placeholder":"Enter a meaningful unique identifier..."
  }
}

API response example

Here is an API response example of a UID field:

Copy
// API response example of a UID field

{
 //...
 "uid": "unique-value"
}

Was this article helpful?
Not really
Yes, Thanks

Can't find what you're looking for? Spot an error in the documentation? Get in touch with us on our Community Forum or using the feedback form above.