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

# API Keys

> Create and manage Paymint API keys for your application

## Overview

Paymint API keys authenticate your application with the Paymint SDK. You need at least one API key to use Paymint in your project.

<Info>
  Before creating API keys, make sure you've [connected your Paddle account](/guides/paddle-setup) first.
</Info>

***

## Creating an API Key

<Steps>
  <Step title="Navigate to API Keys">
    In the Paymint dashboard, go to **Settings → API Keys**.
  </Step>

  <Step title="Create a New Key">
    Click **New API key** and fill in:

    * **Name** — A descriptive name (e.g., "Production App", "Dev Server")
    * **Environment** — Sandbox or Production
    * **Description** (optional) — Notes about what this key is used for
  </Step>

  <Step title="Copy Your Key">
    Your full API key is shown **only once**. Copy it immediately and store it securely.

    <Warning>
      You won't be able to see the full key again after this step. If you lose it, you'll need to create a new one.
    </Warning>
  </Step>
</Steps>

***

## Security Best Practices

Follow these practices to keep your API keys secure:

| Practice                      | Details                                            |
| ----------------------------- | -------------------------------------------------- |
| **Use environment variables** | Store keys in `.env` files, never hardcode them    |
| **Separate environments**     | Use different keys for sandbox and production      |
| **Rotate regularly**          | Generate new keys periodically and revoke old ones |
| **Never expose client-side**  | API keys are for server-side use only              |
| **Add to .gitignore**         | Ensure `.env.local` and `.env` are gitignored      |

### Example `.env.local`

```bash theme={null}
# Paymint API Key (server-side only)
PAYMINT_API_KEY=paymint_test_xxxxx
```

<Tip>
  The SDK auto-detects sandbox vs production based on your API key prefix. No additional configuration needed!
</Tip>

***

## Key Environments

| Environment    | Key Prefix      | Use Case                |
| -------------- | --------------- | ----------------------- |
| **Sandbox**    | `paymint_test_` | Development and testing |
| **Production** | `paymint_live_` | Live application        |

***

## Managing Keys

From the **Settings → API Keys** page in the Paymint dashboard, you can:

* **View** all your keys with their status and last usage date
* **Revoke** keys that are no longer needed
* **Create** new keys for different environments or services

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Integration Example" icon="code" href="/guides/integration-example">
    Use your API key in a complete Next.js integration
  </Card>

  <Card title="Next.js SDK" icon="react" href="/sdks/nextjs">
    Full API reference for hooks and server utilities
  </Card>
</CardGroup>
