Skip to content
Dashboard
Theme
Theme

Create policy

POST /v1/policies: Create policy.

View Markdown

POST /v1/policies

Scope
policies:write
Auth
Secret key (sk_…)
Since
1.0
  • OhAuthCat-Version string

    Minor version; defaults to the environment’s pin.

  • organization string

  • kind string Required

    one of force_sso, session, idp_initiated, jit, expression, guest_sso

  • config PolicyConfig Required

  • exclusions array of string

Errors share one shape; see the error code catalogue.

curl -X POST \
"https://api.ohauthcat.com/v1/policies" \
-H "Authorization: Bearer $OHAUTHCAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "force_sso",
"config": {
"domains": [
"acme.com"
],
"max_age_seconds": 60,
"allow": true,
"verified_domain_email": true,
"idp_groups": [
"Engineering"
],
"scim_groups": [
"dgrp_01J9Z3K5V7W8X9Y0Z1A2B3C4D5"
],
"rules": [
{
"action": "allow",
"expr": {
"kind": "leaf",
"attribute": "email",
"operator": "equals",
"values": [],
"children": []
}
}
]
}
}'
Response 201
{
"id": "pol_01J9ZQ4M7K2X8V3N5B6C1D0E9F",
"object": "policy",
"organization": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"kind": "default",
"config": {
"domains": [
"acme.com"
],
"max_age_seconds": 60,
"allow": true,
"verified_domain_email": true,
"idp_groups": [
"Engineering"
],
"scim_groups": [
"dgrp_01J9Z3K5V7W8X9Y0Z1A2B3C4D5"
],
"rules": [
{
"action": "allow",
"expr": {
"kind": "leaf",
"attribute": "email",
"operator": "equals",
"values": [],
"children": []
}
}
]
},
"exclusions": [
"example_exclusion"
],
"created_at": "2026-01-15T09:30:00Z",
"updated_at": "2026-01-15T09:30:00Z"
}