Create a model
A model is a kind of content, such as articles or products. Create one to get its own list, editor and API address.
Before you start
- You need the Administrator role. Other users see the error Only administrators can change models.
Create the model
- Go to Models in the side list.
- Select the plus button (New model) next to Models. Morphic opens the New model page.
- In Name, enter a name in singular or plural form, for example
Articles. Morphic fills in API name from it:article. - In API name, check the value. Use lowercase letters, digits and underscores, and start with a letter. The help text ends with "Cannot change later."
Warning: Morphic refuses an API name that a model already uses. It shows "There is already a model called" followed by the name. Choose a new API name before you save.
- In Id prefix, enter three lowercase letters, for example
art. Every entry id starts with this prefix. Each prefix can be used by one model only. - Optional: In Description, enter what editors put in this model.
- Select Create model.
Result: Morphic shows the toast "Model created. Now add fields." and opens the model. Then add fields with Add and configure fields.
Name and address rules
- API name uses lowercase letters, digits and underscores, starts with a letter, and has up to 64 characters. You cannot change it later.
- Id prefix is exactly three lowercase letters. You cannot change it later.
- The model's entries are served at
/wp-json/morphic/v1/items/<API name>, for example/wp-json/morphic/v1/items/article. Access settings decide who can read them. - If the API name breaks the rule, for example
1Bad-Name, Morphic shows "Type names are lowercase snake, up to 64 characters".
Create a component
Components are field groups that you reuse inside models.
- Select New component on the Models page.
- In Name, enter a name for the component.
- Optional: In Description, enter what the component contains.
- Select Create component.
Result: Morphic shows the toast "Component created. Now add fields."
Key-value namespaces
Key-value namespaces are not available in Morphic free. The side list shows Available in Pro under Key-value.