Operation CategoriesAdd a field to a category

Add a field to a category

A field's key and type are immutable after creation. A field with history can't be deleted, only archived; otherwise past values would be orphaned

curl -X POST "https://policy-engine-rest.ezig.workers.dev/api/v1/vaults/demo_vault/operation-categories/example_string/fields" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "key": "sale_rate",
  "label": "example_string",
  "type": "text",
  "required": true,
  "optionsJson": [
    {
      "value": "example_string",
      "label": "example_string"
    }
  ],
  "scale": 42,
  "currencyFieldKey": "ticker",
  "unit": "example_string",
  "defaultJson": "null",
  "helpText": "example_string",
  "sensitive": true,
  "orderIndex": 42
}'
{
  "id": "cmr3f41z20001psp7phmyapw3",
  "categoryId": "example_string",
  "key": "example_string",
  "label": "example_string",
  "type": "text",
  "required": true,
  "optionsJson": [
    {
      "value": "example_string",
      "label": "example_string"
    }
  ],
  "scale": 42,
  "currencyFieldKey": "example_string",
  "unit": "example_string",
  "defaultJson": "null",
  "helpText": "example_string",
  "sensitive": true,
  "orderIndex": 42,
  "archived": true,
  "createdAt": "2026-07-02T11:25:15.134000Z",
  "updatedAt": "2026-07-02T11:25:15.134000Z"
}
POST
/api/v1/vaults/{code}/operation-categories/{id}/fields
POST
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

Session token. Mobile/services. The web uses a cookie.

Session token. Mobile/services. The web uses a cookie.
API Key (cookie: session_token)
session_tokenstring
Required

API key (sent in cookie)

Content-Typestring
Required

The media type of the request body

Options: application/json
keystring
Required

Stable field slug (immutable)

Min length: 1 • Max length: 64 • Pattern: ^[a-z][a-z0-9_]*$
labelstring
Required
Min length: 1 • Max length: 200
typestring
Required
Options: text, number, select, date, datetime, boolean, url, currency
scaleinteger

number and currency only. Not set for currency → 2 (fiat)

Min: 0 • Max: 18
currencyFieldKeystring

currency only: the key of a field in this same category that holds the amount's currency (select or text). Declares the "amount ↔ its ticker" link: a report on the amount is automatically broken down by ticker, and a meaningless combined total across different currencies isn't returned. 400 CATEGORY_FIELD_LINK if the field doesn't exist or has the wrong type

unitstring
Max length: 16
helpTextstring
Max length: 500
orderIndexinteger
Min: -9007199254740991 • Max: 9007199254740991
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Session token. Mobile/services. The web uses a cookie.

path
parameterstring
Required

API Key for authentication. Provide your API key in the cookie.

Path Parameters

codestring
Required

Unique Vault code (slug)

Example:
demo_vault

Body

application/json
keystring
Required

Stable field slug (immutable)

Example:
sale_rate
typestring
Required
Allowed values:textnumberselectdatedatetimebooleanurlcurrency
optionsJsonarray

For select

scaleinteger

number and currency only. Not set for currency → 2 (fiat)

currencyFieldKeystring

currency only: the key of a field in this same category that holds the amount's currency (select or text). Declares the "amount ↔ its ticker" link: a report on the amount is automatically broken down by ticker, and a meaningless combined total across different currencies isn't returned. 400 CATEGORY_FIELD_LINK if the field doesn't exist or has the wrong type

Example:
ticker

Responses