API Reference
Build with the Draper API
Integrate Draper into your workflow with our powerful REST API. Access campaigns, create rules, and automate your PPC management.
example.js
const Draper = require('@draper/sdk');
const client = new Draper({
apiKey: process.env.DRAPER_API_KEY,
});
// Get all campaigns
const campaigns = await client.campaigns.list({
accountId: 'acc_123',
status: 'active',
});
// Create an automation rule
const rule = await client.rules.create({
name: 'Pause low performers',
conditions: [
{ metric: 'ctr', operator: 'lt', value: 0.5 },
{ metric: 'clicks', operator: 'gt', value: 100 },
],
actions: [
{ type: 'pause_campaign' },
{ type: 'send_notification' },
],
});Authentication
Secure API key authentication with scoped permissions.
RESTful Design
Clean, predictable URLs and standard HTTP methods.
Webhooks
Real-time notifications for events in your account.
SDKs
Official libraries for Python, Node.js, and PHP.
Base URL:
https://api.draperads.com/v1API Endpoints
Accounts
GET
/v1/accountsGET
/v1/accounts/{id}GET
/v1/accounts/{id}/metricsCampaigns
GET
/v1/campaignsGET
/v1/campaigns/{id}PATCH
/v1/campaigns/{id}GET
/v1/campaigns/{id}/metricsRules
GET
/v1/rulesPOST
/v1/rulesPATCH
/v1/rules/{id}DELETE
/v1/rules/{id}Alerts
GET
/v1/alertsGET
/v1/alerts/{id}PATCH
/v1/alerts/{id}/acknowledgeReports
GET
/v1/reportsPOST
/v1/reportsGET
/v1/reports/{id}Authentication
The Draper API uses API keys to authenticate requests. You can view and manage your API keys in your account settings.
- Include your API key in the Authorization header
- Create scoped keys with limited permissions
- Rotate keys without downtime
Example Request
curl -X GET https://api.draperads.com/v1/accounts \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json"Webhooks
Receive real-time notifications when events happen in your Draper account. Configure webhook endpoints to integrate with your systems.
alert.triggeredWhen a monitoring alert fires
rule.executedWhen an automation rule runs
report.generatedWhen a report is ready