Skip to main content
POST
/
core.v1.PoliciesService
/
CreateRegoCodeFromNaturalLanguage
cURL
curl -X POST "https://api.joinformal.com/core.v1.PoliciesService/CreateRegoCodeFromNaturalLanguage" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "example": "value"
  }'
{
  "code": "<string>",
  "name": "<string>",
  "description": "<string>",
  "valid": true,
  "validationError": "<string>"
}

Authorizations

X-API-KEY
string
header
required

API key authentication. Get your API key from the Formal console.

Body

application/json
naturalLanguagePrompt
string

Natural language description of the desired policy or permission. May include context such as existing code, validation errors, or org context composed by the caller.

Required string length: 1 - 10000
mode
enum<string>

"policy" (formal.v2) or "permission" (formal.app).

Available options:
policy,
permission
skipValidation
boolean

When true, skip OPA validation and retry loop. Defaults to false (validate).

Response

Success

code
string
name
string
description
string
valid
boolean
validationError
string