---
title: "Compile"
method: POST
path: "/api/v2/authz/compile"
tags: ["Authorizer"]
---

# Compile

`POST /api/v2/authz/compile`

## Request

- The document declares no server URL.
- Auth: API key in header `authorization` and API key in header `aserto-tenant-id`
- TypeScript: <https://skmtc.dev/aserto/apis/aserto-authorizer-v2-authorizer-proto/docs/api/v2/authz/compile/post.ts> (a function with typed inputs; its response is checked against the schema)

Executes a partial query on the loaded policy runtime.

## Request body

- V2CompileRequest
  - `disable_inlining` string[]
  - `identity_context` ApiIdentityContext
    - `identity` string
    - `type` 'IDENTITY_TYPE_UNKNOWN' | 'IDENTITY_TYPE_NONE' | 'IDENTITY_TYPE_SUB' | 'IDENTITY_TYPE_JWT' | 'IDENTITY_TYPE_MANUAL': Identity types, describes the payload type of the identity field inside the IdentityContext message. - IDENTITY_TYPE_UNKNOWN: Unknown, value not set, requests will fail with identity type not set error. - IDENTITY_TYPE_NONE: None, no explicit identity context set, equals anonymous. - IDENTITY_TYPE_SUB: Sub(ject), identity field contains an oAUTH subject. - IDENTITY_TYPE_JWT: JWT, identity field contains a JWT access token. - IDENTITY_TYPE_MANUAL: Manual, propagates thw identity field as-is, without validation, into the input object.
  - `input` string
  - `options` V2QueryOptions
    - `instrument` boolean
    - `metrics` boolean
    - `trace` 'TRACE_LEVEL_UNKNOWN' | 'TRACE_LEVEL_OFF' | 'TRACE_LEVEL_FULL' | 'TRACE_LEVEL_NOTES' | 'TRACE_LEVEL_FAILS'
    - `trace_summary` boolean
  - `policy_context` ApiPolicyContext
    - `decisions` string[]
    - `path` string
  - `policy_instance` ApiPolicyInstance
    - `instance_label` string
    - `name` string
  - `query` string
  - `resource_context` object
  - `unknowns` string[]

## Response `200`

A successful response.

- V2CompileResponse
  - `metrics` object
  - `result` object
  - `trace` object[]
  - `trace_summary` string[]

## Other responses

- `default`: An unexpected error response.

## Changes

- **2023-03-01** `3f1fb0547ca2`: 2 info
  - the endpoint scheme security `AuthorizerAPIKey AND TenantID` was added to the API
  - the endpoint scheme security `AuthorizerAPIKey` was removed from the API
- **2023-02-22** `c8bce422c925`: 2 info
  - api tag `Authorizer` added
  - api tag `authorizer` removed

[Operation history](https://skmtc.dev/aserto/apis/aserto-authorizer-v2-authorizer-proto/changes/api/v2/authz/compile/post.md)

---

[API](https://skmtc.dev/aserto/apis/aserto-authorizer-v2-authorizer-proto.md) - [All operations](https://skmtc.dev/aserto/apis/aserto-authorizer-v2-authorizer-proto/llms.txt) - [OpenAPI document](https://skmtc.dev/aserto/apis/aserto-authorizer-v2-authorizer-proto/revisions/bbe9be3b1f57?raw)
