Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/campaigns | List all campaigns |
| GET | /v1/campaigns/:id | Get a campaign |
| POST | /v1/campaigns | Create a campaign |
| PATCH | /v1/campaigns/:id | Update a campaign |
| DELETE | /v1/campaigns/:id | Archive a campaign |
List Campaigns
GET /v1/campaigns
Query Parameters
| Param | Type | Default | Description |
|---|---|---|---|
| status | string | - | Filter by status: active, paused, archived |
| limit | number | 50 | Results per page (max 100) |
| offset | number | 0 | Pagination offset |
Response
{
"campaigns": [
{
"id": "cmp_abc123",
"name": "Summer Sale 2024",
"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": 3
}
}
Get Campaign
GET /v1/campaigns/:id
Response
{
"campaign": {
"id": "cmp_abc123",
"name": "Summer Sale 2024",
"slug": "summer-sale-2024-x7k2",
"target_url": "https://example.com/summer",
"type": "CPA",
"status": "active",
"commission_type": "percentage",
"commission_value": 10,
"attribution_window": 30,
"max_budget": 10000,
"current_spend": 3180,
"created_at": "2024-01-15T10:30:00.000Z",
"stats": {
"total_affiliates": 45,
"total_clicks": 12500,
"total_conversions": 320,
"total_revenue": 31800.00
}
}
}
Create Campaign
POST /v1/campaigns
Content-Type: application/json
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | ✅ | Campaign name |
| target_url | string | ✅ | Destination URL |
| type | string | ✅ | CPA (conversion-based) |
| commission_type | string | ✅ | fixed or percentage |
| commission_value | number | ✅ | Commission amount |
| visibility | string | - | public (default) or private |
| attribution_window | number | - | Days to track conversions (default: 30) |
| maturation_days | number | - | Days before commission is withdrawable (default: 7) |
Example
curl -X POST https://api.baclique.com/v1/campaigns \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Black Friday 2024",
"target_url": "https://example.com/blackfriday",
"type": "CPA",
"commission_type": "percentage",
"commission_value": 15,
"visibility": "public"
}'
const response = await fetch('https://api.baclique.com/v1/campaigns', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Black Friday 2024',
target_url: 'https://example.com/blackfriday',
type: 'CPA',
commission_type: 'percentage',
commission_value: 15,
visibility: 'public'
})
});
const data = await response.json();
Response
{
"success": true,
"campaign": {
"id": "cmp_xyz789",
"name": "Black Friday 2024",
"slug": "black-friday-2024-abc123",
"target_url": "https://example.com/blackfriday",
"type": "CPA",
"status": "active",
"created_at": "2024-01-20T10:30:00.000Z"
}
}
Update Campaign
PATCH /v1/campaigns/:id
Content-Type: application/json
Request Body
All fields are optional. Only include what you want to update.{
"name": "Updated Campaign Name",
"status": "paused",
"commission_value": 20,
"maturation_days": 14
}
Example
curl -X PATCH https://api.baclique.com/v1/campaigns/cmp_abc123 \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"status": "paused"}'
const response = await fetch('https://api.baclique.com/v1/campaigns/cmp_abc123', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer sk_live_YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
status: 'paused'
})
});
const data = await response.json();
Response
{
"success": true,
"campaign": {
"id": "cmp_abc123",
"name": "Updated Campaign Name",
"slug": "updated-campaign-name-x7k2",
"target_url": "https://example.com/updated",
"type": "CPA",
"status": "paused",
"commission_type": "percentage",
"commission_value": 20,
"created_at": "2024-01-15T10:30:00.000Z"
}
}
Archive Campaign
Archiving a campaign stops all tracking but preserves historical data.DELETE /v1/campaigns/:id
Example
curl -X DELETE https://api.baclique.com/v1/campaigns/cmp_abc123 \
-H "Authorization: Bearer sk_live_YOUR_API_KEY"
const response = await fetch('https://api.baclique.com/v1/campaigns/cmp_abc123', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer sk_live_YOUR_API_KEY'
}
});
const data = await response.json();
Response
{
"success": true,
"message": "Campaign archived"
}
💡 Tip: Archived campaigns can be reactivated by updating their status to active.