Menu
Create Field
Create Field in Collection
POST
/fields/{collection}Use it in a workflow
- Add a step and choose the Directus connector.
- Pick the Create Field action (under Fields).
- Fill in the fields below, then reference the result from later steps as
{{createField.response.data}}.
Request
Path parameters
Query parameters
Request body
Enter the body as JSON in the step's Body field.
{
"type": "integer",
"field": "id",
"schema": {
"type": "string",
"name": "title",
"table": "posts",
"default_value": null,
"max_length": null,
"is_nullable": false,
"is_primary_key": false,
"has_auto_increment": false,
"foreign_key_column": null,
"foreign_key_table": null,
"comment": null,
"schema": "public"
},
"meta": {
"id": 3,
"collection": "posts",
"field": "title",
"special": null,
"system-interface": "primary-key",
"options": null,
"display": null,
"display_options": null,
"locked": true,
"readonly": false,
"required": false,
"hidden": true
}
}
Response
Returns 200 with an object. Read it in later steps with {{createField.response.data.<field>}}.
{
"data": {
"id": 0,
"collection": "about_us",
"field": "id",
"special": [
"string"
],
"interface": "string",
"options": {},
"display": "string",
"display_options": "string",
"readonly": false,
"hidden": false,
"sort": 0,
"width": "string"
}
}
Need more? See the Directus guide for connection setup and behaviour shared by every action.
Was this page helpful?