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

# Authentication

> Securely authenticate API requests using Bearer token authentication with API keys.

The Givebutter API uses **Bearer token authentication** to secure all API requests. All requests must be made over HTTPS.

## Quick Start

Include your API key in the `Authorization` header of every request:

```bash cURL theme={null}
curl https://api.givebutter.com/v1/campaigns \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```javascript Node.js / JavaScript theme={null}
const response = await fetch('https://api.givebutter.com/v1/campaigns', {
  headers: {
    Authorization: 'Bearer YOUR_API_KEY',
  },
});
```

```python Python theme={null}
import requests

headers = {'Authorization': 'Bearer YOUR_API_KEY'}
response = requests.get('https://api.givebutter.com/v1/campaigns', headers=headers)
```

```php PHP theme={null}
$ch = curl_init('https://api.givebutter.com/v1/campaigns');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY'
]);
$response = curl_exec($ch);
```

```ruby Ruby theme={null}
require 'net/http'

uri = URI('https://api.givebutter.com/v1/campaigns')
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer YOUR_API_KEY'

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end
```

```go Go theme={null}
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.givebutter.com/v1/campaigns", nil)
req.Header.Add("Authorization", "Bearer YOUR_API_KEY")

resp, err := client.Do(req)
```

```java Java theme={null}
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.givebutter.com/v1/campaigns"))
    .header("Authorization", "Bearer YOUR_API_KEY")
    .build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
```

## Getting Your API Key

1. Go to **Settings** → **Integrations** → **API Keys** in your [Givebutter Dashboard](https://givebutter.com/dashboard)
2. Click **Create New API Key** and give it a name
3. Copy your API key immediately and store it securely

> [!WARNING]
>
> Your API key is shown only once. Never share it or commit it to version control.

## Authentication Errors

### 401 Unauthorized

Your API key is missing, invalid, or revoked.

```json theme={null}
{
  "message": "Unauthenticated."
}
```

**Common causes:**

* API key is missing from the request
* API key is incorrect or has typos
* API key has been revoked
* Using `Authorization: YOUR_API_KEY` instead of `Authorization: Bearer YOUR_API_KEY`

### 403 Forbidden

Your API key is valid but lacks permission for this resource.

```json theme={null}
{
  "message": "This action is unauthorized."
}
```

**Common causes:**

* API key has restricted permissions
* Trying to access another organization's data
* Resource has been archived or deleted


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