> For the complete documentation index, see [llms.txt](https://docs.telm.ai/telmai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.telm.ai/telmai/api-reference/authentication-api/api-keys.md).

# API Keys

All Telmai APIs can be executed either with OAuth access token or API keys. Use APIs listed below to create a key. Use this key in the header of the Telmai APIs instead of the Authorization bearer token like this:

```
X-TLM-Key:{API Key}
```

Execute Authenticate API to retrieve access token for Authorization header used below

Tenant Id can be retrieved from the URL.

## Retrieve all API Keys for specific tenant

Retrieves the list of API Keys for the given tenant.

<mark style="color:green;">`GET`</mark> `{auth_endpoint}/auth/{tenant}/apiKeys`

**Query Parameters**

| Name                                                                  | Type   | Description              |
| --------------------------------------------------------------------- | ------ | ------------------------ |
| tenant<sup><mark style="color:red;">\*<mark style="color:red;"></sup> | string | Unique Tenant identifier |

{% tabs %}
{% tab title="First Tab" %}
`curl -X 'GET' \`\
`'{auth_endpoint}/auth/<tenant>/apiKeys'`\
`-H 'accept: */*'`
{% endtab %}
{% endtabs %}

**Responses**

{% tabs %}
{% tab title="200" %}

```
{
  "keys": [
    {
      "id": "string",
      "name": "string"
    }
  ]
}
```

{% endtab %}

{% tab title="401" %}
`Unauthorized`
{% endtab %}

{% tab title="403" %}
`Forbidden`
{% endtab %}

{% tab title="404" %}
`Not Found`
{% endtab %}
{% endtabs %}

## Create an API Key

Creates a new API key associated with the specified tenant.

<mark style="color:green;">`POST`</mark> `{auth_endpoint}/auth/{tenant}/apiKeys`

**Path Parameters**

| Name                                     | Type   | Description                       |
| ---------------------------------------- | ------ | --------------------------------- |
| tenant<mark style="color:red;">\*</mark> | string | Unique identifier for the tenant. |

#### Request Body

| Name                                   | Type   | Description         |
| -------------------------------------- | ------ | ------------------- |
| name<mark style="color:red;">\*</mark> | String | Name of the API Key |

{% tabs %}
{% tab title="curl" %}
`curl -X 'POST' \`\
`'{auth_endpoint}/auth/<tenant>/apiKeys' \`\
`-H 'accept: */*' \`\
`-H 'Content-Type: application/json' \`\
`-d '{`\
`"name": "<name>"`\
`}'`
{% endtab %}
{% endtabs %}

**Responses**

{% tabs %}
{% tab title="200" %}
`{`\
`"id": "string",`\
`"name": "string",`\
`"key": "string"`\
`}`
{% endtab %}

{% tab title="401" %}
`Unauthorized`
{% endtab %}

{% tab title="403" %}
`Forbidden`
{% endtab %}

{% tab title="404" %}
`Not Found`
{% endtab %}
{% endtabs %}

## Get details of specific API Key

Fetches the API key information using a unique key ID for a specific tenant.

<mark style="color:green;">`GET`</mark> `{auth_endpoint}/auth/{tenant}/apiKeys/{keyId}`

**Path Parameters**

| Name   | Type   | Required | Description       |
| ------ | ------ | -------- | ----------------- |
| tenant | string | Yes      | Tenant identifier |
| keyId  | string | Yes      | Unique API Key ID |

{% tabs %}
{% tab title="curl" %}
`curl -X 'GET'`\
`'/auth/<tenant>/apiKeys/<keyId>'`\
`-H 'accept: */*'`
{% endtab %}
{% endtabs %}

**Responses**

{% tabs %}
{% tab title="200" %}
`{`\
`"id": "string",`\
`"name": "string",`\
`}`
{% endtab %}

{% tab title="401" %}
`Unauthorized`
{% endtab %}

{% tab title="403" %}
`Forbidden`
{% endtab %}

{% tab title="404" %}
`Not Found`
{% endtab %}
{% endtabs %}

## Delete an API Key

Removes the API Key with the specified `keyId` for the given `tenant`.

**Parameters:**

| Name                                     | Type     | Description                                     |
| ---------------------------------------- | -------- | ----------------------------------------------- |
| tenant<mark style="color:red;">\*</mark> | `string` | The identifier of the tenant.                   |
| keyId<mark style="color:red;">\*</mark>  | `string` | The unique identifier of the API Key to delete. |

{% tabs %}
{% tab title="curl" %}
`curl -X 'DELETE'`\
`'{auth_endpoint}/auth/<tenant>/apiKeys/<keyId>'`\
`-H 'accept: */*'`
{% endtab %}
{% endtabs %}

**Responses**

{% tabs %}
{% tab title="200" %}
`{`\
`"message": "string"`\
`}`
{% endtab %}

{% tab title="401" %}
`Unauthorized`
{% endtab %}

{% tab title="403" %}
`Forbidden`
{% endtab %}

{% tab title="404" %}
`Not Found`
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.telm.ai/telmai/api-reference/authentication-api/api-keys.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
