SnozeDevelopers
API referenceDatabases

Add a validation rule to a database

Creates a rule whose `condition` formula must evaluate true for a record to be valid: `block` severity refuses the write and surfaces `message`, while `warn` lets the write through and records the message. Requires the `databases:write` permission and rejects a condition that does not parse. Send an `Idempotency-Key` header to make retries safe; a replay within the window returns the original response.

POST
/v1/workspaces/{workspaceId}/databases/{databaseId}/validation-rules

Authorization

apiKey
headerAuthorizationBearer <snoze_sk_…>

Workspace API key created in Workspace settings → API keys. Scopes on the key bound what it can read and write.

Path Parameters

workspaceId*string
databaseId*string

Request Body

application/json
  1. body
id?|null
label*string
Length1 <= length <= 120
condition*string
Length1 <= length <= 10000
message*string
Length1 <= length <= 1000
severity?|null
fieldKey?string|null
order?number|null
clientMutationId?string|null

Response Body

Success

application/json
  1. response
data*
Example Request
curl -X POST 'https://api.snoze.dev/v1/workspaces/string/databases/string/validation-rules' \  -H 'Content-Type: application/json' \  -d '{  "label": "string",  "condition": "string",  "message": "string"}'
Example Response
{  "data": {    "id": "string",    "workspaceId": "string",    "databaseId": "string",    "label": "string",    "condition": "string",    "message": "string",    "severity": "block",    "fieldKey": "string",    "enabled": true,    "order": 0,    "createdAt": "string",    "updatedAt": "string"  }}