> 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

Learn how to create, manage, disable, and replace ApiSmart API Keys for secure API authentication.

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="https://3886476465-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9rNjqyBvjfy7u1IjU03v%2Fuploads%2FNRBeujr50v6XkfW5cxNL%2F%E5%B1%80%E9%83%A8%E6%88%AA%E5%8F%96_20260723_131649.png?alt=media&amp;token=e6570e0c-ed32-45dc-afbc-f9fe8c451d96" 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="https://3886476465-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9rNjqyBvjfy7u1IjU03v%2Fuploads%2F147Zuc1xEYcGksl0PvII%2F%E5%B1%80%E9%83%A8%E6%88%AA%E5%8F%96_20260723_132146.png?alt=media&amp;token=c29464a5-aa1f-437a-a193-a7f920128d0d" 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="https://3886476465-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9rNjqyBvjfy7u1IjU03v%2Fuploads%2FwVnXDuUJ0bXjSpV12bXP%2F%E5%B1%80%E9%83%A8%E6%88%AA%E5%8F%96_20260723_133618.png?alt=media&amp;token=1fc8d57b-5c6d-4a83-9cad-5d3dbb042cef" 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**](https://docs.apismart.ai/api-guides/chat-completions-api.md), [**Image Generation API**](https://docs.apismart.ai/api-guides/image-generation-api.md), or [**Video Generation API**](https://docs.apismart.ai/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="https://3886476465-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9rNjqyBvjfy7u1IjU03v%2Fuploads%2FH5aTH7CIiK0Bq8XqrSgv%2F%E5%B1%80%E9%83%A8%E6%88%AA%E5%8F%96_20260723_135653.png?alt=media&amp;token=35425ede-96d2-43e7-a458-078cbaaf04b3" 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="https://3886476465-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9rNjqyBvjfy7u1IjU03v%2Fuploads%2Fjn9w3i8kSzPN6bFIpd0S%2F%E5%B1%80%E9%83%A8%E6%88%AA%E5%8F%96_20260723_135824.png?alt=media&amp;token=5c6133a8-3d1a-4b07-a8fe-7b30e58b5446" 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="https://3886476465-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9rNjqyBvjfy7u1IjU03v%2Fuploads%2FFqpBrbf3DNXT1Nu4Oqkz%2F%E5%B1%80%E9%83%A8%E6%88%AA%E5%8F%96_20260725_154014.png?alt=media&amp;token=0bafb41a-9619-433a-b312-4f710211030e" 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**](https://docs.apismart.ai/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**](https://docs.apismart.ai/api-guides/api-basics.md)
* [**View Your Balance and Transaction Records**](https://docs.apismart.ai/account-and-wallet/view-your-balance-and-transaction-records.md)
* [**Choose a Model and Find Its Model ID**](https://docs.apismart.ai/models-and-pricing/models-and-model-ids.md)
* [**Quick Start**](https://docs.apismart.ai/welcome-to-apismart/quick-start.md)
* [**Usage Logs and Costs**](https://docs.apismart.ai/api-usage/usage-logs-and-costs.md)
