# AuthZEN

Source: https://www.pontive.com/docs/api-reference/authz/authzen

Base URL: `https://authz.{region}.pontive.com` (operations that name another server say so).

Authentication: send `Authorization: Bearer <token>` with a secret key (`pontive_sk_…`, which implies its instance) or an access token issued for this API. A token that can reach several instances also names one with `X-Pontive-Instance-ID: inst_…`. Secret keys are for servers only.

## AuthZEN discovery

```http
GET https://authz.{region}.pontive.com/.well-known/authzen-configuration
```

The decision point's metadata (OpenID AuthZEN Authorization API 1.0, §9): its identifier and the endpoints it serves. Public.

Operation ID: `GetAuthZENConfiguration`

### Responses

- `200` OK: AuthZENConfiguration

## Evaluate access

```http
POST https://authz.{region}.pontive.com/access/v1/evaluation
```

AuthZEN Access Evaluation (OpenID AuthZEN Authorization API 1.0, §6): may the subject do the action on the resource. The subject is a user (usr_), a service account (svc_), an agent (agt_), or a token — an access token of this instance as subject.id: a token acting for a user through an agent is answered for the (user, agent) pair, within its organization and while its delegation is live, and the decision's context echoes the verified principal so the caller applies its own scope check. context.actor names an agent acting for a user subject: only what both may do is allowed. A token that does not verify is refused 400 invalid_token. Inherited roles are resolved through the resource graph. Needs sys:authz:check. A check on a custom resource type bills as one authorization check. Callers: a management credential asks about any subject; any other access token of the instance only about itself, subject {"type": "token"} or its own subject by id, and is refused 403 for any other (D24, D48).

Operation ID: `EvaluateAccess`

### Request body (`application/json`, required): AuthZENEvaluation

subject, action, resource, context

### Responses

- `200` OK: AuthZENDecision
- `400` invalid_token, actor_invalid, invalid_request: ErrResponse
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `500` Internal Server Error: ErrResponse

## Evaluate access, many questions

```http
POST https://authz.{region}.pontive.com/access/v1/evaluations
```

AuthZEN Access Evaluations (OpenID AuthZEN Authorization API 1.0, §7): up to 100 questions, answered in the order asked. The request's own subject, action, resource and context are the defaults each evaluation's own keys override; with no evaluations it is a single evaluation, answered as one. options.evaluations_semantic is execute_all (the default), deny_on_first_deny (stop at the first denial) or permit_on_first_permit (stop at the first permit): the answer then ends with the evaluation that stopped it. Subjects, tokens and context.actor are named as in an evaluation. Needs sys:authz:check. Each check on a custom resource type bills as one authorization check. Callers: a management credential asks about any subject; any other access token of the instance only about itself, subject {"type": "token"} or its own subject by id, and is refused 403 for any other (D24, D48).

Operation ID: `EvaluateAccessBatch`

### Request body (`application/json`, required): AuthZENEvaluationsRequest

defaults, evaluations and options

### Responses

- `200` OK: AuthZENEvaluationsResponse
- `400` invalid_token, actor_invalid, invalid_request: ErrResponse
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `500` Internal Server Error: ErrResponse

## Search actions

```http
POST https://authz.{region}.pontive.com/access/v1/search/action
```

AuthZEN Action Search (OpenID AuthZEN Authorization API 1.0, §8.6): the actions the subject may take on the resource. For a subject named by id or by an access token, identity-svc checks every permission of the resource's type on the object, as an evaluation is checked, and answers those held in key order; context.actions narrows the answer to the ones asked about, and context.actor names an agent acting for a user subject. For the caller itself — subject {"type": "token"} with no id — context.actions names the catalog permissions (sys:<resource>:<action>, at most 32) to ask about on the target instance (resource {"type": "root"}): what a client hides or disables by, never the decision. Needs sys:authz:check; the caller's own question needs nothing. Callers: a management credential asks about any subject; any other access token of the instance only about itself, subject {"type": "token"} or its own subject by id, and is refused 403 for any other (D24, D48).

Operation ID: `SearchActions`

### Request body (`application/json`, required): AuthZENSearchRequest

subject, resource, context

### Responses

- `200` OK: AuthZENActionSearchResponse
- `400` invalid_token, actor_invalid, invalid_request: ErrResponse
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `500` Internal Server Error: ErrResponse

## Search resources

```http
POST https://authz.{region}.pontive.com/access/v1/search/resource
```

AuthZEN Resource Search (OpenID AuthZEN Authorization API 1.0, §8.5): the resources of resource.type the subject may do action.name on, directly or by inheritance, each with its name, organization, parent and the roles held as properties. Subjects, tokens and context.actor are named as in an evaluation; a delegated subject lists what the (user, agent) pair both reach. context takes Pontive's filters: organization_id, parent_id, direct_only, include_ancestors. Pages by page.token and page.limit (1 to 100); page.next_token is "" on the last page. Needs sys:authz:check for a token or an actor; a subject alone needs what reading that principal does (sys:user:read, sys:sa:read or sys:agent:read). Bills as one authorization check. Callers: a management credential asks about any subject; any other access token of the instance only about itself, subject {"type": "token"} or its own subject by id, and is refused 403 for any other (D24, D48).

Operation ID: `SearchResources`

### Request body (`application/json`, required): AuthZENSearchRequest

subject, action, resource {type}, context, page

### Responses

- `200` OK: AuthZENResourceSearchResponse
- `400` invalid_token, delegated_permission_required, actor_invalid, invalid_request: ErrResponse
- `401` Unauthorized: ErrResponse
- `403` Forbidden: ErrResponse
- `404` The resource type does not exist: ErrResponse
- `500` Internal Server Error: ErrResponse

## Schemas

### AuthZENConfiguration

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `access_evaluation_endpoint` | string |  |  |
| `access_evaluations_endpoint` | string |  |  |
| `policy_decision_point` | string |  |  |
| `search_action_endpoint` | string |  |  |
| `search_resource_endpoint` | string |  |  |

### AuthZENEvaluation

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | AuthZENAction |  |  |
| `context` | Record<string, any> |  | Context carries Pontive's extras: actor, an agent (agt_) acting for the user subject, which can only narrow the decision. |
| `resource` | AuthZENResource |  |  |
| `subject` | AuthZENSubject |  |  |

### AuthZENDecision

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `context` | Record<string, any> |  | Context is, for a token subject, the verified principal (principal: sub, act, aud, scope, client_id, org_id), for the caller's own scope check. |
| `decision` | boolean |  |  |

### ErrResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | ErrBody |  |  |

### AuthZENEvaluationsRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | AuthZENAction |  |  |
| `context` | Record<string, any> |  | Context carries Pontive's extras: actor, an agent (agt_) acting for the user subject, which can only narrow the decision. |
| `evaluations` | AuthZENEvaluation[] |  |  |
| `options` | AuthZENOptions |  |  |
| `resource` | AuthZENResource |  |  |
| `subject` | AuthZENSubject |  |  |

### AuthZENEvaluationsResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `evaluations` | AuthZENDecision[] |  |  |

### AuthZENSearchRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | AuthZENAction |  |  |
| `context` | Record<string, any> |  | Context carries Pontive's extras: actor; for a resource search organization_id, parent_id, direct_only and include_ancestors; for an action search actions, the action names to ask about (required for the caller's own token, at most 32). |
| `page` | AuthZENPage |  |  |
| `resource` | AuthZENResource |  |  |
| `subject` | AuthZENSubject |  |  |

### AuthZENActionSearchResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `results` | AuthZENAction[] |  |  |

### AuthZENResourceSearchResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | AuthZENPageResult |  |  |
| `results` | AuthZENResource[] |  |  |

### AuthZENAction

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string |  |  |
| `properties` | Record<string, any> |  |  |

### AuthZENResource

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string |  |  |
| `properties` | Record<string, any> |  |  |
| `type` | string |  |  |

### AuthZENSubject

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string |  |  |
| `properties` | Record<string, any> |  | Properties are accepted and not read. |
| `type` | "user" \| "service_account" \| "agent" \| "token" |  | Type is user, service_account, agent, or token (an access token of this instance as the id). |

### ErrBody

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string |  | Code is the spec's machine-readable code for this error, in snake case: a domain code such as seat_limit_reached where the refusal has one, otherwise a generic one such as permission_denied, not_found, conflict, invalid_request or service_unavailable. |
| `details` | ErrDetail[] |  | Details are per-field findings, present only on a refusal that has them, e.g. a 422 invalid_theme names each invalid value by its path, a 422 package_invalid each problem, and a 409 capability_in_use each count by its name. |
| `doc_url` | string |  | DocURL links to documentation about this error, when available. |
| `message` | string |  | Message is a human-readable description of what went wrong. |
| `object` | string |  | Object is the discriminator; always "error". |
| `param` | string |  | Param names the request parameter this error refers to, when applicable. |
| `type` | "validation_error" \| "authentication_error" \| "authorization_error" \| "not_found" \| "conflict_error" \| "rate_limit_error" \| "internal_error" |  | Type is the error's category, set by its HTTP status: one of validation_error, authentication_error, authorization_error, not_found, conflict_error, rate_limit_error, internal_error. |

### AuthZENOptions

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `evaluations_semantic` | "execute_all" \| "deny_on_first_deny" \| "permit_on_first_permit" |  | EvaluationsSemantic is execute_all (the default), deny_on_first_deny or permit_on_first_permit. |

### AuthZENPage

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | integer |  |  |
| `properties` | Record<string, any> |  |  |
| `token` | string |  |  |

### AuthZENPageResult

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `count` | integer |  |  |
| `next_token` | string |  |  |
| `total` | integer |  |  |

### ErrDetail

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string |  | Field is where the finding is: for a theme, its dotted path. |
| `message` | string |  | Message is what is wrong there. |
