nodestash
Custom fields

Create a custom field definition

Creates a new custom field definition in the authenticated workspace. The `slug` is auto-generated from `name` when omitted. The combination of `entity_type` + `slug` must be unique within the workspace. For `select` and `multi_select` field types, `options` must be provided.

POST
/custom-fields
AuthorizationBearer <token>

API key from your nodestash dashboard. Pass as a Bearer token in the Authorization header.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.nodestash.io/v1/custom-fields" \  -H "Content-Type: application/json" \  -d '{    "entity_type": "contact",    "name": "Plan",    "field_type": "select",    "description": "Subscription plan of the contact",    "options": [      "free",      "starter",      "pro",      "enterprise"    ]  }'
{
  "data": {
    "id": "cf_5hJ3kM9pQrVwXyZaB2cD4",
    "type": "custom_field_definition",
    "attributes": {
      "id": "cf_5hJ3kM9pQrVwXyZaB2cD4",
      "entity_type": "contact",
      "name": "Plan",
      "slug": "plan",
      "field_type": "select",
      "description": "Subscription plan of the contact",
      "is_required": false,
      "options": [
        "free",
        "starter",
        "pro",
        "enterprise"
      ],
      "display_order": 0,
      "created_at": "2026-01-15T10:30:00Z",
      "updated_at": "2026-01-15T10:30:00Z"
    }
  },
  "meta": {
    "request_id": "req_7nR4tW8xKqMvPyZbC3dF5"
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Request validation failed",
    "details": [
      {
        "field": "email",
        "message": "Invalid email"
      }
    ]
  },
  "meta": {
    "request_id": "req_abc123def456"
  }
}
{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Missing or invalid Authorization header"
  },
  "meta": {
    "request_id": "req_abc123def456"
  }
}
{
  "error": {
    "code": "CONFLICT",
    "message": "A contact with email 'jane@acme.com' already exists in this workspace"
  },
  "meta": {
    "request_id": "req_abc123def456"
  }
}
{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Rate limit exceeded"
  },
  "meta": {
    "request_id": "req_abc123def456"
  }
}