Api

Create Custom Unit

POST
/v1/custom-units

Creates a custom unit. The key is what your product maps; it is fixed once a rule uses the unit.

Authorization

WorkspaceApiKey
X-Api-Key<token>

Workspace-owned Better Auth API key of one environment (Sandbox or Live); it authorizes the Projects of that environment in its Workspace. A Project of the other environment returns 403 ENVIRONMENT_MISMATCH. Never expose it in the browser.

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

application/json

curl -X POST "https://example.com/v1/custom-units" \  -H "Content-Type: application/json" \  -d '{    "projectId": "string",    "key": "string",    "name": "string"  }'
{  "id": "string",  "key": "string",  "name": "string",  "namePlural": "string",  "archived": true,  "createdAt": "string",  "updatedAt": "string",  "success": true}