Skip to content

Open Policy Agent (OPA) REST API API

by openpolicy.local

No authHTTPSOpen Data
Open documentation ↗

Overview

OPA provides policy-based control for cloud native environments. The following *endpoints* (such as `PUT /v1/policies`) provide reference documentation for the OPA REST API. ### API specification viewing options - **[View the specification in *Redoc* (default)](index.html)** - **[View the specification in *Swagger UI*](swagger-ui.html)**

Open Policy Agent (OPA) REST API is an open data API from openpolicy.local. It needs no API key. It is served over HTTPS. Its OpenAPI description documents 16 endpoints.

At a glance

Authentication
No auth
HTTPS
Yes
CORS
Unknown
Category
Open Data
Base URL
http://openpolicy.local
Version
0.28.0
Endpoints
16
Spec updated
2023-03-06

Make a first request

Replace the placeholders; the documentation says exactly where credentials go.

cURL
curl -X GET "http://openpolicy.local/health" \
  -H "Accept: application/json"
JavaScript
const response = await fetch("http://openpolicy.local/health", {
  method: "GET",
  headers: {
    "Accept": "application/json",
  },
});
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    "GET",
    "http://openpolicy.local/health",
    headers={
    "Accept": "application/json",
    },
    timeout=30,
)
print(response.json())

Endpoints

MethodPathWhat it does
POST/Execute a simple query
GET/healthHealth
POST/v0/data/{path}Get a document (with webhook)
POST/v1/compileCompile
GET/v1/configGet configurations
GET/v1/data/{path}Get a document
POST/v1/data/{path}Get a document (with input)
PUT/v1/data/{path}Create or overwrite a document
PATCH/v1/data/{path}Update a document
DELETE/v1/data/{path}Delete a document
GET/v1/policiesList policies
GET/v1/policies/{id}Get a policy module
PUT/v1/policies/{id}Create or update a policy module
DELETE/v1/policies/{id}Delete a policy module
GET/v1/queryExecute an ad-hoc query (simple)
POST/v1/queryExecute an ad-hoc query (complex)

Questions

Does the Open Policy Agent (OPA) REST API API need an API key?

No. The Open Policy Agent (OPA) REST API API can be called without an API key or sign-up, which makes it handy for prototypes and front-end demos.

Does the Open Policy Agent (OPA) REST API API support HTTPS?

Yes, the Open Policy Agent (OPA) REST API API is served over HTTPS.

How many endpoints does the Open Policy Agent (OPA) REST API API have?

Its OpenAPI description lists 16 endpoints in version 0.28.0. All of them are shown on this page.

What are alternatives to the Open Policy Agent (OPA) REST API API?

Other Open Data APIs include Search Services, Wayback API, Wikipedia, Nasdaq Data Link, University of Oslo.

Compare alternatives →

Listed from APIs.guru (CC0).