Skip to main content
Version: 2.x (Latest)

Protocols & Admin API

Added in authorizer-py for Authorizer 2.3.0-rc.9.

Protocol selection

Both the sync (AuthorizerClient) and async (AsyncAuthorizerClient) user clients can talk to the server over three wire protocols. graphql is the default and is 100% backward compatible — existing code keeps working unchanged.

protocol=TransportNotes
"graphql"POST /graphqlDefault.
"rest"Typed POST/GET /v1/... routesSame flat responses as GraphQL.
"grpc"Generated gRPC stubUses a separate endpoint (default :9091).

As of 2.3.0-rc.9 all public methods work over every protocol, and all three return identical flat response shapes.

from authorizer import AuthorizerClient, LoginRequest

# REST
client = AuthorizerClient(
client_id="YOUR_CLIENT_ID",
authorizer_url="https://your-instance.authorizer.dev",
protocol="rest",
)
token = client.login(LoginRequest(email="user@example.com", password="Abc@123"))

gRPC

gRPC requires the optional extra:

pip install 'authorizer-py[grpc]'

It listens on its own port, separate from the HTTP URL. When grpc_endpoint is omitted, the target is derived from authorizer_url's host with the default gRPC port 9091.

client = AuthorizerClient(
client_id="YOUR_CLIENT_ID",
authorizer_url="https://your-instance.authorizer.dev",
protocol="grpc",
grpc_endpoint="your-instance.authorizer.dev:9091", # optional
)

OAuth endpoints (/oauth/token, /oauth/revoke) always use REST regardless of the selected protocol.

Admin client

The admin API is a separate client constructed with the admin secret (the value of --admin-secret) — AuthorizerAdminClient (sync) and AsyncAuthorizerAdminClient (async). Admin auth is sent on every call as the x-authorizer-admin-secret header (gRPC: metadata key x-authorizer-admin-secret).

from authorizer import AuthorizerAdminClient

admin = AuthorizerAdminClient(
authorizer_url="https://your-instance.authorizer.dev",
admin_secret="YOUR_ADMIN_SECRET",
)

# List users
res = admin.users()
for u in res.users:
print(u.email)

admin.close()

The async client mirrors the sync one method-for-method; await the calls and use async with / await admin.aclose().

Constructor options

AuthorizerAdminClient(
authorizer_url: str,
admin_secret: str,
extra_headers: dict[str, str] | None = None,
protocol: str = "graphql",
grpc_endpoint: str = "",
)
ParameterDescriptionRequired
authorizer_urlBase URL of your Authorizer instance, no trailing slash.yes
admin_secretValue of --admin-secret.yes
extra_headersExtra headers sent on every admin request.no
protocol"graphql" (default), "rest", or "grpc".no
grpc_endpointgRPC target (default: URL host + :9091).no

Admin methods

Each method declares which protocols support it. Calling a method on an unsupported protocol raises a clear error early rather than emitting a 404.

⚠ Destructive: delete_user, delete_webhook, delete_email_template, fga_write_model (overwrites the model), fga_delete_tuples, and fga_reset (wipes all FGA data) permanently change or remove data.

Auth, session & meta

MethodDescriptiongrpcrestgql
admin_loginExchange the admin secret for a session.
admin_logoutEnd the admin session.
admin_sessionGet the current admin session.
admin_metaServer metadata / feature flags.

Users & access

MethodDescriptiongrpcrestgql
usersList users (paginated).
userGet a single user.
update_userUpdate a user.
delete_userDelete a user.
verification_requestsList pending verification requests.
revoke_accessRevoke a user's access.
enable_accessRe-enable a user's access.
invite_membersInvite members by email.

Webhooks

MethodDescriptiongrpcrestgql
add_webhookCreate a webhook.
update_webhookUpdate a webhook.
delete_webhookDelete a webhook.
get_webhookGet a single webhook.
webhooksList webhooks.
webhook_logsList webhook delivery logs.
test_endpointSend a test event to a webhook.

Email templates

MethodDescriptiongrpcrestgql
add_email_templateCreate an email template.
update_email_templateUpdate an email template.
delete_email_templateDelete an email template.
email_templatesList email templates.

Audit

MethodDescriptiongrpcrestgql
audit_logsList audit logs.

FGA admin

MethodDescriptiongrpcrestgql
fga_get_modelGet the current FGA model.
fga_write_modelWrite/overwrite the FGA model.
fga_write_tuplesWrite relationship tuples.
fga_delete_tuplesDelete relationship tuples.
fga_read_tuplesRead relationship tuples.
fga_list_usersList users with a relation to an object.
fga_expandExpand a relation into its userset.
fga_resetReset all FGA data.

GraphQL-only extras

These have no REST / gRPC equivalent and work over GraphQL only:

MethodDescription
admin_signupBootstrap the first admin.
update_envUpdate server environment/config.
generate_jwt_keysGenerate a new JWT signing key pair.