Skip to main content

Overview

The amber Public API uses the OAuth 2.0 Authorization Code Grant with PKCE to authenticate third-party applications. This flow lets users authorize external applications to access amber on their behalf without sharing their credentials. The implementation follows RFC 6749 (OAuth 2.0), RFC 7636 (PKCE) and RFC 8414 (Authorization Server Metadata). The same OAuth client can be used for both the REST API and the amber MCP Server.
This is a beta version of our OAuth 2.0 implementation. Features may evolve as we continue to improve the API.

Base URL

All OAuth endpoints are available under:

OAuth 2.0 Flow

The OAuth 2.0 Authorization Code Grant flow consists of the following steps:
1

Client Redirects User to Authorization Endpoint

Your application redirects the user to /api/oauth/authorize with your client ID, redirect URI, PKCE code challenge and desired scopes.
2

User Authentication

The user signs in to amber (if not already logged in).
3

Authorization Code Issued

amber redirects back to your application’s redirect URI with an authorization code.
4

Exchange Code for Access Token

Your application exchanges the authorization code for an access token by calling /api/oauth/token.
5

Access API with Token

Use the access token to make authenticated requests to amber API endpoints.

Getting Started

To use OAuth 2.0 with the amber API you need an OAuth client. Administrators of your amber workspace can create OAuth clients themselves — no need to contact the amber team.
1

Open the API Access settings

Log in to amber as an administrator and go to Settings → Products → API Access (https://customerDomain.ambersearch.de/settings/company/api-access).
2

Create a client

In the OAuth2 Clients for the API/MCP section, click Create Client, enter a display name and add one or more Redirect URIs of your application. For Claude, you can instead use From Template → Claude, which immediately creates a client named “Claude” with Claude’s redirect URIs.
3

Copy the credentials

After creating the client, copy the Client ID and Client Secret.
The client secret is only shown once, right after the client is created. Store it securely. If you lose it, delete the client and create a new one.
  • Creating OAuth clients requires the administrator role. It is not available on amber’s self-service (SaaS) platform.
  • The name and redirect URIs of an existing client can be edited at any time in the same settings page. Redirect URIs must match exactly what your application sends in redirect_uri; HTTPS is strongly recommended.
  • If the API Access settings are not available on your instance, contact your customer success manager.

Public vs. confidential clients

Every OAuth client has a client_id and a client_secret. How your application authenticates at the token endpoint depends on where it runs:

Discovery Endpoints

To make integration easier, amber exposes OAuth authorization server metadata (RFC 8414) so clients can automatically discover the endpoints and supported features. The issuer is https://customerDomain.ambersearch.de/api, so the metadata lives at:
The same document is also served at GET /.well-known/openid-configuration. Example Response:
The registration_endpoint requires an administrator to be authenticated, so anonymous dynamic client registration (RFC 7591) is not supported. Create the client in the API Access settings and configure its client ID (and secret) in your application.

Authorization Endpoint

Step 1: Redirect User to Authorization

Direct users to the authorization endpoint to begin the OAuth flow:
Query Parameters: Example Authorization URL:

Step 2: User Authentication

If the user is not logged into amber, they are redirected to the amber login page. After a successful login they are sent back to continue the OAuth flow. Users who are already logged in are not prompted again.
amber currently does not show a separate consent screen: as soon as the user is authenticated, the authorization code is issued for your client.

Step 3: Authorization Response

Upon successful authorization, the user is redirected to your redirect_uri with:
Error Response: If the request is invalid (for example an unsupported response_type, an unsupported code_challenge_method, or a code_challenge_method without a code_challenge), amber redirects to your redirect_uri with an error (and usually an error_description):
If the client_id or redirect_uri itself is invalid, amber cannot safely redirect and returns the error directly as a JSON response instead.

Token Endpoint

Step 4: Exchange Authorization Code for Access Token

Request Body (form-encoded): Example Request (public client with PKCE):
Example Request (confidential client with PKCE):
The client secret must be sent in the form body (client_secret_post). HTTP Basic authentication (client_secret_basic) is not supported: a request that relies on it fails with invalid_client, and if client_id is also in the body, the Authorization header is ignored.If your confidential client does not use PKCE, omit code_verifier from the request.
Success Response:
Success Response (with offline_access scope):

Using the Access Token

Once you have an access token, include it in the Authorization header for all API requests:

Step 5: Exchanging the Refresh Token for an Access Token

When the access token expires, exchange the refresh token for a new access token and a new refresh token at the same token endpoint.
Do not send a scope parameter when refreshing; the refresh is always performed with the originally granted access. A refresh request that contains scope fails with 400 invalid_scope.
Example Request:
Success Response:
Refresh tokens are rotated: every successful refresh returns a new refresh token and the previous one is revoked immediately. Always store the latest refresh token.

Scopes

If no scope is requested, a standard token pair is issued. Token Expiration:
  • Standard tokens: The access token expires after 1 hour (expires_in: 3600); the refresh token is valid for 30 days by default (the lifetime can differ per amber instance) and is renewed on every refresh.
  • Offline access tokens: The access token never expires (expires_in: null) until the session is revoked.
offline_access is only granted to OAuth clients for which it has been enabled. For other clients the scope is ignored and a standard token pair is returned — check the scope field of the token response to see what was granted. Contact your customer success manager if you need offline_access for your client.
For long-running applications or background processes, either request the offline_access scope (if enabled for your client) or refresh the access token before it expires.

Error Handling

OAuth errors from the token endpoint are returned as JSON with HTTP status 400. Common OAuth errors: Unsupported scopes in the authorization request are not an error: they are silently dropped, so check the scope field of the token response.
An invalid, expired, revoked or already rotated refresh token is not reported as an OAuth error. Instead the token endpoint returns 401 Unauthorized with a detail message, e.g. {"detail": "Token is invalid"} for a rotated token (the message depends on the cause). In that case, start a new authorization flow.
Example Error Response:

Security Best Practices

  • Always use HTTPS for redirect URIs
  • Validate the state parameter to prevent CSRF attacks
  • Use PKCE with S256, and generate a new random code_verifier for every authorization request
  • Never embed the client_secret in public clients (browser, desktop or mobile apps)
  • Store refresh tokens securely and always replace them with the newly issued one
  • Never expose tokens in URLs or logs