> ## 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](https://docs.immutable.com/docs/products/passport/overview.md) 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.

## Key Rotation

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

> [!WARNING]
>
> Old key invalidates immediately

> [!TIP]
>
> Rotate immediately if exposed

## 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

> [card] [Passport Clients](https://docs.immutable.com/docs/products/passport/clients.md)
>
> Configure authentication clients

> [card] [Team Management](https://docs.immutable.com/docs/guides/advanced-setup/team-management.md)
>
> Invite members and manage roles

> [card] [Backend Minting](https://docs.immutable.com/docs/products/asset-contracts/minting-api.md)
>
> Use your secret key for minting


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