---
title: "401 Unauthorized"
description: "QuotaStack did not accept your API key, so it did not run the call."
---

# 401 Unauthorized

`https://api.quotastack.io/errors/unauthorized`

QuotaStack did not accept your API key, so it did not run the call.

## Why it happened

- The `Authorization` header was missing.
- The key was revoked, or it was typed wrong.
- You sent a dashboard session where the call wants an API key.

## How to fix it

1. Send `Authorization: Bearer <your key>`.
2. Check the key is still live in the [dashboard](https://platform.quotastack.io).
3. Remember that a sandbox key and a live key are two different keys.

### Example response 401

```json
{
  "type": "https://api.quotastack.io/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Missing or invalid API key."
}
```

## Which calls return this

- [`GET /v1/customers`](/docs/api/customers#listCustomers)
- [`POST /v1/customers`](/docs/api/customers#createCustomer)
- [`GET /v1/customers/{id}`](/docs/api/customers#getCustomer)
- [`PATCH /v1/customers/{id}`](/docs/api/customers#updateCustomer)
- [`DELETE /v1/customers/{id}`](/docs/api/customers#deleteCustomer)
- [`GET /v1/customer-by-external-id/{external_id}`](/docs/api/customers#getCustomerByExternalId)
- [`PATCH /v1/customer-by-external-id/{external_id}`](/docs/api/customers#updateCustomerByExternalId)
- [`DELETE /v1/customer-by-external-id/{external_id}`](/docs/api/customers#deleteCustomerByExternalId)
- [`GET /v1/customers/{customer_id}/credits`](/docs/api/credits#getCustomerCredits)
- [`POST /v1/customers/{customer_id}/credits/grant`](/docs/api/credits#grantCustomerCredits)
- [`POST /v1/customers/{customer_id}/credits/adjust`](/docs/api/credits#adjustCustomerCredits)
- [`GET /v1/customers/{customer_id}/credits/history`](/docs/api/credits#listCustomerCreditsHistory)
- [`GET /v1/customers/{customer_id}/overage`](/docs/api/credits#getCustomerOverage)
- [`GET /v1/customer-by-external-id/{external_id}/credits`](/docs/api/credits#getCustomerCreditsByExternalId)
- [`POST /v1/customer-by-external-id/{external_id}/credits/grant`](/docs/api/credits#grantCustomerCreditsByExternalId)
- [`POST /v1/customer-by-external-id/{external_id}/credits/adjust`](/docs/api/credits#adjustCustomerCreditsByExternalId)
- [`GET /v1/customer-by-external-id/{external_id}/credits/history`](/docs/api/credits#listCustomerCreditsHistoryByExternalId)
- [`GET /v1/customer-by-external-id/{external_id}/overage`](/docs/api/credits#getCustomerOverageByExternalId)
- [`GET /v1/entitlements/check`](/docs/api/entitlements#checkEntitlement)
- [`GET /v1/customers/{id}/entitlements/{metric}`](/docs/api/entitlements#checkCustomerEntitlement)
- [`GET /v1/customers/{id}/entitlements`](/docs/api/entitlements#getCustomerEntitlements)
- [`GET /v1/customer-by-external-id/{external_id}/entitlements/{metric}`](/docs/api/entitlements#checkCustomerEntitlementByExternalId)
- [`GET /v1/customer-by-external-id/{external_id}/entitlements`](/docs/api/entitlements#getCustomerEntitlementsByExternalId)
- [`POST /v1/customers/{id}/entitlements/{billable_metric_key}/increment`](/docs/api/entitlements#incrementGauge)
- [`POST /v1/customers/{id}/entitlements/{billable_metric_key}/decrement`](/docs/api/entitlements#decrementGauge)
- [`POST /v1/entitlements/consume`](/docs/api/entitlements#consumeEntitlement)
- [`POST /v1/customer-by-external-id/{external_id}/entitlements/{billable_metric_key}/increment`](/docs/api/entitlements#incrementGaugeByExternalId)
- [`POST /v1/customer-by-external-id/{external_id}/entitlements/{billable_metric_key}/decrement`](/docs/api/entitlements#decrementGaugeByExternalId)
- [`POST /v1/usage`](/docs/api/usage#recordUsage)
- [`POST /v1/usage/batch`](/docs/api/usage#recordUsageBatch)
- [`POST /v1/imports/customers`](/docs/api/imports#importCustomer)
- [`POST /v1/subscriptions`](/docs/api/subscriptions#createSubscription)
- [`GET /v1/subscriptions/{id}/overrides`](/docs/api/overrides#listOverrides)
- [`POST /v1/subscriptions/{id}/overrides`](/docs/api/overrides#createOverride)
- [`PATCH /v1/subscriptions/{id}/overrides/{billable_metric_key}`](/docs/api/overrides#updateOverride)
- [`DELETE /v1/subscriptions/{id}/overrides/{billable_metric_key}`](/docs/api/overrides#deleteOverride)
- [`GET /v1/audit-log`](/docs/api/audit-log#listAuditLog)
- [`GET /v1/admin/api-keys`](/docs/api/account#adminListAPIKeys)
- [`GET /v1/admin/tenants/{tenant_id}/config`](/docs/api/account#adminGetTenantConfig)
- [`PATCH /v1/admin/tenants/{tenant_id}/config`](/docs/api/account#adminUpdateTenantConfig)
- [`POST /v1/admin/tenants/{tenant_id}/webhook-secret/rotate`](/docs/api/account#adminRotateWebhookSecret)

## See also

- [API conventions](/docs/concepts/conventions)
