OriginChainDB
Database endpoints

Set a row policy

Creates or replaces the row-level security policy that limits which rows of a table a role can read.

POST /v1/tenants/{tenant}/db/rls

Store a role's filter for readable rowsHere, select and all policies apply to reads.
  1. Choose the role and tableIdentify whose rows should be restricted.
  2. Define the row predicateSupply the using expression and command.
  3. Confirm the stored policyCheck effective policy selection for the intended user.

Before you start

Use your database bearer token.

Connection setup

Use an identity authorized to manage access. Create the role and table first; the new policy replaces their existing policy.

Path parameters

FieldTypeRequired
tenantstringRequired

Headers

FieldTypeRequiredDescription
x-oc-db-userstringOptionalActing database user (role, grant and row-policy checks). Send with x-oc-db-key.
x-oc-db-keystringOptionalAPI key of the x-oc-db-user user.

Request body

application/json

Limits and accepted values
  • using is a predicate such as "owner = CURRENT_USER AND region IN ('us','eu')" and is validated at create time (invalid = 400).
  • command defaults to select and is stored lower-cased;
  • it is not validated, and only select and all policies are applied to reads.
  • One policy per (table, role);
  • a new one replaces the old.
FieldTypeRequired
commandstringOptional
rolestringRequired
tablestringRequired
usingstringRequired

Read the result

ok: true confirms the stored policy. using is the row predicate. Only select and all policies apply to reads here; a stored command name is not proof that other operation types are enforced.

Response statuses

HTTP status reference
StatusWhat to do
200OK
400Correct the request before retrying.
401Check the credential and Authorization header.
402Check feature access or available credits.
403Check tenant access, roles and permissions.
409Resolve the conflict before retrying.
413Split or reduce the request body.
415Send the required Content-Type.
422Correct the values or unsupported combination.
429Honor Retry-After when present; back off.
500Check the outcome before retrying a write.
501Check deployment support for this operation.
503Honor Retry-After when present; check write outcomes.
ยฉ 2026 Silicoyn Technologies Pvt Ltd