# Authentication

> Account sessions for the management API and project keys for the data APIs.

Source: https://daster.io/docs/api/authentication/ · Last updated: 2026-11-21

DASTER has two separate kinds of credentials. Keep them apart.

## Account sessions (management API)

The management API under `/v1` is authenticated with your DASTER account session.

- Signing in (`POST /v1/account/signin`) sets an HttpOnly session cookie. Browser code never stores a bearer token.
- Every change (any method other than GET) needs the exact Dashboard origin and the `X-Daster-Csrf` header. Before sign-in the header marks an application entry; after sign-in, use the `csrf` value from `GET /v1/account`.
- Sessions end when you sign out, sign out everywhere, reset your password or sign in again on the same browser.

```http
GET /v1/account
```

```json
{ "data": { "userId": "…", "email": "you@example.com", "csrf": "…" } }
```

### Recent sign-in

Sensitive actions need a sign-in within the last 10 minutes and usually `"confirmed": true` in the body: changing project keys, rollbacks, stopping or deleting a service, removing previews, restoring a backup, network restrictions and passkey changes. Otherwise the API refuses with `fresh_confirmation_required`. Sign in again and retry.

## Project keys (data APIs)

Your app uses [project keys](https://daster.io/docs/getting-started/project-keys/) on the data APIs.

| Key                         | How to send it                                               | What it allows                                                                   |
| --------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------- |
| Browser key `daster_pk_…`   | `apikey: daster_pk_…`                                        | Admits requests; row access comes from your policies. Cannot send email or push. |
| Server key `daster_sk_…`    | `apikey: daster_sk_…` or `Authorization: Bearer daster_sk_…` | The project's owner authority on Backend Cloud; sending and reading App email    |
| App email key `daster_sk_…` | `Authorization: Bearer daster_sk_…`                          | Sending email with the scopes it was made with; also the SMTP password           |

A signed-in user of your app adds `Authorization: Bearer <user access token>` next to the `apikey`.

A key of another project or environment, a revoked key, or a retiring key past its overlap answers `401 unauthenticated`, the same as an unknown key. A key without the needed scope answers `403 forbidden`.

> **Warning:** The server key bypasses your row-level security policies. Keep it on your server.

Older `pk_`, `sk_` and `daster_comm_` keys keep working.
