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

# API Authentication

## Introduction

Målbar uses one distinct type of authentication:

| Key type                  | Use case                     | Where to use                                          |
| :------------------------ | :--------------------------- | :---------------------------------------------------- |
| [**API keys**](#api-keys) | Server-to-server (REST APIs) | Back-end only; store securely, never expose to client |

## API keys

API keys on Målbar allow you to access Målbar LCA programmatically. This is useful for integrating Målbar into your application or with other tools and services.

Each API key is tied to a specific `Customer` – meaning you can use it to access that Customers's resources.

API keys on Målbar follow the format:

```bash .env theme={null} theme={null}
MAALBAR_API_KEY=mb_live_xxxxxxxxxxxxxxxx
```

By default, you can use this key to perform any API request without restriction, so it must be stored securely in your app's server-side code (such as in an environment variable or credential management system). Don’t expose this key on a website.

### Create an API key

You can create an API key by following these steps:

<Steps>
  <Step title="Go to Målbar LCA">
    Go to **API Keys** in the dropdown > [**API Keys**](https://lca.maalbar.dk/api-keys) in your workspace.
  </Step>

  <Step title="Create an API Key">
    Click on the "Create API key" button.

    Input a name for the API key that describes the intent with the integration

    Click on the **Create API Key** button to create the key. Make sure to copy your API key and store it in a safe place. You won't be able to see it again.
  </Step>

  <Step title="Use your API Key">
    Now that you have your API key, you can use it to access Målbar LCA programmatically via any API request with the X-Api-Key header.

    ```
    X-Api-Key: mb_live_xxxxxxxxxxxxxxxx
    ```
  </Step>
</Steps>
