---
title: Authentication
description: Authenticate external requests with secret or origin-restricted public API keys.
---

## Supply an API key

Most catalog and recorded-change endpoints require a valid key. Supply one of these headers:

```http
X-API-Key: YOUR_API_KEY
```

```http
Authorization: Bearer YOUR_API_KEY
```

Bearer API keys must have an `icecoast_` prefix. If both an Icecoast bearer key and `X-API-Key` are supplied, the bearer key takes precedence. Invalid supplied keys do not fall through to another authentication method. Never place keys in query parameters.

## Secret keys

Secret keys start with `icecoast_sk_` and are intended for servers. When an IP allowlist is configured, the request IP must match a listed value. Keep secrets out of browsers, screenshots, logs and source control.

## Public keys

Public keys start with `icecoast_pk_`. Every request must match a configured allowed origin. The API checks the `Origin` header, falling back to `Referer` when `Origin` is absent. Missing origins, `Origin: null` and mismatched origins return 403.

Configure a full origin such as `https://example.com`. Matching respects scheme, host and port for explicit origins. Wildcards and substring matches are not supported. Existing bare-host entries match the same host/port over HTTP or HTTPS. Origin restrictions are browser integration controls; they do not make the key a server secret.

```js
// Browser example: this public key must allow the page's origin.
const response = await fetch('https://api.icecoast.us/api/v1/mountains?limit=5', {
  headers: { 'X-API-Key': 'YOUR_PUBLIC_API_KEY' },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const body = await response.json();
```

## Anonymous resources

The reference explicitly marks endpoints that need no API key: [verification status](/docs/reference/status/summary), [overview](/docs/reference/reports/overview), [geographic reads](/docs/reference/geography/combined) and [XML feeds](/docs/reference/feeds/directory). Anonymous does not mean unlimited: verification status has its own per-IP limit.

Signed-in sessions are used by Icecoast's application and panel. Use API keys for third-party integrations. Keys do not authorize administrative writes.

## Dataset export access

[Exports](/docs/reference/exports/catalog) have a deployment-specific mode: public mode permits anonymous reads; private mode requires a secret API key for external clients and rejects public keys. A supplied API key is still authenticated and metered even on a public-mode export request. Export access mode and service availability should be checked before depending on this resource.

## Failures

Missing/invalid/expired/revoked credentials return 401. Origin or IP denial returns 403. Verification outages can return 503. See [errors](/docs/concepts/errors) and [usage limits](/docs/concepts/usage).
