# Authentication

Use a workspace API key to authenticate requests to the public Fetch Hive API.

## Authentication header

Send your API key in the `Authorization` header on every request:

```bash
Authorization: Bearer YOUR_API_KEY
```

Fetch Hive uses the same bearer header for public invoke endpoints and public resource endpoints.

## How do I create an API key? <a href="#create-api-key" id="create-api-key"></a>

Open **Settings**, then click **API Keys**.

If your workspace does not have a default key yet, click **Create Default Key**.

If you want another key for a specific service or environment, click **Add API Key**.

Choose the environment you want to use:

* **Production**
* **Staging**
* **Development**

Copy the full key when Fetch Hive shows **Your New API Key**. After that dialog closes, Fetch Hive usually only shows the key prefix.

## Example request

```bash
curl 'https://api.fetchhive.com/v1/invoke' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  --data-raw '{
    "deployment": "YOUR_DEPLOYMENT_NAME",
    "variant": "YOUR_VARIANT_NAME",
    "inputs": {
      "text": "Fetch Hive helps teams ship AI products faster."
    },
    "streaming": true
  }' \
  --compressed
```

## What happens when authentication fails?

If the API key is missing, invalid, or revoked, Fetch Hive returns an error response.

```json
{
  "error": "Invalid access."
}
```

See [Errors and rate limits](https://docs.fetchhive.com/api-reference/errors-and-rate-limits) for common status codes and error shapes. For API key management in the dashboard, see [API keys](https://docs.fetchhive.com/your-workspace/api-keys).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fetchhive.com/api-reference/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
