{"files":{"SKILL.md":"---\nname: open-policy-agent-opa-rest-api\ndescription: \"Open Policy Agent (OPA) REST API skill. Use when working with Open Policy Agent (OPA) REST for policies, data, root. Covers 16 endpoints.\"\nversion: 1.0.0\ngenerator: lapsh\n---\n\n# Open Policy Agent (OPA) REST API\nAPI version: 0.28.0\n\n## Auth\nNo authentication required.\n\n## Base URL\nNot specified.\n\n## Setup\n1. No auth setup needed\n2. GET /v1/policies -- list policies\n3. POST /v1/data/{path} -- create first data\n\n## Endpoints\n16 endpoints across 7 groups. See references/api-spec.lap for full details.\n\n### Policies\n| Method | Path | Description |\n|--------|------|-------------|\n| GET | /v1/policies | List policies |\n| GET | /v1/policies/{id} | Get a policy module |\n| PUT | /v1/policies/{id} | Create or update a policy module |\n| DELETE | /v1/policies/{id} | Delete a policy module |\n\n### Data\n| Method | Path | Description |\n|--------|------|-------------|\n| GET | /v1/data/{path} | Get a document |\n| PUT | /v1/data/{path} | Create or overwrite a document |\n| PATCH | /v1/data/{path} | Update a document |\n| DELETE | /v1/data/{path} | Delete a document |\n| POST | /v1/data/{path} | Get a document (with input) |\n| POST | /v0/data/{path} | Get a document (with webhook) |\n\n### Root\n| Method | Path | Description |\n|--------|------|-------------|\n| POST | / | Execute a simple query |\n\n### Query\n| Method | Path | Description |\n|--------|------|-------------|\n| GET | /v1/query | Execute an ad-hoc query (simple) |\n| POST | /v1/query | Execute an ad-hoc query (complex) |\n\n### Compile\n| Method | Path | Description |\n|--------|------|-------------|\n| POST | /v1/compile | Compile |\n\n### Health\n| Method | Path | Description |\n|--------|------|-------------|\n| GET | /health | Health |\n\n### Config\n| Method | Path | Description |\n|--------|------|-------------|\n| GET | /v1/config | Get configurations |\n\n## Common Questions\nMatch user requests to endpoints in references/api-spec.lap. Key patterns:\n- \"List all policies?\" -> GET /v1/policies\n- \"Get policy details?\" -> GET /v1/policies/{id}\n- \"Update a policy?\" -> PUT /v1/policies/{id}\n- \"Delete a policy?\" -> DELETE /v1/policies/{id}\n- \"Get data details?\" -> GET /v1/data/{path}\n- \"Update a data?\" -> PUT /v1/data/{path}\n- \"Partially update a data?\" -> PATCH /v1/data/{path}\n- \"Delete a data?\" -> DELETE /v1/data/{path}\n- \"Create a resource?\" -> POST /\n- \"Search query?\" -> GET /v1/query\n- \"Create a query?\" -> POST /v1/query\n- \"Create a compile?\" -> POST /v1/compile\n- \"List all health?\" -> GET /health\n- \"List all config?\" -> GET /v1/config\n\n## Response Tips\n- Check response schemas in references/api-spec.lap for field details\n- Create/update endpoints return the modified resource on success\n- Error responses include status codes and descriptions in the spec\n\n## References\n- Full spec: See references/api-spec.lap for complete endpoint details, parameter tables, and response schemas\n\n> Generated from the official API spec by [LAP](https://lap.sh)\n","references/api-spec.lap":"@lap v0.3\n# Machine-readable API spec. Each @endpoint block is one API call.\n@api Open Policy Agent (OPA) REST API\n@version 0.28.0\n@endpoints 16\n@toc policies(4), data(6), root(1), query(2), compile(1), health(1), config(1)\n\n@group policies\n@endpoint GET /v1/policies\n@desc List policies\n@optional {pretty: bool # If true, response will be in a human-readable format.}\n@returns(200) {result: [any]} # Success\n@errors {500: Server error}\n\n@endpoint GET /v1/policies/{id}\n@desc Get a policy module\n@optional {pretty: bool # If true, response will be in a human-readable format.}\n@returns(200) {result: [any]} # Success\n@errors {404: Not found (for example, a requested policy module or document does not exist), 500: Server error}\n\n@endpoint PUT /v1/policies/{id}\n@desc Create or update a policy module\n@optional {pretty: bool # If true, response will be in a human-readable format., metrics: bool # If true, compiler performance metrics will be returned in the response.}\n@returns(200) {result: [any]} # Success\n@errors {400: Bad request, 500: Server error}\n\n@endpoint DELETE /v1/policies/{id}\n@desc Delete a policy module\n@optional {pretty: bool # If true, response will be in a human-readable format.}\n@returns(200) Success\n@errors {400: Bad request, 404: Not found (for example, a requested policy module or document does not exist), 500: Server error}\n\n@endgroup\n\n@group data\n@endpoint GET /v1/data/{path}\n@desc Get a document\n@optional {input: map # Provide the text for an [input document](https://www.openpolicyagent.org/docs/latest/kubernetes-primer/#input-document) in JSON format, pretty: bool # If true, response will be in a human-readable format., provenance: bool # If true, response will include build and version information in addition to the result., explain: str # If set to *full*, response will include query explanations in addition to the result., metrics: bool # If true, compiler performance metrics will be returned in the response., instrument: bool # If true, response will return additional performance metrics in addition to the result and the standard metrics.  **Caution:** This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem.}\n@returns(200) Success\n@errors {400: Bad request, 500: Server error}\n\n@endpoint PUT /v1/data/{path}\n@desc Create or overwrite a document\n@optional {If-None-Match: str # The server will respect the If-None-Match header if it is set to * (in other words, it will not overwrite an existing document located at the specified `path`).}\n@returns(204) Success\n@errors {304: Document was not modified, 400: Bad request, 404: Not found (for example, a requested policy module or document does not exist), 500: Server error}\n\n@endpoint PATCH /v1/data/{path}\n@desc Update a document\n@returns(204) Success\n@errors {400: Bad request, 404: Not found (for example, a requested policy module or document does not exist), 500: Server error}\n\n@endpoint DELETE /v1/data/{path}\n@desc Delete a document\n@returns(204) Success\n@errors {404: Not found (for example, a requested policy module or document does not exist), 500: Server error}\n\n@endpoint POST /v1/data/{path}\n@desc Get a document (with input)\n@optional {pretty: bool # If true, response will be in a human-readable format., provenance: bool # If true, response will include build and version information in addition to the result., explain: str # If set to *full*, response will include query explanations in addition to the result., metrics: bool # If true, compiler performance metrics will be returned in the response., instrument: bool # If true, response will return additional performance metrics in addition to the result and the standard metrics.  **Caution:** This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem.}\n@returns(200) Success\n@errors {400: Bad request, 500: Server error}\n\n@endpoint POST /v0/data/{path}\n@desc Get a document (with webhook)\n@optional {pretty: bool # If true, response will be in a human-readable format.}\n@returns(200) Success\n@errors {400: Bad request, 404: Not found (for example, a requested policy module or document does not exist), 500: Server error}\n\n@endgroup\n\n@group root\n@endpoint POST /\n@desc Execute a simple query\n@optional {pretty: bool # If true, response will be in a human-readable format.}\n@returns(200) Success\n@errors {400: Bad request, 404: Not found (for example, a requested policy module or document does not exist), 500: Server error}\n\n@endgroup\n\n@group query\n@endpoint GET /v1/query\n@desc Execute an ad-hoc query (simple)\n@required {q: str # The [URL-encoded](https://www.w3schools.com/tags/ref_urlencode.ASP) ad-hoc query to execute.}\n@optional {pretty: bool # If true, response will be in a human-readable format., explain: str # If set to *full*, response will include query explanations in addition to the result., metrics: bool # If true, compiler performance metrics will be returned in the response.}\n@returns(200) Success\n@errors {400: Bad request, 500: Server error}\n\n@endpoint POST /v1/query\n@desc Execute an ad-hoc query (complex)\n@optional {pretty: bool # If true, response will be in a human-readable format., explain: str # If set to *full*, response will include query explanations in addition to the result., metrics: bool # If true, compiler performance metrics will be returned in the response.}\n@returns(200) Success\n@errors {400: Bad request, 500: Server error, 501: Streaming not implemented}\n\n@endgroup\n\n@group compile\n@endpoint POST /v1/compile\n@desc Compile\n@optional {pretty: bool # If true, response will be in a human-readable format., explain: str # If set to *full*, response will include query explanations in addition to the result., metrics: bool # If true, compiler performance metrics will be returned in the response., instrument: bool # If true, response will return additional performance metrics in addition to the result and the standard metrics.  **Caution:** This can add significant overhead to query evaluation. The recommendation is to only use this parameter if you are debugging a performance problem.}\n@returns(200) Success\n@errors {400: Bad request, 500: Server error}\n\n@endgroup\n\n@group health\n@endpoint GET /health\n@desc Health\n@optional {bundles: bool # Reports on bundle activation status (useful for 'ready' checks at startup).  This includes any discovery bundles or bundles defined in the loaded discovery configuration., plugins: bool # Reports on plugin status, exclude-plugin: [str]= # String parameter to exclude a plugin from status checks. Can be added multiple times. Does nothing if plugins is not true. This parameter is useful for special use cases where a plugin depends on the server being fully initialized before it can fully initialize itself.}\n@returns(200) OPA service is healthy\n@errors {500: OPA service is not healthy}\n\n@endgroup\n\n@group config\n@endpoint GET /v1/config\n@desc Get configurations\n@optional {pretty: bool # If true, response will be in a human-readable format.}\n@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}} # Success\n@errors {500: Server error}\n\n@endgroup\n\n@end\n"}}