Styra Batch API
The Batch API from Styra — 1 operation(s) for batch.
Documentation
Documentation
https://www.openpolicyagent.org/docs
APIReference
https://www.openpolicyagent.org/docs/rest-api
The Batch API from Styra — 1 operation(s) for batch.
openapi: 3.0.3
info:
title: Enterprise OPA REST Batch 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: Batch
paths:
/v1/batch/data/{path}:
post:
parameters:
- $ref: '#/components/parameters/policyPath'
- $ref: '#/components/parameters/GzipContentEncoding'
- $ref: '#/components/parameters/GzipAcceptEncoding'
- $ref: '#/components/parameters/pretty'
- $ref: '#/components/parameters/provenance'
- $ref: '#/components/parameters/explain'
- $ref: '#/components/parameters/metrics'
- $ref: '#/components/parameters/instrument'
- $ref: '#/components/parameters/strict-builtin-errors'
summary: Execute a policy given a batch of inputs
operationId: executeBatchPolicyWithInput
x-speakeasy-usage-example: true
requestBody:
description: The batch of inputs
required: true
content:
application/json:
schema:
type: object
required:
- inputs
properties:
inputs:
type: object
additionalProperties:
$ref: '#/components/schemas/input'
responses:
'200':
$ref: '#/components/responses/BatchSuccessfulPolicyEvaluation'
'207':
$ref: '#/components/responses/BatchMixedResults'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/BatchServerError'
tags:
- Batch
components:
parameters:
pretty:
name: pretty
description: If parameter is `true`, response will formatted for humans.
in: query
schema:
type: boolean
strict-builtin-errors:
name: strict-builtin-errors
description: Treat built-in function call errors as fatal and return an error immediately.
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
provenance:
name: provenance
description: If parameter is true, response will include build/version info in addition to the result.
in: query
schema:
type: boolean
instrument:
name: instrument
description: Instrument query evaluation and return a superset of performance metrics in addition to result.
in: query
schema:
type: boolean
explain:
name: explain
description: Return query explanation in addition to result.
in: query
schema:
type: string
enum:
- notes
- fails
- full
- debug
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
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
metrics:
name: metrics
description: Return query performance metrics in addition to result.
in: query
schema:
type: boolean
responses:
BatchMixedResults:
description: Mixed success and failures.
headers:
Content-Encoding:
$ref: '#/components/headers/GzipContentEncoding'
content:
application/json:
schema:
type: object
properties:
batch_decision_id:
type: string
metrics:
type: object
description: If query metrics are enabled, this field contains query performance metrics collected during the parse, compile, and evaluation steps.
additionalProperties: true
responses:
type: object
additionalProperties:
type: object
properties:
http_status_code:
type: string
example: '200'
oneOf:
- $ref: '#/components/schemas/SuccessfulPolicyResponseWithStatusCode'
- $ref: '#/components/schemas/ServerErrorWithStatusCode'
discriminator:
propertyName: http_status_code
mapping:
'200': '#/components/schemas/SuccessfulPolicyResponseWithStatusCode'
'500': '#/components/schemas/ServerErrorWithStatusCode'
BadRequest:
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ClientError'
BatchServerError:
description: 'Server Error. All requests returned a 500 error.
'
content:
application/json:
schema:
type: object
properties:
batch_decision_id:
type: string
responses:
type: object
additionalProperties:
$ref: '#/components/schemas/ServerError'
BatchSuccessfulPolicyEvaluation:
description: 'All batched policy executions succeeded.
The server also returns 200 if the path refers to an undefined document. In this case, responses will be empty.
'
headers:
Content-Encoding:
$ref: '#/components/headers/GzipContentEncoding'
content:
application/json:
schema:
type: object
properties:
batch_decision_id:
type: string
example: 1bef6b7d-cd13-4890-bfe1-fd2e8de32189
metrics:
type: object
description: If query metrics are enabled, this field contains query performance metrics collected during the parse, compile, and evaluation steps.
additionalProperties: true
responses:
type: object
additionalProperties:
$ref: '#/components/schemas/SuccessfulPolicyResponse'
schemas:
SuccessfulPolicyResponse:
type: object
properties:
result:
$ref: '#/components/schemas/result'
metrics:
type: object
description: If query metrics are enabled, this field contains query performance metrics collected during the parse, compile, and evaluation steps.
additionalProperties: true
decision_id:
type: string
description: If decision logging is enabled, this field contains a string that uniquely identifies the decision. The identifier will be included in the decision log event for this decision. Callers can use the identifier for correlation purposes.
provenance:
$ref: '#/components/schemas/provenance'
ServerErrorWithStatusCode:
allOf:
- $ref: '#/components/schemas/HasStatusCode'
- $ref: '#/components/schemas/ServerError'
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
provenance:
type: object
description: Provenance information can be requested on individual API calls and are returned inline with the API response. To obtain provenance information on an API call, specify the `provenance=true` query parameter when executing the API call.
properties:
version:
type: string
build_commit:
type: string
build_timestamp:
type: string
format: date-time
build_host:
type: string
bundles:
type: object
additionalProperties:
type: object
title: Revision
required:
- revision
properties:
revision:
type: string
result:
description: The base or virtual document referred to by the URL path. If the path is undefined, this key will be omitted.
oneOf:
- type: boolean
- type: string
- type: number
- type: array
items: {}
- type: object
additionalProperties: true
example:
allow: true
user_is_admin: true
user_is_granted: []
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
SuccessfulPolicyResponseWithStatusCode:
allOf:
- $ref: '#/components/schemas/HasStatusCode'
- $ref: '#/components/schemas/SuccessfulPolicyResponse'
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
HasStatusCode:
type: object
properties:
http_status_code:
type: string
required:
- http_status_code
headers:
GzipContentEncoding:
description: Indicates that the response body is gzip encoded
schema:
type: string
enum:
- gzip
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/