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

# Authentication

> Secret API keys for the Cesto Server SDK.

The Server SDK authenticates with a **secret API key**. Keys look like `cesto_sk_…` and are
sent automatically with every request — you never set headers yourself.

> [!NOTE]
>
> Looking for the browser key? The [Web SDK](https://docs.cesto.co/web-sdk/overview.md) uses a **publishable**
> `cesto_pk_…` key instead, which is safe to ship in client code. Both are covered side by
> side in [API keys](https://docs.cesto.co/developers/api-keys.md).

## Getting a key

> [!NOTE]
>
> API keys are issued by the Cesto team — there's no self-serve portal yet.
>
> **Contact us to request a key:** reach out on our
> [community](https://t.me/cesto_co) or through your Cesto contact.

## Providing the key

Pass it explicitly to the constructor — typically from an environment variable:

```ts theme={null}
const cesto = new Cesto({ apiKey: process.env.CESTO_API_KEY });
```

The SDK does **not** read environment variables itself — `apiKey` is required, and the
constructor throws without it.

## Key scopes

Keys are **read** (default) or **write**-scoped:

* **Read** covers products, user lookups, and position reads (`products.*`, `users.get`,
  `positions.list`, `positions.getHoldings`).
* **Write** is required for [provisioning and managed executions](https://docs.cesto.co/sdk/managed-wallets.md)
  (`users.create`, `*.start`) and for client-signed
  [opening](https://docs.cesto.co/sdk/open-position.md) and [closing](https://docs.cesto.co/sdk/close-position.md) positions
  (`open.*`, `close.*`, `positions.submit`, execution polling). A read-only key gets a
  `403 PermissionDeniedError` on write routes.

Ask for the scope you need when requesting a key.

## Backend

The SDK always targets the Cesto production backend at `https://backend.cesto.co`. There's
nothing to configure — you supply a key and go.

## Keep your key safe

> [!WARNING]
>
> Treat the key like a password — keep it server-side, store it in a secret manager or
> environment variable, and never commit it to source control. To rotate or revoke a key,
> contact the Cesto team.


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