---
title: "Create Entity Type"
method: POST
path: "/v2/entity-types"
tags: ["Entity Type API"]
---

# Create Entity Type

`POST /v2/entity-types`

Create a new entity type with optional fields for a team.

## Request body

- SvstorePublicapiCreateEntityTypeRequest
  - `teamId` string — The ID of the team.
  - `key` string, nullable — 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` SvstoreEntityTypeFieldInput[] — The fields to create on the entity type.
    - `key` string, nullable — The unique key for the field within the entity type. If not provided, will be auto-generated from the name.
    - `name` string — The display name of the field (required).
    - `dataType` 'DATA_TYPE_UNSPECIFIED' | 'TEXT' | 'NUMBER' | 'BOOL' | 'TIMESTAMP' | 'ENUM' | 'ENTITY_REF' | 'USER_REF' | 'UNIQUE' | 'MULTI_SELECT' | 'FILE'
    - `enumOptions` SvstoreEnumOptionInput[] — Enum options (used when data_type is ENUM or MULTI_SELECT).
      - `value` string
      - `displayName` string
      - `displayOrder` integer
    - `isKeyField` boolean — Whether this field's value drives the entity's key (dedup identifier).
    - `isNameField` boolean — Whether this field's value drives the entity's display name.
    - `refEntityTypeId` string, nullable — For ENTITY_REF fields: the entity type ID that this field references.
  - `parentEntityTypeId` string, nullable — Optional parent entity type ID for nesting under a parent type.
  - `schemaKey` string, nullable — 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` 'HELP_AGENT_ENTITY_VISIBILITY_UNSPECIFIED' | 'HELP_AGENT_ENTITY_VISIBILITY_NONE' | 'HELP_AGENT_ENTITY_VISIBILITY_REQUESTER_ASSOCIATED' | 'HELP_AGENT_ENTITY_VISIBILITY_ALWAYS'
  - `isEdgeType` boolean, nullable — When true, marks the type as an edge/relationship type whose instances connect two other entities. The type must have exactly two single-valued ENTITY_REF fields in `fields` (the endpoints); direction labels are derived from those field names, so no extra edge config is needed.

## Response `200`

Success

- SvstorePublicapiCreateEntityTypeResponse
  - `data` SvstoreEntityTypeWithFields
    - `id` string
    - `teamId` string
    - `key` string
    - `name` string
    - `parentEntityTypeId` string, nullable
    - `createdAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
    - `updatedAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
    - `createdByUserId` string
    - `updatedByUserId` string
    - `fields` SvstoreEntityTypeField[]
      - `id` string
      - `entityTypeId` string
      - `key` string
      - `name` string
      - `dataType` 'DATA_TYPE_UNSPECIFIED' | 'TEXT' | 'NUMBER' | 'BOOL' | 'TIMESTAMP' | 'ENUM' | 'ENTITY_REF' | 'USER_REF' | 'UNIQUE' | 'MULTI_SELECT' | 'FILE'
      - `createdAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
      - `updatedAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
      - `createdByUserId` string
      - `updatedByUserId` string
      - `enumOptions` SvstoreEnumOption[]
        - `id` string
        - `value` string
        - `displayName` string
        - `displayOrder` integer
      - `isKeyField` boolean — Whether this field's value drives the entity's key (dedup identifier). Must be a UNIQUE data type field. At most one per entity type.
      - `isNameField` boolean — Whether this field's value drives the entity's display name.
      - `refEntityTypeId` string, nullable — For ENTITY_REF fields: the entity type ID that this field references.
      - `description` string, nullable
      - `sourceEntityTypeId` string, nullable — If set, this field is inherited from the specified entity type. Empty means the field is defined directly on this entity type.
      - `sectionId` string, nullable — Visual grouping for the entity detail UI. Unset means the field renders in the implicit "Overview" tab.
    - `color` string, nullable
    - `iconSlug` string
    - `entitySchemaId` string
    - `helpAgentVisibility` 'HELP_AGENT_ENTITY_VISIBILITY_UNSPECIFIED' | 'HELP_AGENT_ENTITY_VISIBILITY_NONE' | 'HELP_AGENT_ENTITY_VISIBILITY_REQUESTER_ASSOCIATED' | 'HELP_AGENT_ENTITY_VISIBILITY_ALWAYS'
    - `sections` SvstoreEntityFieldSection[] — Visual groupings (tabs) for this type's field bindings. Each binding's section_id references one of these. Bindings whose section_id is unset render in the implicit "Overview" tab. Includes both own sections and mirrored sections inherited from ancestors.
      - `id` string
      - `entityTypeId` string
      - `name` string
      - `sourceEntityTypeId` string, nullable — If set, this section is mirrored from the specified ancestor type. Empty means the section is defined directly on this entity type.
      - `createdAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
      - `updatedAt` string, date-time — A timestamp in RFC 3339 format (e.g., "2025-01-15T01:30:15Z").
      - `createdByUserId` string
      - `updatedByUserId` string
    - `isEdgeType` boolean — When true, this type's instances represent a relationship/edge between two other entities (mirrors EntityType.is_edge_type).
    - `description` string, nullable — What records of this type represent (mirrors EntityType.description).

## Other responses

- `default` — Error

---

[API](https://skmtc.net/serval/apis/serval-public-api.md) · [All operations](https://skmtc.net/serval/apis/serval-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/serval/serval-public-api/versions/0549515e9384/schema)
