> ## Documentation Index
> Fetch the complete documentation index at: https://partners.usehammock.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Authenticate with a secret API key as a bearer token.

Every request carries a secret API key in the `Authorization` header.

```bash theme={null}
curl https://api.usehammock.co/employers \
  -H "Authorization: Bearer hmk_live_..."
```

| Key prefix | Environment | Base URL |
| - | - | - |
| `hmk_live_` | Live | `https://api.usehammock.co` |
| `hmk_test_` | Sandbox | `https://api.sandbox.usehammock.co` |

A key identifies you as a partner and gives access to every employer you created. There are no
per-employer keys: you say which employer a request is about with the `employer` parameter.

## Keeping keys safe

* Keys are secret. Use them only from your servers, never in a browser or mobile app.
* All requests must use HTTPS. Requests over plain HTTP fail.
* A key is shown once, when it's issued. Hammock stores only a hash and can't show it again.

During the preview, Hammock issues and rotates keys for you. To rotate, ask for a new key, deploy
it, then ask us to revoke the old one. Both work in the meantime.

## Errors

A request with a missing, malformed or revoked key returns `401`:

```json theme={null}
{
  "error": {
    "type": "invalid_request_error",
    "code": "api_key_invalid",
    "message": "Invalid API key provided.",
    "doc_url": "https://docs.usehammock.co/api/errors#api_key_invalid",
    "request_id": "req_9Kd2Lm5nPq8R"
  }
}
```

Asking for an object that belongs to another partner returns `404` with `resource_missing`, the
same as an object that doesn't exist.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.