# Authentication

> The Parklio API authenticates every request with a bearer token. Integrations use an
> **API token**: you create it **once**, while logged in as your account's **Super Admin**,
> and then send it on every request.

## 1. Log in once, as the Super Admin

Only a Super Admin user can create API tokens. Log in with the Super Admin's email and
password (see [Account Setup](/get-started/what-you-need) if you don't have them
yet) using [`POST /v2/auth/login`](/api/endpoints/auth-login):

```bash title="Log in (one time)"
curl -X POST https://api.parklio.com/v2/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "admin@example.com", "password": "<your-password>"}'
```

The response's `data.token` is a **user token**. Use it only for the next step.

:::danger Never log in with a person's credentials at runtime
Logging in deletes that user's other tokens of the same kind. If your integration logs
in "as" someone who uses the Parklio Connect app, it logs them out of the app. Log in
once, by hand, to create an API token, and let your integration use only the API token.
:::

## 2. Create an API token

Using the user token from step 1, call
[`POST /v2/api-tokens`](/api/endpoints/api-token-create). `name` is a label for you,
3–255 characters.

```bash title="Create an API token"
curl -X POST https://api.parklio.com/v2/api-tokens \
  -H "Authorization: Bearer <user-token-from-login>" \
  -H "Content-Type: application/json" \
  -d '{"name": "my-integration"}'
```

```json title="Response"
{
  "success": true,
  "data": {
    "id": 7,
    "name": "my-integration",
    "account_id": 42,
    "created_at": "2026-01-15T09:30:00.000Z",
    "updated_at": "2026-01-15T09:30:00.000Z",
    "token": "<your-api-token>"
  }
}
```

:::warning Save the token now
The `token` field is shown **only in this response**; Parklio stores only a hash of it.
API tokens **don't expire** and have no scopes. Treat the token like a password, and keep
it on your server. Creating a new token doesn't invalidate old ones, so revoke the ones
you no longer use with [`DELETE /v2/api-tokens/{id}`](/api/endpoints/api-token-remove).
:::

An API token can't create other API tokens; only a Super Admin's user token can.

## 3. Call the API

Send the API token as a bearer token on every request:

```bash title="Call the API"
curl https://api.parklio.com/v2/products/123 \
  -H "Authorization: Bearer $PARKLIO_API_TOKEN"
```

Requests made with an API token act as your account's **first Super Admin**, so they see
the lots that Super Admin is assigned to.

## Realtime uses the same token

To receive realtime events, pass the same API token in the Socket.IO handshake query
(`?token=`). See [Connecting](/realtime/connecting).

## Next step

See [Errors](/api/errors) for how failures are shaped, the [API Reference](/api) for the
endpoints, or [Connecting](/realtime/connecting) to receive realtime events.
