Skip to Content

Create a custom field

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.

POST
/v1/custom-fields

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.

Authorization

apiKey
headerx-api-key<token>

Request Body

application/json
  1. body
key*string
label*string
type*string
Value in"text""number""boolean""date""select"
options?array<string>|null
defaultValue?string|null|null
isRequired?boolean|null
sortOrder?|null

Response Body

Success

application/json
  1. response
id*CustomFieldDefinitionId
Match^cfield_[0-9a-hjkmnp-tv-z]{16,24}$
organizationId*OrganizationId
Match^org_[0-9a-hjkmnp-tv-z]{16,24}$
key*string
label*string
type*string
Value in"text""number""boolean""date""select"
options*array<string>|null
defaultValue*string|null
isRequired*boolean
sortOrder*integer
Range0 <= value <= 9007199254740991
createdAt*string
updatedAt*string
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.customFields.create({
  "key": "example",
  "label": "example",
  "type": "text"
});
Example Response
{
  "id": "string",
  "organizationId": "string",
  "key": "string",
  "label": "string",
  "type": "text",
  "options": [
    "string"
  ],
  "defaultValue": "string",
  "isRequired": true,
  "sortOrder": 0,
  "createdAt": "string",
  "updatedAt": "string"
}

Related documentation