Developers & integrations11 min/connector
AI Connector (MCP) and the developer REST API
Run Dukun Ads from ChatGPT or Claude with the MCP connector, or from your own code with the REST API.
Last reviewed 2026-07-20
There are two ways to use Dukun Ads from outside the app, and the rule of thumb is simple: if you are talking to a model, use the AI Connector; if you are writing code, use the REST API.
- AI Connector (MCP) at /connector — roughly 45 tools exposed to ChatGPT and Claude. Ask in plain language and the model calls the right tool.
- REST API at /api-docs — a small, stable JSON API authenticated with your own key.
Step by step
Get your connector URL
Open /connector. At the top is Your Connector URL — copy it. It ends in
/api/mcp.This URL is safe to share: it carries no token. Anyone who connects has to log in to their own Dukun Ads account through OAuth first, and they get access to their own data, not yours.
Connect it to Claude
- In Claude, open Settings → Connectors.
- Choose Add custom connector.
- Paste your connector URL.
- Press Connect, log in to Dukun Ads, and allow access.
- The tools are now available in any conversation.
Connect it to ChatGPT
- In ChatGPT, open Settings → Connectors (developer mode).
- Choose Add custom connector or MCP server.
- Paste your connector URL.
- Choose OAuth, log in to Dukun Ads and allow access.
- The tools are now available in chat.
Know what the connector can do
The tools cover most of the app. Broadly:
Area Examples Meta Ads list ad accounts, list and create campaigns, ad sets and ads, insights, funding, usage Audiences list audiences, reach estimates, targeting search Lead ads list lead forms, fetch leads Content list social accounts, create and list posts Autopilot list, create and control autopilots AI generation generate text, images and video; list models and generations Tracking list pixels, create and attach a pixel, pixel stats, sales pages, conversions, DukunTrack Inbox & leads list conversations, list and update leads Reporting list, get, configure and send ads reports Account credits balance In practice you ask in plain language — how did my campaigns perform last month?, create a paused traffic campaign with a RM30 daily budget, schedule a post to my Threads account for tomorrow morning — and the model picks the tools.
Generate a REST API key
Open /api-docs and find the 🔑 Your API key panel. Press Generate API key. Keys look like
dk_live_…and there is exactly one active key per account — generating a new one immediately invalidates the old one.Copy it once and store it in an environment variable. You can Reveal, Copy, regenerate or Revoke it from the same panel.
Authenticate your requests
The base URL is
https://dukunads.com/api/v1. Send your key in either header — if both are present,Authorizationwins:Authorization: Bearer dk_live_xxxxxxxx # or X-API-Key: dk_live_xxxxxxxxEverything is JSON in and JSON out, and every request is scoped to the key's owner — you can only see and change your own data.
Call the endpoints
Available endpoints Method & path What it does GET /api/v1/me Your profile, credit balance and plan status GET /api/v1/accounts Your connected social accounts GET /api/v1/posts List posts — filter by status, limit up to 200 POST /api/v1/posts Create or schedule a post GET /api/v1/products List your products POST /api/v1/products Create a product with an affiliate link Scheduling a post curl -X POST https://dukunads.com/api/v1/posts \ -H "Authorization: Bearer dk_live_xxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "accountId": "acc_123", "content": "Your caption here", "scheduledAt": "2026-08-01T09:00:00Z", "mediaUrls": ["https://example.com/image.jpg"] }'Creating a post requires an active subscription. Media is limited to ten URLs per post, and long content is truncated rather than rejected.
Handle errors
Status Error Meaning 401 unauthorized Missing, malformed or revoked key 403 plan_inactive No active subscription — required to create posts 400 content_required Post body had no content 400 accountId_required No target account given 400 invalid_scheduledAt Date could not be parsed 400 name_and_affiliateLink_required Product is missing a required field 404 account_not_found That account does not belong to this key CORS is open (
Access-Control-Allow-Origin: *) so the API can be called from any origin — which also means you must never put your key in client-side code. Call it from a server you control.
Which one should you use?
| Use case | Use |
|---|---|
| Ask about performance in plain language | AI Connector |
| Create campaigns conversationally | AI Connector |
| Publish from your own CMS or script | REST API |
| Sync products from your store | REST API |
| Build a client dashboard | REST API |
| Generate images or video from a chat | AI Connector |