v1

latestOpenAPI 3.0.12026-07-1714724311.1 KB
Fields

Create Field in Collection

Create a new field in a given collection.

post/fields/{collection}

Path parameters

collectionstring required

Unique identifier of the collection the item resides in.

Request body

fieldstring required

Unique name of the field. Field name is unique within the collection.

typestring required

Directus specific data type. Used to cast values in the API.

Example request

{
  "field": "id",
  "type": "integer",
  "schema": {
    "name": "title",
    "table": "posts",
    "type": "string",
    "schema": "public"
  },
  "meta": {
    "id": 3,
    "collection": "posts",
    "field": "title",
    "system-interface": "primary-key",
    "locked": true,
    "hidden": true,
    "sort": 1
  }
}

Response

Successful request