> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bodyguard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get your API key

> Create a service account and an API key in the Bodyguard dashboard to authenticate your API requests.

To call the Bodyguard API, your application authenticates with an API key. In the dashboard, API keys belong to a **service account**: the service account is the identity of your application or automated process (a monitoring tool, a script, a data pipeline, a staging or production environment), and the API key is the credential it uses to authenticate.

> [!NOTE]
>
> Service accounts and API keys are only supported by the new API.

## Prerequisites

You need the **Admin** role in your organization to create and manage service accounts and API keys. Members and Editors can view them.

## Steps

**1. Create a service account**

1. Click the gear icon in the left menu to open **Settings**, then select **Identity & access management**.

   ![Bodyguard dashboard with the Settings gear icon in the left menu and the Identity & access management entry highlighted](https://mintcdn.com/bodyguardai/oGCRxEeuFI_d_hrR/images/how-to/get-api-key/01-open-identity-access-management.png?fit=max\&auto=format\&n=oGCRxEeuFI_d_hrR\&q=85\&s=3c532a44d620aaa28e01b00ff3f95620)

   Settings > Identity & access management

2. Open the **Service accounts** tab and click **Create service account**.

   ![Service accounts tab with the Create service account button highlighted](https://mintcdn.com/bodyguardai/oGCRxEeuFI_d_hrR/images/how-to/get-api-key/02-create-service-account-button.png?fit=max\&auto=format\&n=oGCRxEeuFI_d_hrR\&q=85\&s=eb53cd519b9cec5584337e650243ba9b)

   Service accounts tab

3. Fill in the form. The numbers match the screenshot below.

   **1.** Enter a **Name**.\\

   **2.** Add an optional **Description**.\\

   **3.** Review the source access. **Grant full source access** is enabled by default: the service account can access all current and future sources.\\

   **4.** Click **Create**.

   ![Create service account dialog with the Name field (1), the Description field (2), the Grant full source access option (3), and the Create button (4) highlighted](https://mintcdn.com/bodyguardai/oGCRxEeuFI_d_hrR/images/how-to/get-api-key/03-create-service-account-form.png?fit=max\&auto=format\&n=oGCRxEeuFI_d_hrR\&q=85\&s=e743a37f72a204681cc090a4cc38f5e8)

   Create service account form

   Use a clear name that identifies the application or environment using the account. For example, name it `Production Monitoring` and describe it as `Used by the production monitoring integration`.

4. Your service account appears in the list. Click the expand icon at the end of its row to open its details page.

   ![Service accounts list with the new service account highlighted and an arrow pointing to the expand icon that opens its details page](https://mintcdn.com/bodyguardai/oGCRxEeuFI_d_hrR/images/how-to/get-api-key/04-open-service-account-details.png?fit=max\&auto=format\&n=oGCRxEeuFI_d_hrR\&q=85\&s=e1d50b7bcfaade82b2c03090037a4909)

   Open the service account details page

**2. Generate an API key**

1. On the service account details page, click **Generate an API key**.

   ![Service account details page with the Generate an API key button highlighted](https://mintcdn.com/bodyguardai/oGCRxEeuFI_d_hrR/images/how-to/get-api-key/05-generate-api-key-button.png?fit=max\&auto=format\&n=oGCRxEeuFI_d_hrR\&q=85\&s=c92294d33da1a0875332546f58778bd8)

   Service account details page

2. Enter a name and an optional description. To make the key expire, select **Set an expiration date** and pick a date. Then click **Generate and continue**.

   ![Generate an API key dialog with the Name, Description, Set an expiration date, and Expiration date fields, and the Generate and continue button](https://mintcdn.com/bodyguardai/oGCRxEeuFI_d_hrR/images/how-to/get-api-key/06-generate-api-key-form.png?fit=max\&auto=format\&n=oGCRxEeuFI_d_hrR\&q=85\&s=f3e43876ed8bf82236e8e3e2a5b0b4e8)

   Generate an API key form

3. Copy your API key with the copy icon and store it securely, then click **Done**. The key is displayed only once, when you create it. You can't display it again afterwards.

   ![Your API key has been generated dialog with the API key field and its copy icon highlighted](https://mintcdn.com/bodyguardai/oGCRxEeuFI_d_hrR/images/how-to/get-api-key/07-api-key-displayed-once.png?fit=max\&auto=format\&n=oGCRxEeuFI_d_hrR\&q=85\&s=762e744f44a2f31268010e24dbf0c302)

   API key displayed at creation

You can later edit, deactivate, or delete a key from the **⋮** menu at the end of its row. Editing a key only changes its name, description, and expiration date: you can't change or display its value. If you lose the value of a key, generate a new one.

![API key row with its menu open, showing the Edit API key, Deactivate, and Delete actions](https://mintcdn.com/bodyguardai/oGCRxEeuFI_d_hrR/images/how-to/get-api-key/08-api-key-actions.png?fit=max\&auto=format\&n=oGCRxEeuFI_d_hrR\&q=85\&s=b2356adafef5ccd8a281dc62cdc48548)

API key actions

> [!WARNING]
>
> Deactivating a service account does not deactivate its API keys. Manage the keys separately when necessary.

**3. Use your API key**

Send the key in the `Authorization` header of every request, using the case-sensitive `ApiKey` scheme:

```text Authorization header theme={null}
Authorization: ApiKey <your-api-key>
```

See [Authentication](https://docs.bodyguard.ai/en/api-reference/introduction.md#authentication) for the required headers and the authentication errors, and the [Quickstart](https://docs.bodyguard.ai/en/api-reference/introduction.md#quickstart) for a first request.

> [!WARNING]
>
> Keep your API key secret and never expose it in client-side code.

## Next steps

> [card] [API introduction](https://docs.bodyguard.ai/en/api-reference/introduction.md)
>
> Authenticate and send your first request.

> [card] [Connect your webhook](https://docs.bodyguard.ai/en/documentation/how-to/connect-webhook.md)
>
> Receive notifications on your endpoint.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.