Skip to main content
POST
/
v2
/
entity-types
Create Entity Type
curl --request POST \
  --url https://public.api.serval.com/v2/entity-types \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "teamId": "<string>",
  "key": "<string>",
  "name": "<string>",
  "fields": [
    {
      "key": "<string>",
      "name": "<string>",
      "dataType": "DATA_TYPE_UNSPECIFIED",
      "enumOptions": [
        {
          "value": "<string>",
          "displayName": "<string>",
          "displayOrder": 123
        }
      ],
      "isKeyField": true,
      "isNameField": true,
      "refEntityTypeId": "<string>"
    }
  ],
  "parentEntityTypeId": "<string>",
  "schemaKey": "<string>",
  "helpAgentVisibility": "HELP_AGENT_ENTITY_VISIBILITY_UNSPECIFIED"
}
'
{
  "data": {
    "id": "<string>",
    "teamId": "<string>",
    "key": "<string>",
    "name": "<string>",
    "parentEntityTypeId": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "createdByUserId": "<string>",
    "updatedByUserId": "<string>",
    "fields": [
      {
        "id": "<string>",
        "entityTypeId": "<string>",
        "key": "<string>",
        "name": "<string>",
        "dataType": "DATA_TYPE_UNSPECIFIED",
        "createdAt": "2023-11-07T05:31:56Z",
        "updatedAt": "2023-11-07T05:31:56Z",
        "createdByUserId": "<string>",
        "updatedByUserId": "<string>",
        "enumOptions": [
          {
            "id": "<string>",
            "value": "<string>",
            "displayName": "<string>",
            "displayOrder": 123
          }
        ],
        "isKeyField": true,
        "isNameField": true,
        "refEntityTypeId": "<string>",
        "description": "<string>",
        "sourceEntityTypeId": "<string>"
      }
    ],
    "color": "<string>",
    "iconSlug": "<string>",
    "entitySchemaId": "<string>",
    "helpAgentVisibility": "HELP_AGENT_ENTITY_VISIBILITY_UNSPECIFIED"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
teamId
string

The ID of the team.

key
string | null

The unique key for the entity type. If not provided, will be auto-generated from the name.

name
string

The display name of the entity type (required).

fields
EntityTypeFieldInput · object[]

The fields to create on the entity type.

parentEntityTypeId
string | null

Optional parent entity type ID for nesting under a parent type.

schemaKey
string | null

Optional schema key for placing the entity type in a non-default schema. When omitted, the entity type is created in the team's default schema. Use "reference-data" for entity types that represent external reference tables (e.g., ServiceNow reference tables) rather than user-facing assets.

helpAgentVisibility
enum<string> | null

Controls whether the help agent can see entities of this type. Defaults to REQUESTER_ASSOCIATED if not specified.

Available options:
HELP_AGENT_ENTITY_VISIBILITY_UNSPECIFIED,
HELP_AGENT_ENTITY_VISIBILITY_NONE,
HELP_AGENT_ENTITY_VISIBILITY_REQUESTER_ASSOCIATED,
HELP_AGENT_ENTITY_VISIBILITY_ALWAYS

Response

Success

data
data · object

The created entity type.