---
title: "Create a custom field"
method: POST
path: "/v1/custom-fields"
tags: ["Custom Fields"]
---

# Create a custom field

`POST /v1/custom-fields`

## Request

- Base URL: `https://api.samva.dev`
- URL: `https://api.samva.dev/v1/custom-fields`
- Auth: API key in header `x-api-key`

Creates a new custom field definition and returns it with a 201 status; the field key must be unique, and an organization defines at most 100.

## Request body

- object
  - `key` string, required
  - `label` string, required
  - `type` 'text' | 'number' | 'boolean' | 'date' | 'select', required
  - `options` string[], nullable
  - `defaultValue` string, nullable
  - `isRequired` boolean, nullable
  - `sortOrder` integer, nullable

## Response `201`

Success

- object
  - `id` string, required
  - `organizationId` string, required
  - `key` string, required
  - `label` string, required
  - `type` 'text' | 'number' | 'boolean' | 'date' | 'select', required
  - `options` string[], nullable, required
  - `defaultValue` string, nullable, required
  - `isRequired` boolean, required
  - `sortOrder` integer, required
  - `createdAt` string, required
  - `updatedAt` string, required

## Other responses

- `401`: UnauthorizedError
- `403`: ForbiddenError
- `409`: ConflictError
- `422`: ValidationError
- `500`: InternalError
- `504`: GatewayTimeoutError

---

[API](https://skmtc.dev/samva/apis/samva-api.md) · [All operations](https://skmtc.dev/samva/apis/samva-api/llms.txt) · [OpenAPI document](https://skmtc.dev/samva/apis/samva-api/revisions/a99408542cc3?raw)
