> For the complete documentation index, see [llms.txt](https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/getting-started/authentication.md).

# Authentication

Black Sheep uses **bearer API keys** for server-to-server requests and **email + Sign-in-with-Solana** for dashboard users.

## API keys

Every REST call and SDK call authenticates with:

```
Authorization: Bearer bs_live_...
```

### Creating a key

1. Open **Dashboard → Developers**.
2. Click **Create key**, give it a label (e.g. `research-bot prod`).
3. Copy the key. **It is shown once.** If you lose it, rotate it.

### Scoping

Each key is scoped to the **account** that created it. A key can read and act on every agent wallet in that account. If you need isolation between products, create separate accounts.

### Rotation

In **Dashboard → Developers**, click **Rotate** on the key. The old value stops working immediately. Deploy the new value before rotating in production.

### Storage

* **Never** commit keys to git.
* Store in your platform's secret manager (Vercel env, AWS Secrets Manager, Cloud Run, Doppler, etc.).
* Never put `BS_API_KEY` in a `VITE_*` variable or any client-bundled code — the key would leak to the browser.

## Dashboard authentication

The dashboard supports:

* Email + password
* Google OAuth
* **Sign-in-with-Solana** (SIWS) — connect a wallet, sign a challenge, no password

Sessions use httpOnly cookies and rotate on refresh.

## Webhooks

Webhooks are authenticated in the **opposite** direction — Black Sheep proves to *you* that the call is genuine by signing the body with HMAC-SHA256 using your endpoint secret. See [Signature verification](/black-sheep-finance-docs/webhooks/signatures.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/getting-started/authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
