Skip to main content
POST
Generate a business policy draft
Describe the rule in prompt — amounts, payment types, wallets, who approves — and the answer is a complete PAYMENT or SPEND_REVIEW policy in policy, built only from the condition catalog of that context and from the organization’s own active users, groups, wallets and custom fields. Every approver in the draft is checked against the organization before it is returned. Review the draft before you save it. unsupported lists what the request asked for that the draft does not express — a restriction the policy cannot express, a wallet or person that could not be found — so the policy may match more than you described: always show it to whoever saves the policy. To save the draft, send policy to the create endpoint without the name of each approver. Generation takes a few seconds and can take up to 30. To write the draft, the AI model receives the prompt and the organization’s users (names and e-mail addresses), groups, active wallets and custom fields. Only organization admins can generate policies.

Path Parameters

realmId
string<uuid>
required

ID of your realm.

Format: UUID

organizationId
string<uuid>
required

ID of the organization the policy is for.

Format: UUID

Body

application/json
context
enum<string>
required

Context of the policy to draft: PAYMENT or SPEND_REVIEW. TRAVEL is refused with POLICY_GENERATION_CONTEXT_UNSUPPORTED.

Available options:
PAYMENT,
SPEND_REVIEW,
TRAVEL
Example:

"PAYMENT"

prompt
string
required

The policy you want, in your own words — amounts, payment types, wallets and who approves. Portuguese works best.

Required string length: 3 - 2000
Example:

"Pagamentos via Pix acima de R$ 5.000 precisam da aprovação do grupo Financeiro."

includeWallets
boolean
deprecated

Deprecated and ignored: the organization's active wallets are always considered.

Response

Successful response

A drafted business policy, and what it could not express.

policy
object
required

The drafted policy. Send it to the create endpoint to save it, after removing the name of each approver.

unsupported
string[]
required

What the request asked for that the draft does NOT express, in Portuguese — a restriction no condition can capture, a wallet or person that could not be found, an older policy that would always match first. Empty when everything was captured. Always show these before the draft is saved: the policy is otherwise valid and may govern more than the request described.


Example: ["A restrição \"somente em dias úteis\" não pôde ser expressa."]