Skip to main content
Credentials let your applications, scripts, and HiddenLayer products call HiddenLayer APIs. HiddenLayer has two kinds:
  • Client credentials: A client ID and a client secret. Your application trades them for a short-lived access token, then sends the token with each request.
  • API keys: A single key that your application sends with each request. There is no token exchange.
You manage both in the HiddenLayer Console under Settings > Credentials. Each kind has its own tab.

Choose a Credential

Use a client credential unless your tool can’t get an access token. Client credentials are safer. If an access token leaks, it stops working on its own within a short time. An API key keeps working until you revoke it or it expires. Use an API key only when a tool can send a fixed token but can’t get an access token, for example a tool that only lets you set a request header.

Who Can Manage Credentials

Admins can create, regenerate, rotate, delete, and revoke credentials. Admins and Viewers can see them. See Users.

Client Credentials

Create a Client Credential

  1. In the HiddenLayer Console, go to Settings > Credentials. The Client Credentials tab opens.
  2. Click New client credential.
    Client Credentials tab with the New client credential button
  3. Enter a name, select an expiration from 7 days to 1 year, then click Next.
    Client credential name and expiration
  4. Select the permissions the client credential needs, then click Create client credential. See Permissions.
    Client credential permissions
    You can’t change permissions after you create a client credential. If you don’t select any permissions, the client credential gets all permissions.
  5. Copy the Client ID and Client Secret, then store them in a secrets manager.
    New client ID and client secret
    This is the only time the client secret is shown. If you lose it, regenerate the client secret.
  6. Click Close.

Use a Client Credential

HiddenLayer SDKs, and HiddenLayer products that ask for a client ID and client secret, get and refresh access tokens for you. To call the API yourself:
  1. Trade the client ID and client secret for an access token. Send them to the token endpoint as HTTP Basic credentials.
    In the EU, use https://api.eu.hiddenlayer.ai/oauth2/token.
  2. Copy access_token from the response. expires_in is the number of seconds the token lasts. Get a new token before it expires.
  3. Send the token in the Authorization header of each request.
See Get an access token in the API reference.

Regenerate a Client Secret

Regenerate the client secret to keep using a client credential after it would expire, or if the secret might have leaked. The client ID and permissions stay the same.
  1. On the Client Credentials tab, click the client credential.
  2. Click Regenerate Client Secret.
    Client credential details with the Regenerate Client Secret and Delete buttons
  3. Select a new expiration. It counts from today.
  4. Click Regenerate.
    Regenerate Client Secret confirmation
  5. Copy the new client secret, then store it in a secrets manager.
    New client secret
  6. Update your applications to use the new client secret.
The old client secret stops working as soon as you regenerate it.

Delete a Client Credential

  1. On the Client Credentials tab, click the client credential.
  2. Click Delete.
  3. Click Delete to confirm.
    Delete client credential confirmation
Applications that use the client credential can no longer get access tokens.

When a Client Credential Expires

  • Console admins get an email 7 days and 1 day before a client credential expires.
  • When a client credential expires, HiddenLayer deletes it. Applications that use it can no longer get access tokens.
  • To avoid an outage, regenerate the client secret before the client credential expires.

API Keys

An API key is a single value that your application sends with each request. Use it only when your tool can’t get an access token from a client credential.
  • An API key can have up to two secrets at a time. Each secret has its own key value and lasts up to one year.
  • To replace a secret without downtime, rotate the API key. This adds a new secret, and the old one keeps working until you revoke it.
  • You can only give an API key permissions that you have.
  • An API key can’t have the API Client Credentials permission, so it can’t create or manage client credentials or API keys.

Create an API Key

  1. In the HiddenLayer Console, go to Settings > Credentials, then click the API Keys tab.
  2. Click New API key.
    API Keys tab with the New API key button
  3. Enter a name, select an expiration from 7 days to 1 year, then click Next. Each API key needs a different name.
    API key name and expiration
  4. Select at least one permission, then click Create API Key. See Permissions.
    API key permissions
  5. Copy the API key, then store it in a secrets manager.
    New API key
    This is the only time the full key is shown. If you lose it, rotate the API key, then revoke the lost secret.
  6. Click I’ve stored the key.

Use an API Key

Send the API key in the Authorization header of each request.
In the EU, use https://api.eu.hiddenlayer.ai. See Static API Keys Overview in the API reference.

Rotate an API Key

Rotating adds a new secret to the API key. The old secret keeps working until you revoke it or it expires, so you can update your applications without downtime.
  1. On the API Keys tab, click the API key.
  2. Click Rotate secret.
    API key details with the Rotate secret and Revoke key buttons
  3. Select an expiration, then click Rotate secret.
    Rotate secret
  4. Copy the new key, store it in a secrets manager, then click I’ve stored the key.
    New API key secret
  5. Update your applications to use the new key.
  6. Revoke the old secret.
If the API key already has two secrets, revoke one before you rotate.

Revoke a Secret

Revoke a secret after you finish rotating, or if it might have leaked. The API key and its other secret keep working.
  1. On the API Keys tab, click the API key.
  2. Under Active secrets, click Revoke secret next to the secret.
    API key with two active secrets, each with a Revoke secret button
  3. Click Revoke secret to confirm.
    Revoke secret confirmation
Requests that use the secret fail right away. You can’t undo this. If it was the API key’s only secret, the API key stops working until you rotate it.

Revoke an API Key

Revoking an API key revokes all of its secrets.
  1. On the API Keys tab, click the API key.
  2. Click Revoke key.
  3. Click Revoke key to confirm.
    Revoke API key confirmation
Requests that use the API key fail right away. You can’t undo this.

When an API Key Secret Expires

  • Requests that use an expired secret fail.
  • An API key with no active secrets can’t be used. Rotate it to add a new secret, or revoke it.
  • HiddenLayer removes an API key some time after its last secret expires. Until then, you can rotate it.

When a User Is Removed

Deleting a Console user doesn’t delete the client credentials or API keys they created. When you offboard someone, delete or revoke their credentials as a separate step. To see who created a credential, click it on the Client Credentials or API Keys tab. See Access removal.

When to Replace Credentials

Credentials give access to your HiddenLayer data, so protect them like passwords. These are common reasons to replace a credential. Also follow your organization’s own policies.

Permissions

Each credential has its own permissions. Give a credential only the permissions it needs. For each permission, select the levels the credential needs: Read, Write, Delete, or All. Some permissions offer only some of these levels.

Permission Categories

The Console groups permissions by product. API keys can have every permission except API Client Credentials.

Permissions for Products and Features

Some HiddenLayer products need a client credential. The following table lists the permission categories, and the permissions that products and features need.
CategoryAPI PermissionNotes
AI PortfolioGeneral: Read, Write
Attack SimulationGeneral: Delete, Read, WritePermissions needed for AI Attack Simulation.
  • Read: Use any get or list API routes.
  • Write: Create a resource (e.g. start a Red Team Evaluation, create a Prompt Set).
  • Delete: Delete a resource.
ReportingReporting Aggregates: Read
Runtime SecurityConvictions: Read, Write
  • General: Delete, Read, Write
  • General Shared: Delete, Write
  • Interactions: Read, Write
  • Policy: Delete, Read, Write
  • Policy Packs: Delete, Read, Write
  • Project: Delete, Read, Write

Permissions needed for AI Runtime Security: Interactions (Read, Write), Policy (Read), Project (Read).

Permissions needed for Interactions SaaS: Interactions (Read, Write).

Supply ChainGeneral: Delete, Read, Write
  • Scan Results: Write

Permissions needed for AI Supply Chain Security CLI Hybrid Mode, GitHub Action, and Azure DevOps Plugin: General (Read, Write), Scan Results (Write).

Hybrid Mode sends scan results to the AI Security Platform.

Tenant SettingsAPI Client Credentials: Delete, Read, Write
  • Audit Log: Read
  • General: Write
  • Integrations: Delete, Read, Write
  • Users: Delete, Read, Write

Permissions needed for Integrations and Single Sign-On (SSO): Integrations (Read, Write, Delete).

Prompt Analyzer (SaaS) only needs a client credential that hasn’t expired.