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

# Get API Key Info

> See which account or client the API key you are calling with belongs to

Returns who the API key you send belongs to: an account key or a client key, the account's user ID, the client ID for a client key, and the name and email on it. It changes nothing and spends nothing, so it is a safe first call to check a key before an agent acts. It never returns the key itself.

Unlike [Get Account by API Key](https://api.smartlead.ai/api-reference/utilities/get-account-by-api-key.md), it also answers for client API keys.

## Query Parameters

**api\_key** `string` *required*

Your SmartLead API key (a main or client key)

```bash cURL theme={null}
curl "https://server.smartlead.ai/api/v1/key?api_key=YOUR_KEY"
```

```python Python theme={null}
import requests

response = requests.get(
    "https://server.smartlead.ai/api/v1/key",
    params={"api_key": "YOUR_API_KEY"},
)
print(response.json())
```

## Response Fields

**ok** `boolean`

`true`

**key\_type** `string`

`account` for a main account key, `client` for a client key

**key\_id** `integer`

The key's ID for an account key created on the API keys page; `null` for a client key or an older account key

**key\_name** `string`

The name given to that key; `null` when there is no `key_id`

**user\_id** `integer`

The account's user ID

**client\_id** `integer`

The client's ID for a client key; `null` for an account key

**name** `string`

The account's name, or the client's name for a client key

**email** `string`

The account's email, or the client's email for a client key

**access** `string`

`full` for an account key (the whole account), `client` for a client key (that client's data only)

**can\_spend** `boolean`

Whether the key can make calls that use credits. `true` for every key today.

## Response Codes

**200** `Success`

Request successful

**400** `Bad Request`

A query parameter other than `api_key` was sent

**401** `Unauthorized`

Invalid or missing API key

**500** `Internal Server Error`

Server error; retry the request

```json 200 - Account key theme={null}
{
  "ok": true,
  "key_type": "account",
  "key_id": 42,
  "key_name": "Agent key",
  "user_id": 123,
  "client_id": null,
  "name": "Jane Doe",
  "email": "jane@example.com",
  "access": "full",
  "can_spend": true
}
```

```json 200 - Client key theme={null}
{
  "ok": true,
  "key_type": "client",
  "key_id": null,
  "key_name": null,
  "user_id": 123,
  "client_id": 77,
  "name": "Example Client",
  "email": "client@example.com",
  "access": "client",
  "can_spend": true
}
```

```json 401 - Unauthorized theme={null}
{
  "message": "Invalid API Key"
}
```

```json 500 - Internal Server Error theme={null}
{
  "ok": false,
  "error": "Failed to read the API key details"
}
```


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