# Use a Stripe API key with Metronome

Authenticate Metronome API requests using your existing Stripe secret key.

Use your Stripe secret key to call the Metronome API. Your first request automatically creates a Metronome account linked to your Stripe account. You don’t need to sign up for Metronome separately or get another API token. [Learn how Metronome works with Stripe](https://docs.stripe.com/billing/how-metronome-works-with-stripe.md).

## Before you begin

- You need a [sandbox](https://docs.stripe.com/sandboxes.md) key.
- This setup only works for new Metronome accounts. If your company already has an account, [contact Metronome support](https://app.metronome.com/support) before using a Stripe secret key.

## Choose a sandbox key

Use a sandbox secret key to make requests to the Metronome sandbox.

| Key | Metronome environment | Access |
| --- | --- | --- |
| Sandbox secret key (`sk_test_...`) | Sandbox | Full API access |
| Live secret key (`sk_live_...`) | Production | Restricted until you go live |

[Restricted API keys](https://docs.stripe.com/keys/restricted-api-keys.md) (`rk_test_...`, `rk_live_...`) aren’t supported.

## Make a request

Pass your secret key as a bearer token. This request [lists customers](https://docs.metronome.com/api-reference/customers/list-customers) in the Metronome sandbox.

```bash
curl https://api.metronome.com/v1/customers -H "Authorization: Bearer $STRIPE_SECRET_KEY"
```

Store your secret key in an environment variable or secrets manager, not in code. See [best practices for managing secret keys](https://docs.stripe.com/keys-best-practices.md).

On the first request, Metronome creates the account and returns an empty list.

```json
{"data": [], "next_page": null}
```

Use the same header for any endpoint in the [Metronome API reference](https://docs.metronome.com/api-reference/introduction), such as [create a customer](https://docs.metronome.com/api-reference/customers/create-a-customer) or [ingest usage events](https://docs.metronome.com/api-reference/usage/ingest-events).

## Go live

You can start testing in the sandbox right away. When you’re ready to use Metronome in production:

1. Open the [Metronome app in the Stripe Dashboard](https://dashboard.stripe.com/app/com.metronome.stripe).
2. Follow the go-live flow to choose a plan and activate your account.
3. Use your live secret key for production requests.

Before activation, you can use your live secret key to list customers in production, but all other production requests return a `403` error.

Using your Stripe secret key automatically creates a Metronome account associated with your Stripe account. Next, configure your pricing, customers, usage reporting, and payment collection to complete your billing integration. Follow [Set up Metronome with Stripe](https://docs.stripe.com/billing/set-up-metronome-with-stripe.md), and skip the account creation step because your Metronome account already exists.

## See also

- [Set up Metronome with Stripe](https://docs.stripe.com/billing/set-up-metronome-with-stripe.md)
- [Metronome invoice and payment reference](https://docs.stripe.com/billing/metronome-invoice-payment-reference.md)
- [Metronome API reference](https://docs.metronome.com/api-reference/introduction)
