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

# Authentication

> Authenticate with Salesforge public APIs using an API key in the Authorization header.

Salesforge public APIs use API key authentication.

Send the raw API key in the `Authorization` header. Do not add a `Bearer ` prefix.

```http theme={null}
Authorization: YOUR_API_KEY
```

> [!WARNING]
>
> Bearer authentication and API key authentication are different. Adding
> `Bearer ` changes the header value and causes Salesforge requests to fail.

## How authentication works

1. Generate a Salesforge API key for the account or workspace you are integrating.
2. Send the raw key in the `Authorization` header on every request.
3. Handle standard auth failures such as missing, invalid, or out-of-scope keys.

Multichannel public endpoints accept both the raw key and the Bearer format.
Use the raw key because it works with both Salesforge and Multichannel endpoints.

## Request examples

The following examples use the raw Salesforge API key.

```bash theme={null}
curl -sS "$SALESFORGE_API_BASE_URL/your-endpoint" \
  -H "Authorization: $SALESFORGE_API_KEY"
```

```javascript theme={null}
const response = await fetch(`${process.env.SALESFORGE_API_BASE_URL}/your-endpoint`, {
  headers: {
    Authorization: process.env.SALESFORGE_API_KEY
  }
});

console.log(await response.json());
```

```go theme={null}
package main

import (
  "net/http"
  "os"
)

func main() {
  req, _ := http.NewRequest(
    http.MethodGet,
    os.Getenv("SALESFORGE_API_BASE_URL")+"/your-endpoint",
    nil,
  )
  req.Header.Set("Authorization", os.Getenv("SALESFORGE_API_KEY"))

  _, _ = http.DefaultClient.Do(req)
}
```

## Common authentication errors

| HTTP status | Typical reason |
| - | - |
| 401 | Missing or invalid API key |
| 403 | API key is valid but does not have access to the requested resource |

## Next steps

* Apply [Security best practices](https://developers.calendio.ai/authentication/security-best-practices.md).


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