REST API

REST API documentation

You can explore the Defguard REST API using Swagger UI by going to <YOUR_DEFGUARD_URL>/api-docs.

API specification JSON in OpenAPI format can also be fetched from <YOUR_DEFGUARD_URL>/api/v1/api-docs.

Admin users can generate API tokens to enable request authentication for custom external tools which use Defguard REST API.

Tokens retain the same access permissions as their owner, so be careful when sharing them with others.

Generating API token

Setup

To generate a new API token go to your profile page and click the Add new API Tokenbutton:

Fill in your chosen token name and submit form:

Copy generated token. This is the only time the token will be available in plain text form. If you lose it you will have to generate a new one.

In the API token list you can later rename or delete a token:

Usage

Defguard API uses a standard Bearer token authentication scheme.

This means that an API token can be passed in the Authorizationheader to authenticate a given request instead of a session cookie used by the web UI:

Authorization: Bearer <token>

Example GET request:

curl -H "Authorization: Bearer <token>" <YOUR_DEFGUARD_URL>/api/v1/me

Last updated

Was this helpful?