# unauthorized — Shorty API error

> Unauthorized (HTTP 401): when the Shorty API returns the unauthorized error, why, and how to fix it.

| Code | HTTP status | Type URI |
| --- | --- | --- |
| `unauthorized` | 401 | `https://aishorty.com/docs/api/errors/unauthorized` |

## When it happens

The request carried no credentials — a missing or empty `Authorization` header.

## Example response

```json
{
  "type": "https://aishorty.com/docs/api/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Missing Authorization header.",
  "instance": "urn:request:req_01J9Z8ABCDEFGH0123456789",
  "code": "unauthorized",
  "request_id": "req_01J9Z8ABCDEFGH0123456789"
}
```

## How to fix it

Send `Authorization: Bearer <key>` with a `shk_live_` API key (create one in Settings → API keys) or a valid OAuth 2.1 access token.

## Related errors

- [invalid_api_key](/docs/api/errors/invalid_api_key) — Invalid API key (HTTP 401)
- [insufficient_scope](/docs/api/errors/insufficient_scope) — Insufficient scope (HTTP 403)
