@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Open Policy Agent (OPA) REST API
@version 0.28.0
@endpoints 16
@toc policies(4), data(6), root(1), query(2), compile(1), health(1), config(1)

@group policies
@endpoint GET /v1/policies
@optional {pretty: bool}
@returns(200) {result: [any]}
@errors {500}

@endpoint GET /v1/policies/{id}
@optional {pretty: bool}
@returns(200) {result: [any]}
@errors {404, 500}

@endpoint PUT /v1/policies/{id}
@optional {pretty: bool, metrics: bool}
@returns(200) {result: [any]}
@errors {400, 500}

@endpoint DELETE /v1/policies/{id}
@optional {pretty: bool}
@returns(200)
@errors {400, 404, 500}

@endgroup

@group data
@endpoint GET /v1/data/{path}
@optional {input: map, pretty: bool, provenance: bool, explain: str, metrics: bool, instrument: bool}
@returns(200)
@errors {400, 500}

@endpoint PUT /v1/data/{path}
@optional {If-None-Match: str}
@returns(204)
@errors {304, 400, 404, 500}

@endpoint PATCH /v1/data/{path}
@returns(204)
@errors {400, 404, 500}

@endpoint DELETE /v1/data/{path}
@returns(204)
@errors {404, 500}

@endpoint POST /v1/data/{path}
@optional {pretty: bool, provenance: bool, explain: str, metrics: bool, instrument: bool}
@returns(200)
@errors {400, 500}

@endpoint POST /v0/data/{path}
@optional {pretty: bool}
@returns(200)
@errors {400, 404, 500}

@endgroup

@group root
@endpoint POST /
@optional {pretty: bool}
@returns(200)
@errors {400, 404, 500}

@endgroup

@group query
@endpoint GET /v1/query
@required {q: str}
@optional {pretty: bool, explain: str, metrics: bool}
@returns(200)
@errors {400, 500}

@endpoint POST /v1/query
@optional {pretty: bool, explain: str, metrics: bool}
@returns(200)
@errors {400, 500, 501}

@endgroup

@group compile
@endpoint POST /v1/compile
@optional {pretty: bool, explain: str, metrics: bool, instrument: bool}
@returns(200)
@errors {400, 500}

@endgroup

@group health
@endpoint GET /health
@optional {bundles: bool, plugins: bool, exclude-plugin: [str]=}
@returns(200)
@errors {500}

@endgroup

@group config
@endpoint GET /v1/config
@optional {pretty: bool}
@returns(200) {result: map{services: map{acmecorp: map{url: str}}, labels: map{id: str, version: str}, keys: map{global-key: map{scope: str}}, decision_logs: map{service: str}, status: map{service: str}, bundles: map{authz: map{service: str}}, default_authorization_decision: str, default_decision: str}}
@errors {500}

@endgroup

@end
