> For the complete documentation index, see [llms.txt](https://docs.apismart.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apismart.ai/api-tokens/create-and-manage-api-tokens.md).

# Create and Manage API Tokens

ApiSmart uses **API Tokens** to authenticate requests from your applications.

Each Token can be managed separately and may have its own usage limit.

> 🔐 **Security warning:** Anyone with access to a valid API Token may be able to make requests and consume your wallet balance. Keep every Token secure.

***

### 🔑 Open API Token Management

To manage your API keys:

1. Sign in to ApiSmart.
2. Open **Console** in the left navigation.
3. Select **API Tokens**.

<figure><img src="/files/BKAKWgYkLFgnXCvT78Bk" alt=""><figcaption></figcaption></figure>

The page displays the integration information required for API requests:

```
API Base URL: https://gw.apismart.ai/v1
Authentication: Authorization: Bearer
```

It also shows your existing **API Tokens**, usage limits, status, creation time, and available actions.

***

### Create an API Token

To create a new key:

1. Open **Console → API Tokens**.
2. Select **Create API Key**.
3. Enter a token name.
4. Enable **Set Usage Limit** when needed.
5. Enter the maximum amount the key can consume.
6. Select **Confirm**.

<figure><img src="/files/fUsI2re9VmKPpuOtkSI1" alt=""><figcaption></figcaption></figure>

7. Copy and securely save the new key.

#### Choose a Clear Token Name

Use a name that identifies where the Token will be used.

Examples:

```
developmentproductionimage-generation
```

For multiple projects, consider:

```
project-environment-purpose
```

Example:

```
support-production-chat
```

***

### 💰 Set a Usage Limit

The optional usage limit controls how much one API Token can consume.

For example:

```
Wallet Balance:  $49
API Token Limit:    $5
```

Although the account has $49 available, that API key can consume only $5.

***

### Copy and Store Your API Token

Copy the key after creation and save it in a secure location.

The management table displays only a masked version of the Token.

```
430442******
```

If available, please use the copy button.

<figure><img src="/files/F9AWaEoCDSPHWGrhWOT5" alt=""><figcaption></figcaption></figure>

#### Store the Key in an Environment Variable

**macOS or Linux**

```bash
export APISMART_API_KEY="YOUR_API_KEY"
```

**Windows PowerShell**

```powershell
$env:APISMART_API_KEY="YOUR_API_KEY"
```

Do not store production keys directly in source code.

***

### Use Your API Token

ApiSmart uses Bearer authentication.

Include the key in the request header:

```http
Authorization: Bearer YOUR_API_KEY
```

#### Test the Key with cURL

```bash
curl https://gw.apismart.ai/v1/models \
  -H "Authorization: Bearer $APISMART_API_KEY"
```

A successful request should return an API response rather than an authentication error.

#### Chat Completions Example

After confirming that the Token works, see [**Chat Completions API**](/api-guides/chat-completions-api.md), [**Image Generation API**](/api-guides/image-generation-api.md), or [**Video Generation API**](/api-guides/video-generation-api.md) for complete request examples.

***

### Understand the API Token Table

The **API Token Management** table displays the following information:

<figure><img src="/files/7ZFbBRF8d5XqHYbmkGJj" alt=""><figcaption></figcaption></figure>

| Field                | Description                                            |
| -------------------- | ------------------------------------------------------ |
| **Name**             | Token name assigned during creation                    |
| **Key**              | Masked API Token value                                 |
| **Used / Remaining** | Consumed and remaining allowance under the usage limit |
| **Created At**       | Date and time the Token was created                    |
| **Status**           | Whether the Token is currently enabled or disabled     |
| **Code Integration** | Ready-to-copy authentication example                   |
| **Actions**          | Edit, Disable, or Delete the Token                     |

***

### Edit an API Token

Select **Edit** next to a Token to update its available settings.

<figure><img src="/files/PSUESYeQioxJXO9LlzBN" alt=""><figcaption></figcaption></figure>

Depending on the current dashboard options, you may be able to change:

* Token Name
* Usage Limit

Changing the Token Name does not change the actual Token value.

After updating the usage limit, check **Used / Remaining** to confirm the new allowance.

***

### Disable or Delete an API Token

Use **Disable** when a Token should no longer be allowed to make requests.

Use **Delete** when the Token is no longer required.

<figure><img src="/files/ubadgQqOf9SSCRhPamNu" alt=""><figcaption></figcaption></figure>

Before changing a Token used by an application, confirm that the application has been updated to use the correct replacement Token.

***

#### 🔐 API Token Security

* Keep API Tokens private.
* Store Tokens in environment variables or another secure server-side location.
* Never expose Tokens in public repositories or browser-side code.
* Disable a Token immediately if it may have been exposed.
* Review **Usage Logs** for unfamiliar activity.

For detailed security guidance, see [**Secure Your API Keys**](/api-tokens/secure-your-api-tokens.md).

***

### 🛠️ Troubleshoot API Key Problems

#### The API Token Is Not Working

Check that:

* The complete Token was copied
* The Token status is **Enabled**
* The Token has remaining allowance
* Your wallet has sufficient balance
* The API Base URL is correct
* The request uses Bearer authentication

```
Authorization: Bearer YOUR_API_KEY
```

***

#### The Account Has Balance, but Requests Still Fail

Wallet balance and API Token limits are separate controls.

Check:

* **Wallet → Current Balance**
* **API Tokens → Used / Remaining**
* Token status
* Model ID
* API endpoint
* Request format

***

#### I See Usage I Do Not Recognize

* Disable the affected API Token.
* Create a replacement Token.
* Update your application.
* Review **Console → Usage Logs**.
* Save unfamiliar Request IDs and contact support if needed.

> 🔐 Never provide your full API Token to support.

***

### 🚀 Next Steps

Continue with:

* [**API Basics**](/api-guides/api-basics.md)
* [**View Your Balance and Transaction Records**](/account-and-wallet/view-your-balance-and-transaction-records.md)
* [**Choose a Model and Find Its Model ID**](/models-and-pricing/models-and-model-ids.md)
* [**Quick Start**](/welcome-to-apismart/quick-start.md)
* [**Usage Logs and Costs**](/api-usage/usage-logs-and-costs.md)
