Styra Compile API

The Compile API from Styra — 1 operation(s) for compile.

Operations 1

POST /v1/compile/{path} Partially evaluate a query #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/styra-compile-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

styra-compile-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Enterprise OPA REST Batch Compile API
  version: 0.2.0
  contact:
    name: Styra
    url: https://github.com/StyraInc/enterprise-opa
servers:
- url: http://localhost:8181
  description: Local development server
security:
- {}
- bearerAuth: []
tags:
- name: Compile
paths:
  /v1/compile/{path}:
    post:
      parameters:
      - $ref: '#/components/parameters/policyPath'
      - $ref: '#/components/parameters/GzipAcceptEncoding'
      - $ref: '#/components/parameters/GzipContentEncoding'
      - $ref: '#/components/parameters/pretty'
      - $ref: '#/components/parameters/explain'
      - $ref: '#/components/parameters/metrics'
      - $ref: '#/components/parameters/instrument'
      summary: Partially evaluate a query
      operationId: compileQueryWithPartialEvaluation
      x-speakeasy-usage-example: false
      requestBody:
        description: The query, input, and other settings for partial evaluation.
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - query
              properties:
                options:
                  $ref: '#/components/schemas/CompileOptions'
                unknowns:
                  $ref: '#/components/schemas/CompileUnknowns'
                input:
                  $ref: '#/components/schemas/input'
                  description: The input document to use during partial evaluation.
          application/vnd.styra.multitarget+json:
            schema:
              type: object
              properties:
                options:
                  $ref: '#/components/schemas/CompileOptions'
                unknowns:
                  $ref: '#/components/schemas/CompileUnknowns'
                input:
                  $ref: '#/components/schemas/input'
                  description: The input document to use during partial evaluation.
          application/vnd.styra.ucast.all+json:
            schema:
              type: object
              properties:
                options:
                  $ref: '#/components/schemas/CompileOptions'
                unknowns:
                  $ref: '#/components/schemas/CompileUnknowns'
                input:
                  $ref: '#/components/schemas/input'
                  description: The input document to use during partial evaluation.
          application/vnd.styra.ucast.minimal+json:
            schema:
              type: object
              properties:
                options:
                  $ref: '#/components/schemas/CompileOptions'
                unknowns:
                  $ref: '#/components/schemas/CompileUnknowns'
                input:
                  $ref: '#/components/schemas/input'
                  description: The input document to use during partial evaluation.
          application/vnd.styra.ucast.linq+json:
            schema:
              type: object
              properties:
                options:
                  $ref: '#/components/schemas/CompileOptions'
                unknowns:
                  $ref: '#/components/schemas/CompileUnknowns'
                input:
                  $ref: '#/components/schemas/input'
                  description: The input document to use during partial evaluation.
          application/vnd.styra.ucast.prisma+json:
            schema:
              type: object
              properties:
                options:
                  $ref: '#/components/schemas/CompileOptions'
                unknowns:
                  $ref: '#/components/schemas/CompileUnknowns'
                input:
                  $ref: '#/components/schemas/input'
                  description: The input document to use during partial evaluation.
          application/vnd.styra.sql.sqlserver+json:
            schema:
              type: object
              properties:
                options:
                  $ref: '#/components/schemas/CompileOptions'
                unknowns:
                  $ref: '#/components/schemas/CompileUnknowns'
                input:
                  $ref: '#/components/schemas/input'
                  description: The input document to use during partial evaluation.
          application/vnd.styra.sql.mysql+json:
            schema:
              type: object
              properties:
                options:
                  $ref: '#/components/schemas/CompileOptions'
                unknowns:
                  $ref: '#/components/schemas/CompileUnknowns'
                input:
                  $ref: '#/components/schemas/input'
                  description: The input document to use during partial evaluation.
          application/vnd.styra.sql.postgresql+json:
            schema:
              type: object
              properties:
                options:
                  $ref: '#/components/schemas/CompileOptions'
                unknowns:
                  $ref: '#/components/schemas/CompileUnknowns'
                input:
                  $ref: '#/components/schemas/input'
                  description: The input document to use during partial evaluation.
          application/vnd.styra.sql.sqlite+json:
            schema:
              type: object
              properties:
                options:
                  $ref: '#/components/schemas/CompileOptions'
                unknowns:
                  $ref: '#/components/schemas/CompileUnknowns'
                input:
                  $ref: '#/components/schemas/input'
                  description: The input document to use during partial evaluation.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompileResultJSON'
            application/vnd.styra.multitarget+json:
              schema:
                $ref: '#/components/schemas/CompileResultMultitarget'
            application/vnd.styra.ucast.all+json:
              schema:
                $ref: '#/components/schemas/CompileResultUCAST'
            application/vnd.styra.ucast.minimal+json:
              schema:
                $ref: '#/components/schemas/CompileResultUCAST'
            application/vnd.styra.ucast.linq+json:
              schema:
                $ref: '#/components/schemas/CompileResultUCAST'
            application/vnd.styra.ucast.prisma+json:
              schema:
                $ref: '#/components/schemas/CompileResultUCAST'
            application/vnd.styra.sql.sqlserver+json:
              schema:
                $ref: '#/components/schemas/CompileResultSQL'
            application/vnd.styra.sql.mysql+json:
              schema:
                $ref: '#/components/schemas/CompileResultSQL'
            application/vnd.styra.sql.postgresql+json:
              schema:
                $ref: '#/components/schemas/CompileResultSQL'
            application/vnd.styra.sql.sqlite+json:
              schema:
                $ref: '#/components/schemas/CompileResultSQL'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/ServerError'
      tags:
      - Compile
components:
  parameters:
    metrics:
      name: metrics
      description: Return query performance metrics in addition to result.
      in: query
      schema:
        type: boolean
    GzipAcceptEncoding:
      name: Accept-Encoding
      description: Indicates the server should respond with a gzip encoded body. The server will send the compressed response only if its length is above `server.encoding.gzip.min_length` value. See the configuration section
      in: header
      schema:
        type: string
        enum:
        - gzip
    instrument:
      name: instrument
      description: Instrument query evaluation and return a superset of performance metrics in addition to result.
      in: query
      schema:
        type: boolean
    policyPath:
      name: path
      in: path
      description: The path separator is used to access values inside object and array documents. If the path indexes into an array, the server will attempt to convert the array index to an integer. If the path element cannot be converted to an integer, the server will respond with 404.
      required: true
      schema:
        type: string
        default: ''
        format: urlPath
        example: app/rbac
    explain:
      name: explain
      description: Return query explanation in addition to result.
      in: query
      schema:
        type: string
        enum:
        - notes
        - fails
        - full
        - debug
    pretty:
      name: pretty
      description: If parameter is `true`, response will formatted for humans.
      in: query
      schema:
        type: boolean
    GzipContentEncoding:
      name: Content-Encoding
      description: Indicates that the request body is gzip encoded
      in: header
      schema:
        type: string
        enum:
        - gzip
  schemas:
    CompileOptions:
      type: object
      description: Additional options to use during partial evaluation. Only the disableInlining option is currently supported in OPA. Enterprise OPA may support additional options.
      additionalProperties: true
      properties:
        disableInlining:
          type: array
          description: A list of paths to exclude from partial evaluation inlining.
          items:
            type: string
        targetDialects:
          type: array
          description: The output targets for partial evaluation. Different targets will have different constraints.
          items:
            type: string
            enum:
            - ucast+all
            - ucast+minimal
            - ucast+prisma
            - ucast+linq
            - sql+sqlserver
            - sql+mysql
            - sql+postgresql
            - sql+sqlite
        targetSQLTableMappings:
          type: object
          properties:
            sqlserver:
              type: object
              additionalProperties: true
            mysql:
              type: object
              additionalProperties: true
            postgresql:
              type: object
              additionalProperties: true
            sqlite:
              type: object
              additionalProperties: true
        maskRule:
          type: string
          description: The Rego rule to evaluate for generating column masks.
    CompileResultSQL:
      type: object
      description: The partially evaluated result of the query, in SQL format. Result will be empty if the query is never true.
      properties:
        result:
          type: object
          description: The partially evaluated result of the query as SQL.
          additionalProperties: true
          properties:
            query:
              type: string
              description: String representing the SQL equivalent of the conditions under which the query is true.
            masks:
              type: object
              description: Column masking functions, where the key is the column name, and the value describes which masking function to use.
              additionalProperties:
                $ref: '#/components/schemas/MaskingRule'
    ClientError:
      type: object
      required:
      - code
      - message
      properties:
        code:
          type: string
        message:
          type: string
        errors:
          type: array
          items:
            type: object
            required:
            - code
            - message
            properties:
              code:
                type: string
              message:
                type: string
              location:
                type: object
                required:
                - file
                - row
                - col
                properties:
                  file:
                    type: string
                  row:
                    type: integer
                  col:
                    type: integer
    CompileResultJSON:
      type: object
      description: The partially evaluated result of the query. Result will be empty if the query is never true.
      properties:
        result:
          type: object
          description: The partially evaluated result of the query.
          additionalProperties: true
          properties:
            query:
              type: object
            support:
              type: object
    input:
      description: Arbitrary JSON used within your policies by accessing `input`
      oneOf:
      - type: boolean
      - type: string
      - type: number
      - type: array
        items: {}
      - type: object
        additionalProperties: true
        example:
          user: alice
          action: read
          object: id123
          type: dog
    CompileUnknowns:
      type: array
      description: The terms to treat as unknown during partial evaluation.
      items:
        type: string
      default:
      - input
    MaskingRule:
      type: object
      additionalProperties:
        oneOf:
        - properties:
            replace:
              oneOf:
              - type: boolean
              - type: string
              - type: number
              - type: array
                items: {}
              - type: object
                additionalProperties: true
    ServerError:
      type: object
      required:
      - code
      - message
      properties:
        code:
          type: string
        message:
          type: string
        errors:
          type: array
          items:
            type: object
            required:
            - code
            - message
            properties:
              code:
                type: string
              message:
                type: string
              location:
                type: object
                required:
                - file
                - row
                - col
                properties:
                  file:
                    type: string
                  row:
                    type: integer
                  col:
                    type: integer
        decision_id:
          type: string
          example: b84cf736-213c-4932-a8e4-bb5c648f1b4d
    CompileResultUCAST:
      type: object
      description: The partially evaluated result of the query, in UCAST format. Result will be empty if the query is never true.
      properties:
        result:
          type: object
          description: The partially evaluated result of the query as UCAST.
          additionalProperties: true
          properties:
            query:
              type: object
              description: UCAST JSON object describing the conditions under which the query is true.
              additionalProperties: true
            masks:
              type: object
              description: Column masking rules, where the key is the column name, and the value describes which masking function to use.
              additionalProperties:
                $ref: '#/components/schemas/MaskingRule'
    CompileResultMultitarget:
      type: object
      description: The partially evaluated result of the query, for each target dialect. Result will be empty if the query is never true.
      properties:
        result:
          type: object
          description: The partially evaluated result of the query in each target dialect.
          additionalProperties: true
          properties:
            targets:
              type: object
              properties:
                ucast:
                  type: object
                  properties:
                    query:
                      type: object
                      description: UCAST JSON object describing the conditions under which the query is true.
                    masks:
                      type: object
                      description: Column masking rules, where the first two nested keys represent the entity name and the property name, and the value describes which masking function to use.
                      additionalProperties:
                        $ref: '#/components/schemas/MaskingRule'
                sqlserver:
                  type: object
                  properties:
                    query:
                      type: string
                      description: String representing the SQL equivalent of the conditions under which the query is true.
                    masks:
                      type: object
                      description: Column masking rules, where the first two nested keys represent the table name and the column name, and the value describes which masking function to use.
                      additionalProperties:
                        $ref: '#/components/schemas/MaskingRule'
                mysql:
                  type: object
                  properties:
                    query:
                      type: string
                      description: String representing the SQL equivalent of the conditions under which the query is true.
                    masks:
                      type: object
                      description: Column masking rules, where the first two nested keys represent the table name and the column name, and the value describes which masking function to use.
                      additionalProperties:
                        $ref: '#/components/schemas/MaskingRule'
                postgresql:
                  type: object
                  properties:
                    query:
                      type: string
                      description: String representing the SQL equivalent of the conditions under which the query is true
                    masks:
                      type: object
                      description: Column masking rules, where the first two nested keys represent the table name and the column name, and the value describes which masking function to use.
                      additionalProperties:
                        $ref: '#/components/schemas/MaskingRule'
                sqlite:
                  type: object
                  properties:
                    query:
                      type: string
                      description: String representing the SQL equivalent of the conditions under which the query is true
                    masks:
                      type: object
                      description: Column masking rules, where the first two nested keys represent the table name and the column name, and the value describes which masking function to use.
                      additionalProperties:
                        $ref: '#/components/schemas/MaskingRule'
  responses:
    ServerError:
      description: Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ServerError'
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ClientError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
externalDocs:
  description: Enterprise OPA documentation
  url: https://docs.styra.com/enterprise-opa
  x-openpolicyagent-documentation-url: https://www.openpolicyagent.org/docs/latest/