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

# Getting started

Welcome to the BaClique Developer API. This guide will help you integrate BaClique's affiliate tracking into your application.

## Prerequisites

* A **PRO plan** subscription
* Access to your BaClique dashboard

## Quick Start (5 minutes)

### 1. Generate an API Key

1. Go to your [Developer Settings](https://baclique.com/creator/dashboard/developer)
2. Click "Create API Key"
3. Give it a name (e.g., "Production")
4. **Copy the key immediately** - you won't see it again!

Your API key looks like: `sk_live_example123456789`

### 2. Make Your First Request

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.baclique.com/v1/campaigns \
    -H "Authorization: Bearer sk_live_YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  fetch('https://api.baclique.com/v1/campaigns', {
    headers: {
      'Authorization': 'Bearer sk_live_YOUR_API_KEY'
    }
  })
  .then(response => response.json())
  .then(data => console.log(data));
  ```
</CodeGroup>

Response:

```json theme={null}
{
  "campaigns": [
    // Returns an empty array "[]" if you haven't created any campaigns yet
    {
      "id": "cmp_abc123",
      "name": "Summer Sale",
      "status": "active",
      "type": "CPA",
      "commission_type": "percentage",
      "commission_value": 10,
      "target_url": "https://example.com/summer",
      "created_at": "2024-01-15T10:30:00.000Z"
    }
  ],
  "pagination": {
    "limit": 50,
    "offset": 0,
    "total": 1
  }
}
```

### 3. Track a Conversion

When a user completes an action (sale, signup, lead, etc.) in your system:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.baclique.com/v1/conversions \
    -H "Authorization: Bearer sk_live_YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "campaign_id": "cmp_abc123",
      "affiliate_code": "summer-x7k2",
      "external_id": "ORDER-12345",
      "amount": 99.99,
      "currency": "EUR"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.baclique.com/v1/conversions', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer sk_live_YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      campaign_id: 'cmp_abc123',
      affiliate_code: 'summer-x7k2',
      external_id: 'ORDER-12345',
      amount: 99.99,
      currency: 'EUR'
    })
  });

  const data = await response.json();
  console.log(data);
  ```
</CodeGroup>

That's it! You're now tracking conversions via the API.

***

## Base URL

All API requests should be made to:

```
https://api.baclique.com/v1
```

## Authentication

Include your API key in every request:

```
Authorization: Bearer sk_live_YOUR_API_KEY
```

## Rate Limits

* **100 requests per minute** per API key
* Exceeding this returns `429 Too Many Requests`

## Response Format

All responses are JSON with this structure:

**Success:**

```json theme={null}
{
  "campaigns": [...],
  "pagination": { "limit": 50, "offset": 0, "total": 120 }
}
```

**Error:**

```json theme={null}
{
  "error": "Campaign not found"
}
```

## HTTP Status Codes

| Code | Meaning                                   |
| ---- | ----------------------------------------- |
| 200  | Success                                   |
| 400  | Bad Request - Invalid parameters          |
| 401  | Unauthorized - Invalid or missing API key |
| 403  | Forbidden - PRO plan required             |
| 404  | Not Found - Resource doesn't exist        |
| 429  | Too Many Requests - Rate limit exceeded   |
| 500  | Server Error                              |

***

## Next Steps

* [Authentication Guide](/api-reference/authentication) - Deep dive into API security
* [Campaigns API](/api-reference/campaigns) - Manage your affiliate campaigns
* [Affiliates API](/api-reference/affiliates) - Manage affiliates
* [Conversions API](/api-reference/conversions) - Track and list conversions
* [Webhooks](/api-reference/webhooks) - Real-time event notifications
