---
title: "Compile a PhiSQL policy."
method: POST
path: "/api/policies/compile"
tags: ["Policies"]
---

# Compile a PhiSQL policy.

`POST /api/policies/compile`

Compiles a policy authored in PhiSQL into the native Phileas policy format. The request body is PhiSQL source; the response carries the policy name and description and the compiled policy JSON, which can then be saved via POST /api/policies. Requires the `policies:read` scope.

## Headers

- `Authorization` string, required

## Response `200`

The policy compiled successfully.

- string

## Other responses

- `400` — The PhiSQL failed to parse/compile, or the compiled policy failed validation.
- `401` — The Authorization header is absent or the API key is not recognized.
- `413` — Content Too Large
- `415` — Unsupported Media Type
- `500` — Internal Server Error
- `503` — Service Unavailable

## Changes

- **2026-08-04** `ee79a60eea42` — 1 info
  - added the non-success response with the status `415`
- **2026-08-03** `e46672d44401` — 1 info
  - added the non-success response with the status `413`

[Change history](https://skmtc.dev/philterd/apis/philter-api/changes/api/policies/compile/post.md)

---

[API](https://skmtc.dev/philterd/apis/philter-api.md) · [All operations](https://skmtc.dev/philterd/apis/philter-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/philterd/philter-api/revisions/d90a12a66fa6/schema)
