cURL Examples
Overview
This guide provides ready-to-use cURL commands for authenticating and creating campaigns via the ExoClick API. All examples use standard JSON or Form-Data formats depending on the endpoint requirements.
Authentication (Login)
You can authenticate using your account credentials or a permanent API Token. Both return a temporary Bearer Token used for all subsequent requests.
A - Login with Username & Password
curl -X POST "https://api.exoclick.com/v2/login" \
-H "Content-Type: application/json" \
-d '{
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD"
}'
B - Login with API Token
Use this if you generated a token in your ExoClick Dashboard (Profile > API Tokens).
curl -X POST "https://api.exoclick.com/v2/login" \
-H "Content-Type: application/json" \
-d '{
"api_token": "YOUR_API_TOKEN"
}'
300x250 Banner Campaign Creation Flow
Follow these steps in exact order. Note the transition from JSON to Form-Data in the final steps.
Step 1: Create Landing Page URL (Library)
Registers your destination URL.
Format: JSON
curl -X POST "https://api.exoclick.com/v2/library/url" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-landing-page.com"
}'
Result: Save the returned "id" (e.g., 6512406).
Step 2: Upload Image (Library)
Registers your creative asset. The image must be exactly 300x250.
Format: Form-Data
curl -X POST "https://api.exoclick.com/v2/library/file" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@/path/to/your/image_300x250.jpg" \
-F "type=image"
Result: Save the returned "id" (e.g., 6884966).
Step 3: Create Campaign Shell
Sets targeting, budget, and the img_banner template.
Format: JSON
curl -X POST "https://api.exoclick.com/v2/campaigns" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Banner 300x250",
"status": 0,
"advertiser_ad_type": 0,
"media_storage_template": "img_banner",
"size": "300x250",
"categories": { "type": "targeted", "elements": [97, 98, 99] },
"countries": {
"type": "targeted",
"elements": [{ "country": "USA", "regions": [0] }]
},
"pricing": { "model": 4, "price": 300 },
"start_date": "2026-03-02",
"daily_limit_type": 1,
"max_daily_budget": 2000,
"budget_delivery_mode": 1,
"run_on_responsive_zones": 1
}'
Result: Save the returned "id" (e.g., 8140060).
Step 4: Add the Variation
Links the URL (Step 1) and Image (Step 2) to the Campaign (Step 3).
Format: Form-Data
curl -X POST "https://api.exoclick.com/v2/campaigns/8140060/variation" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "id_library_url=6512406" \
-F "id_library_file=6884966" \
-F "active=1"
All IDs returned at each step must be saved and used in subsequent requests. Remember to replace YOUR_TOKEN, file paths, and IDs with your actual values.