Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Authentication

Learn how to authenticate with Dastra API.

Getting your API secret key

The Dastra REST API uses API keys to authenticate each request. You manage your keys in the Api keys & MCP page, which is reserved to organization owners. See API key management.

You can use an API key for a specific workspace or for the entire organization.

An API key gives access to your data, so keep it safe. Do not share your private key in public parts of applications, such as GitHub or client-side code.

An expired or unknown key is refused with status 401.

If you want to use OAuth2 authentication with the "authorization_code" flow, enter the redirect URIs and the allowed CORS origins in the details panel of the key.

The API key creation window with the name, workspace, expiration and permissions
Creating an API key

API key (X-API-Key)

The simplest way to authenticate is to use the HTTP header X-API-Key containing the private part of your API key, as in the example below:

OAuth2 "Authorization code" flow

Authorization

The authorization phase is performed by calling the following URL:

Parameters

Parameter Name
Description

response_type

code

client_id

The public key of your API key configured in your Dastra account

redirect_uri

The URL configured in the Dastra API key. You will be automatically redirected to this page at the end of the authorization process

scope

api1 => mandatory offline_access => to obtain a refresh_token (long sessions)

state

A random string generated by your application to prevent cross-site request forgery (CSRF) attacks. See Mitigate CSRF Attacks With State Parameters. Client libraries usually handle this automatically

OAuth2 "Client credentials" flow

Authentication method

API authentication is based on the OAuth2 protocol using the "Client credentials" flow. This authentication mode should only be used for server-to-server requests and must never be used on the client side (e.g., JavaScript SPA).

Diagram of the Client credentials flow: your server requests a token from the Dastra identification server, then calls the API with that token
The Client credentials flow

Getting the token

POST https://account.dastra.eu/connect/token

Perform a token request using BASIC headers.

Headers

Name
Type
Description

Authorization

Basic {base64("{PublicKey}:{PrivateKey}")}

Request Body

Name
Type
Description

grant_type

string

client_credentials

scope

string

api1

Once you have retrieved an access_token, you can call any REST API endpoint using this token as a "Bearer token".

For example, to get the list of your workspaces:

GET https://api.dastra.eu/v1/Workspaces

Retrieve the list of Dastra workspaces.

Headers

Name
Type
Description

Authorization

Bearer {access_token}

All requests must be made over HTTPS and always from the server side. Requests without authentication will fail with error code 401.

See the API reference here: https://api.dastra.eu/swagger/index.html

Last updated

Was this helpful?