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

# API Keys

> Manage publishable and secret API keys for your Immutable project

## Key Types

| Key Type            | Use Case                       | Security       | Example Usage                     |
| ------------------- | ------------------------------ | -------------- | --------------------------------- |
| **Publishable Key** | Client-side SDK initialization | Safe to expose | Browser apps, game clients        |
| **Secret Key**      | Server-side operations         | Keep private   | Backend minting, admin operations |

## Publishable Key

```typescript theme={null}
import { Environment } from '@imtbl/config';

const baseConfig = {
  environment: Environment.SANDBOX,
  publishableKey: 'pk_imapik-your-publishable-key',
};
```

**Use for:**

* SDK initialization
* Client-side API calls
* [Passport](/docs/products/passport/overview) authentication

## Secret Key

```typescript theme={null}
// Server-side only
const headers = {
  'x-immutable-api-key': process.env.IMX_SECRET_KEY,
};

const response = await fetch('https://api.immutable.com/v1/mint', {
  method: 'POST',
  headers,
  body: JSON.stringify(mintRequest),
});
```

**Use for:**

* Minting NFTs
* Admin operations
* Webhook verification
* Any operation that modifies on-chain state

<Warning>
  Never expose your Secret API Key in:

  * Client-side JavaScript/TypeScript
  * Mobile app code
  * Public Git repositories
  * Browser developer tools

  Use environment variables on your server.
</Warning>

## Key Rotation

Rotate keys in [Hub](https://hub.immutable.com): **Settings** → **API Keys** → **Rotate Key**

<Warning>
  Old key invalidates immediately
</Warning>

<Tip>
  Rotate immediately if exposed
</Tip>

## Environment-Specific Keys

Each environment has its own keys:

| Environment | Publishable Key Prefix  | Chain                   |
| ----------- | ----------------------- | ----------------------- |
| Sandbox     | `pk_imapik-sandbox-...` | Immutable zkEVM Testnet |
| Production  | `pk_imapik-...`         | Immutable zkEVM Mainnet |

## Next Steps

<CardGroup cols={2}>
  <Card title="Getting Started" icon="rocket" href="/docs/products/hub/getting-started">
    Complete Hub setup guide
  </Card>

  <Card title="Backend Minting" icon="coins" href="/docs/products/asset-contracts/minting-api">
    Use your secret key for minting
  </Card>
</CardGroup>
