# Authentication

All BlueGamma API requests require authentication using an API key provided by our team.

***

### Getting an API Key

API keys are issued by the BlueGamma team. To request access:

1. **Contact us** at <support@bluegamma.io>
2. **Book a demo** at [bluegamma.io](https://app.lemcal.com/@alivohra/website-demo?back=1)

We'll set you up with a key and help you get started quickly.

***

### 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 — check your `x-api-key` header                              |
| `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: 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://bluegamma.io/documentation/integrations/api/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.
