Authorization API overview
The perms.io API has two services:
| Service | Proto | What it does |
|---|---|---|
| Permissions | permio.permissions.v1.PermissionsService |
Permissions, roles, grants and checks. This is the service your application calls. |
| Organisations | permio.organisation.v1.OrganisationService |
Organisations, projects, API keys and team members. Mostly used by the dashboard. |
Both are defined in Permio’s protobuf definitions. The same host serves them as REST/JSON, gRPC and gRPC-web.
Protocols
Section titled “Protocols”| Protocol | How to call it |
|---|---|
| REST/JSON | The HTTP method and path listed for each RPC in this reference, for example POST $PERMIO_API/permissions-service/v1/permissions/check. Request bodies accept the proto field names (project_name). Responses use camelCase JSON names (missingPermissions) and leave out fields that have default values. |
| gRPC | Connect to the host on port 443 with TLS, for example api.perms.io:443, and send the key as authorization metadata. The Go, Python, Rust and Java SDKs use it. |
| gRPC-web | The protocol the TypeScript SDK uses. It works from servers, edge runtimes and browsers. |
For GET and DELETE requests over REST, fields that aren’t in the path go in the query string. Nested fields use
dot notation, for example ?project_name=default&pagination.limit=50.
Authentication
Section titled “Authentication”Every request needs an API key, sent as a bearer token:
Authorization: Bearer perms_...Keys are 44 characters long: perms_, 32 random base62 characters and a 6-character checksum. A key is shown once,
when you create it in the dashboard. Only a hash of it is stored, and you can invalidate it at any time. Older JWT
API keys are still accepted.
A key acts within its own project. Your organisation is worked out from the key, so permission requests don’t
include an organisation ID. A key gets its own grants on its project: by default check access, which allows
Check, the access queries and the read-only calls. See Access levels.
Errors
Section titled “Errors”A denied check is not an error. Check returns success with passed: false and a list of
missing_permissions. Errors mean that the request itself could not be carried out:
| gRPC status | HTTP | Meaning |
|---|---|---|
INVALID_ARGUMENT (3) |
400 | Malformed input: an invalid resource URI, an empty permissions list, a bad project name, more than 100 items in a check, and so on. |
UNAUTHENTICATED (16) |
401 | The API key is missing, malformed, unknown or invalidated. |
PERMISSION_DENIED (7) |
403 | The API key isn’t allowed to make this call. For example, a key without permission.check calling Check, or a check-only key creating a role. The message lists what is missing. |
NOT_FOUND (5) |
404 | The permission, role, group or other entity doesn’t exist. Also returned when a group:<slug> principal names a group that doesn’t exist. |
ALREADY_EXISTS (6) |
409 | A group with this name already exists in the project. |
INTERNAL (13) |
500 | Something went wrong on our side. |
UNAVAILABLE (14) |
503 | The service is temporarily unavailable. Safe to retry for reads. |
Over REST, the error body carries the gRPC code and a message:
{"code": 16, "message": "invalid api key"}Over gRPC and gRPC-web, the code arrives as grpc-status and the text as grpc-message.
Clients
Section titled “Clients”Official SDKs:
| Language | Package | Status |
|---|---|---|
| TypeScript | permio on npm |
Released |
| Go | github.com/perms-io/permio-go |
Released |
| Python | permio on PyPI |
Released |
| Rust | permio on crates.io |
Released |
| Java | io.perms:permio on Maven Central |
Released |
To manage permissions, roles, groups and grants as code, use the Terraform provider
(perms-io/permio on the Terraform Registry).
The TypeScript SDK (npm install permio) is the recommended client.
Besides the check helpers, it exposes every RPC on this page through permio.permissions and
permio.organisations.
Every RPC has a REST path, listed with each method in this reference.
curl -X POST "$PERMIO_API/permissions-service/v1/permissions/check" \ -H "Authorization: Bearer $PERMIO_API_KEY" \ -H "Content-Type: application/json" \ -d '{"project_name": "default", "principal_id": "alice", "resource_uris": ["/documents/42"], "permissions": ["document.read"]}'The Go SDK (go get github.com/perms-io/permio-go@latest, Go 1.24+) is the recommended client.
Besides the check helpers, it exposes every RPC on this page through client.Permissions() and
client.Organisations(), the generated gRPC clients with auth, timeouts, retries and typed errors applied.
import permio "github.com/perms-io/permio-go"
client, err := permio.New(permio.Options{ APIKey: os.Getenv("PERMIO_API_KEY"), Project: "default",})// handle errdefer client.Close()
allowed, err := client.Check(ctx, "alice", "document.read", "/documents/42")The Python SDK (pip install permio) gives you a synchronous Permio client and an asyncio
AsyncPermio client with the same methods. Besides the check helpers, both expose every RPC on this page through
permio.permissions and permio.organisations, with the generated messages in permio.raw.
from permio import Permio
permio = Permio(api_key=api_key, project="default") # api_key defaults to $PERMIO_API_KEY
permio.check("alice", "document.read", "/documents/42") # True or FalseThe Rust SDK (crate permio) is the recommended client, on crates.io.
Besides the check helpers, it exposes every RPC on this page through permio.raw_permissions()
and permio.raw_organisations(), with authentication, timeouts and retries already applied.
[dependencies]permio = "0.1"tokio = { version = "1", features = ["macros", "rt-multi-thread"] }let permio = permio::Client::builder() .api_key(api_key) // defaults to the PERMIO_API_KEY env var .project("default") .build()?;
let allowed = permio.check("alice", "document.read", "/documents/42").await?;The Java SDK (io.perms:permio, Java 11+) wraps the check, access-query, grant and group RPCs, and
exposes every RPC on this page as generated gRPC stubs through permio.raw().
import io.perms.Permio;
Permio permio = Permio.builder() .apiKey(System.getenv("PERMIO_API_KEY")) .project("default") .build();
boolean allowed = permio.check("alice", "document.read", "/documents/42");Field names in this reference are the proto names (project_name). The generated clients use their language’s
convention: ProjectName in Go, project_name in Python and Rust, projectName in TypeScript, and
setProjectName / getProjectName in Java.
Other languages
Section titled “Other languages”Permio is a gRPC and REST/JSON API, so you can use it from any language:
- Generate a client from Permio’s public protobuf definitions with your language’s gRPC tooling. The public protos repository is coming soon.
- Call the REST API with any HTTP client, using the paths listed for each RPC in this reference and the
Authorization: Bearerheader described in Authentication.
Permio, permissions as a service