> For the complete documentation index, see [llms.txt](https://bluegamma.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bluegamma.io/documentation/integrations/api/authentication.md).

# Authentication

All BlueGamma API requests are authenticated with an API key that you issue yourself from the app.

***

### Getting an API Key

You issue your own key. There is no form and no waiting:

1. Sign in at [app.bluegamma.io](https://app.bluegamma.io)
2. Open **API Keys** in the sidebar, under Developer
3. Click **Create API key**

The key is shown once, when it is created, so copy it before you leave the page. The same page has a ready-made request you can copy and run.

Trial accounts can issue a key too. A trial key returns live data on every index for 14 days — see [Trials and Billing](/documentation/account-and-team-management/trials-and-billing.md) for what changes when you pick a plan.

***

### Using Your API Key

Include your API key in the `x-api-key` header with every request:

```bash
curl -X GET "https://api.bluegamma.io/v1/swap_rate?index=SOFR&start_date=0D&maturity_date=5Y&fixed_leg_frequency=6M" \
  -H "x-api-key: your_api_key_here"
```

***

### Example Requests

**Python:**

```python
import requests

headers = {
    "x-api-key": "your_api_key_here"
}

response = requests.get(
    "https://api.bluegamma.io/v1/swap_rate",
    params={"index": "SOFR", "start_date": "0D", "maturity_date": "5Y", "fixed_leg_frequency": "6M"},
    headers=headers
)

print(response.json())
```

**JavaScript:**

```javascript
const response = await fetch(
  "https://api.bluegamma.io/v1/swap_rate?index=SOFR&start_date=0D&maturity_date=5Y&fixed_leg_frequency=6M",
  {
    headers: {
      "x-api-key": "your_api_key_here"
    }
  }
);

const data = await response.json();
console.log(data);
```

***

### Error Responses

| Status Code | Meaning                                                                                                                                    |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `403`       | Missing or invalid API key, an expired trial key, or a request your key is not allowed to make — read the `detail` field, which says which |
| `429`       | Rate limit exceeded — see [Rate Limits](/documentation/integrations/api/rate-limits.md)                                                    |

***

### Security Best Practices

* **Keep your API key secret** — Don't commit it to version control or expose it in client-side code
* **Use environment variables** — Store your key in environment variables rather than hardcoding
* **Rotate if compromised** — Contact us immediately if you suspect your key has been exposed

```bash
# Store in environment variable
export BLUEGAMMA_API_KEY="your_api_key_here"
```

```python
import os

api_key = os.environ.get("BLUEGAMMA_API_KEY")
```

***

### Need Help?

If you're having trouble authenticating or need a new API key:

* **Email:** <support@bluegamma.io>
* **Book a call:** [Schedule here](https://app.lemcal.com/@alivohra/website-demo?back=1)


---

# 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://bluegamma.io/documentation/integrations/api/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.
