# Authentication and keys (/developers/account/concepts/authentication) Every request carries one key, in one place: the `Authorization` header. ```http GET /v1//key HTTP/1.1 Host: api.traki.io Authorization: Bearer traki__live_8Hq2LmNpXr_… ``` ## The header is the only place [#the-header-is-the-only-place] The API refuses a key anywhere else. A key in the address gets [`key_in_url`](/developers/errors#key_in_url) and a key in the body gets [`key_in_body`](/developers/errors#key_in_body). Addresses end up in server logs, proxies and browser history, so a key sent that way should be rolled. ## The key format [#the-key-format] ```text traki____ traki_account_live_8Hq2LmNpXr_<43 characters><6 characters> ``` | Piece | What it is | | -------- | ------------------------------------------------------------------------------------------------------------------------- | | `traki_` | Marks a TRAKI Developer API key, so secret scanners can find a leaked one | | `part` | `account`, `publisher` or `buyer`: the part of the API the key opens | | `mode` | `live` for real data, `test` for the test copy of the account | | `keyId` | Ten letters and digits. Not secret: it shows in the portal, your request log and support tickets | | `secret` | 43 random letters and digits. Shown once, when the key is made. TRAKI keeps only a hash of the key | | `check` | Six characters of checksum, so a mistyped key is refused at once with [`key_malformed`](/developers/errors#key_malformed) | Keys for this part of the API start . A key for another part is refused with [`wrong_api`](/developers/errors#wrong_api), and the answer names the right part. ## Ask the API about your key [#ask-the-api-about-your-key] `GET` needs no scope. It answers the key's name, mode, scopes, pinned version, expiry and the account it belongs to. Use it to check a key before you rely on it. ## What a key can carry [#what-a-key-can-carry] - **Scopes.** What the key may read and change. See [scopes](./scopes). - **An IP allow-list.** Addresses or ranges the key may be used from. Others get [`ip_not_allowed`](/developers/errors#ip_not_allowed). Keys with a high-risk scope must have one. - **An expiry.** 30, 90 or 365 days, or none. - **A pinned version.** The dated API version the key was made on. See [versions](./versions). ## Rolling a key [#rolling-a-key] Rolling gives a key a new secret and keeps its ID, scopes and settings. You choose how long the old secret keeps working: not at all, 1 hour, 24 hours or 7 days. Deploy the new secret within that time. Revoking stops a key at once and for good. # Errors (/developers/account/concepts/errors) When a request fails, the answer is an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem with a stable `code`, the `requestId` and a `docUrl` that links to the code's entry on the [errors page](/developers/errors). ```json { "type": "https://traki.io/developers/errors#key_missing", "title": "Unauthorized", "status": 401, "detail": "Send your key in the Authorization header: \"Authorization: Bearer traki_…\".", "code": "key_missing", "requestId": "2b1f0c3e-6a1d-4a5e-9f0e-6c1d2b7a8e41", "docUrl": "https://traki.io/developers/errors#key_missing" } ``` ## Status codes [#status-codes] | Status | Meaning | | ------------- | -------------------------------------------------------------------------- | | 200, 201, 204 | It worked | | 400 | The request is malformed | | 401 | No key, or the key is unknown, revoked or expired | | 403 | The key is valid but lacks the scope or the plan, or opens another part | | 404 | No such route, or no such record in your account | | 409 | A conflict: a stale version, or the same idempotency key still running | | 422 | The fields are well formed but not acceptable | | 429 | Too many requests | | 5xx | TRAKI's fault. Safe to retry, with the same `Idempotency-Key` for a change | ## Handling errors well [#handling-errors-well] - Branch on `code`, not on `detail`. The wording of `detail` can change; the codes do not. - Log `requestId` with every failure. Support finds the request with it. - Retry 429 after `Retry-After`, and 5xx with a growing wait. Do not retry other 4xx answers unchanged: they will fail the same way. - A record in another account answers 404, never 403. The API does not say whether it exists. The [errors page](/developers/errors) lists every code with what to do. # Paging (/developers/account/concepts/paging) Every list in the API pages the same way, with a cursor. ## Asking for a page [#asking-for-a-page] | Parameter | What it does | | -------------- | ----------------------------------------------------------------------- | | `limit` | How many records per page. Default 25, at most 100 | | `cursor` | Where to continue. Pass the `nextCursor` of the page before | | `updatedSince` | Only records changed at or after this time (ISO 8601, with a time zone) | ## The answer [#the-answer] ```json { "data": [{ "id": "…" }, { "id": "…" }], "hasMore": true, "nextCursor": "djE6MDE5MzBhYjQtN2M0ZC03MmUxLWE3ZmMtNGYyZTkwYjA1ZDNi" } ``` Records come newest first. When `hasMore` is `false`, `nextCursor` is `null` and you have them all. New records arriving while you page do not shift your place, because the cursor marks a record, not a position. Treat the cursor as opaque: pass it back exactly as you got it. A cursor TRAKI did not give out is refused with [`validation_error`](/developers/errors#validation_error). ## Reading every page [#reading-every-page] ```js async function readAll(url) { const all = []; let cursor = null; do { const page = new URL(url); page.searchParams.set('limit', '100'); if (cursor) page.searchParams.set('cursor', cursor); const res = await fetch(page, { headers: { Authorization: `Bearer ${process.env.TRAKI_KEY}` }, }); if (!res.ok) throw new Error(`${res.status} ${(await res.json()).code}`); const body = await res.json(); all.push(...body.data); cursor = body.hasMore ? body.nextCursor : null; } while (cursor); return all; } ``` ## Keeping a copy in step with `updatedSince` [#keeping-a-copy-in-step-with-updatedsince] To keep your own copy of a list, read it in full once. After that, ask only for what changed: save the time you start each run, and pass the time of the last run as `updatedSince`. Records that changed in between come back, and you update them in your copy. Running the same sync twice does no harm. # Rate limits (/developers/account/concepts/rate-limits) Rate limits keep one busy system from slowing the API for everyone. They are counted per key and per account, separately from use of the portal. ## The limits [#the-limits] Each address also has a wide limit of its own, and many unknown keys from one address in a minute get the address blocked for 15 minutes. ## The headers [#the-headers] Answers to a recognised key carry the state of its limit: | Header | Meaning | | --------------------- | -------------------------------------- | | `RateLimit-Limit` | Requests allowed in the current minute | | `RateLimit-Remaining` | Requests left in the current minute | | `RateLimit-Reset` | Seconds until the minute starts again | Going over answers 429 with [`rate_limited`](/developers/errors#rate_limited) and a `Retry-After` header: the number of seconds to wait. Too many requests running at once answers [`concurrency_limited`](/developers/errors#concurrency_limited). ## Staying inside them [#staying-inside-them] - Watch `RateLimit-Remaining` and slow down before it reaches 0. - On 429, wait for `Retry-After` seconds, then retry. Do not retry at once. - Use webhooks for live updates instead of asking again and again. See [webhooks](./webhooks). - Ask for 100 records a page when you read a whole list. # Security and responsibilities (/developers/account/concepts/responsibilities) A key reaches into your account, and your own systems are outside TRAKI's control. So the work is split, and the split is written down. ## What TRAKI guarantees, and what you are responsible for [#what-traki-guarantees-and-what-you-are-responsible-for] | TRAKI guarantees | You are responsible for | | --------------------------------------------------- | ----------------------------------------------------------------- | | A key can only ever reach its own account | Keeping the key on a server, never in a web page or an app | | Buyer and publisher keys see only their own records | Passing the right buyer or publisher when you act on their behalf | | Every webhook is signed | Checking the signature before you trust an event | | Revoking or rolling a key takes effect at once | Rolling a key when someone leaves or a leak is suspected | | A full log of what each key did | Reviewing that log, and setting an IP allow-list on write keys | ## Keeping keys safe [#keeping-keys-safe] - Keep keys in your server's secret store or environment, never in source code. - Never put a key in a web page, a mobile app or anything a browser downloads. - Give each system its own key with only the scopes it needs. One leak then exposes one system. - Set an expiry on keys used by people, and roll keys on a schedule. - If a key may have leaked, roll it on the Developers page. The old secret stops at once, or after the overlap you choose. ## Report a security problem [#report-a-security-problem] If you find a security problem in TRAKI or the Developer API, write to [security@traki.io](mailto:security@traki.io). Include the steps to reproduce it and any request IDs. Please do not test against accounts that are not yours, and give us a reasonable time to fix the problem before you publish it. # Safe retries (/developers/account/concepts/retries) A network can fail after TRAKI made a change but before you got the answer. A safe retry lets you send the same change again without making it twice. ## The `Idempotency-Key` header [#the-idempotency-key-header] Send a unique value with every `POST`: ```http POST /v1//… HTTP/1.1 Authorization: Bearer traki_… Idempotency-Key: 6f1c1c62-3a6a-4cf7-9b55-0d7f1f8f2a1e Content-Type: application/json ``` - Use a new value for each new change: a UUID is a good choice. It is 8 to 200 letters, digits, dots, colons, dashes or underscores. - If you retry, send the same value with the same body. TRAKI keeps the first result for 24 hours and answers it again, with the header `Idempotent-Replayed: true`. - The same value with a different body is refused with [`idempotency_key_reused`](/developers/errors#idempotency_key_reused). - A retry while the first request is still running gets [`idempotency_in_progress`](/developers/errors#idempotency_in_progress). Wait a moment and retry again. - Routes that move money or buy something require the header and answer [`idempotency_key_required`](/developers/errors#idempotency_key_required) without it. `GET` requests change nothing, so they need no key. ## When to retry [#when-to-retry] | Answer | Retry? | | ----------------------------- | ------------------------------------------------------ | | No answer, or a network error | Yes, with the same `Idempotency-Key` | | 429 | Yes, after `Retry-After` seconds | | 500, 502, 503, 504 | Yes, with a growing wait: 1, 2, 4, 8 seconds and so on | | Any other 4xx | No. Fix the request first | # Scopes (/developers/account/concepts/scopes) A scope says what a key may do with one kind of record. It is written `resource:read` or `resource:write`, for example `buyers:read`. A `write` scope includes `read` of the same resource. A key without the scope a route needs gets [`scope_missing`](/developers/errors#scope_missing), and `errors.scope` names the scope. Every reference page lists the scope its route needs. ## The scopes of the [#the-scopes-of-the-] Scopes marked "in use" are needed by a route that exists today. The others are for routes in later releases; a key can hold them already. ## Presets [#presets] When you make a key on the Developers page you pick a preset or tick scopes one by one. - **Read only.** Every `read` scope. - **Full access.** Every scope except the high-risk ones. - **Custom.** Only the scopes you tick. High-risk scopes move money, buy numbers or issue keys. They are never part of a preset, each must be ticked on its own, and a key that holds one must have an IP allow-list. ## Give each system only what it needs [#give-each-system-only-what-it-needs] A dashboard needs `reports:read`. A system that copies your calls needs `calls:read`. Neither needs `write`. Narrow keys limit what a leaked key can do. # Test mode (/developers/account/concepts/test-mode) Test keys contain `_test_`: they start . They work on a separate test copy of the account, with sample data, no real calls and no charges. Live keys contain `_live_` and work on real data. The first test key an account makes creates its test account: a separate copy named after the account, with two sample buyers, two sample publishers, a sample call campaign and a few sample calls. A Buyer or Publisher API test key acts as one of the sample buyers or publishers. Test requests show in your request log marked as test mode, and test keys have lower rate limits than live keys. ## What test mode is [#what-test-mode-is] - **Separate data.** A test key never sees live records, and a live key never sees test records. - **Sample data.** Campaigns, buyers, publishers, calls and leads to read and change. - **No real effects.** No calls are placed, no messages are sent and nothing is charged. - **The same rules.** Scopes, limits, errors and webhooks behave as they do live. ## The request tester [#the-request-tester] Each reference page has a tester that sends a real request from your browser. It accepts test keys only, and refuses a live key before anything is sent. The key stays in the page while it is open and is never saved. # Versions (/developers/account/concepts/versions) The API has two kinds of version: the major version in the address, and a dated version pinned on each key. ## `/v1` in the address [#v1-in-the-address] Every address starts `/v1/`. A new major version would get a new address, and `/v1` would keep working beside it. ## The dated version: `Traki-Version` [#the-dated-version-traki-version] Each key is pinned to the dated version that was current when it was made. Every answer to a recognised key carries it in the `Traki-Version` header. The current version is `2026-12-01`, and it is the only one so far. ## The compatibility promise [#the-compatibility-promise] Within `v1`, TRAKI only adds. These changes can arrive at any time, so write your code to accept them: - new routes; - new optional inputs; - new fields in answers; - new event types. These changes count as breaking, and only ever come with a new dated version: - removing or renaming a field; - changing a field's type; - making an optional input required; - changing a default; - tightening a limit on values. An old dated version stays supported for 12 months after its replacement ships. Answers on an old version then carry a `Sunset` header with the end date. ## Changelog [#changelog] Every change is listed on the [changelog](/developers/changelog). # Webhooks (/developers/account/concepts/webhooks) Webhooks send you an event within seconds of something happening, so you do not have to keep asking. TRAKI signs every delivery with the [Standard Webhooks](https://www.standardwebhooks.com/) format, which has ready-made libraries in most languages. ## The event [#the-event] Every event has the same envelope: ```json { "id": "evt_mi7x2k9a3f8c1d0e7b", "type": "call.ended", "createdAt": "2026-12-01T14:03:22.418Z", "data": { "…": "…" } } ``` What a receiver can rely on: - The `id` is the same on every retry, so you can skip an event you already handled. - Order is not guaranteed. When you need the latest state, fetch the record. - Answer within 10 seconds with any 2xx status, then do slow work afterwards. - A failed delivery is retried about 10 times over 3 days, waiting longer each time. An endpoint that fails for 3 days is paused, and its owner is emailed. ## The headers [#the-headers] | Header | What it holds | | ------------------- | ----------------------------------------------------------- | | `webhook-id` | The event's `id` | | `webhook-timestamp` | When this attempt was sent, in seconds since 1970 (UTC) | | `webhook-signature` | One or more signatures, space-separated, each `v1,` | ## Verifying a delivery [#verifying-a-delivery] Never trust an event before checking its signature. An unchecked webhook endpoint lets anyone post fake events to you. 1. Take the endpoint's secret. It starts `whsec_`; the rest is base64. Decode the rest to get the signing key. 2. Join the `webhook-id`, the `webhook-timestamp` and the raw body with dots: `id.timestamp.body`. Use the body exactly as received, before any JSON parsing. 3. Compute HMAC-SHA256 of that text with the key, and base64 it. 4. Compare it, in constant time, with each `v1,` signature in the header. One match is enough. While a secret is being rolled, the old and the new secret both sign for 24 hours. 5. Refuse the event if the timestamp is more than 5 minutes away from your clock. This stops a captured event being sent again. ```js tab="Node" import crypto from 'node:crypto'; // rawBody: the request body as a string, exactly as received. export function verifyWebhook(headers, rawBody, secret) { const id = headers['webhook-id']; const timestamp = headers['webhook-timestamp']; const signatures = headers['webhook-signature'] ?? ''; if (!id || !timestamp) return false; if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64'); const expected = crypto .createHmac('sha256', key) .update(`${id}.${timestamp}.${rawBody}`) .digest(); return signatures.split(' ').some((part) => { const [version, value] = part.split(','); if (version !== 'v1' || !value) return false; const given = Buffer.from(value, 'base64'); return given.length === expected.length && crypto.timingSafeEqual(given, expected); }); } ``` ```python tab="Python" import base64 import hashlib import hmac import time # raw_body: the request body as bytes, exactly as received. def verify_webhook(headers, raw_body: bytes, secret: str) -> bool: msg_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature", "") if not msg_id or not timestamp: return False if abs(time.time() - int(timestamp)) > 300: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{msg_id}.{timestamp}.".encode() + raw_body expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() for part in signatures.split(" "): version, _, value = part.partition(",") if version == "v1" and hmac.compare_digest(value, expected): return True return False ``` ```php tab="PHP" 300) return false; $key = base64_decode(preg_replace('/^whsec_/', '', $secret)); $expected = base64_encode(hash_hmac('sha256', "$id.$timestamp.$rawBody", $key, true)); foreach (explode(' ', $signatures) as $part) { [$version, $value] = array_pad(explode(',', $part, 2), 2, ''); if ($version === 'v1' && hash_equals($expected, $value)) return true; } return false; } ``` In PHP, header names arrive in `$_SERVER` as `HTTP_WEBHOOK_ID` and so on; map them to the names above first. ## Catching up after downtime [#catching-up-after-downtime] Your endpoint can be down for a while without losing anything: deliveries are retried for 3 days. After a longer outage, compare your copy with the lists, using `updatedSince` (see [paging](./paging)). ## Managing endpoints [#managing-endpoints] Endpoints are managed in the portal today, on the Webhooks page, where each has its own secret, a delivery log and a replay button. Routes to manage them from the API arrive in release 2. # Add a buyer and attach it to a campaign (/developers/account/guides/add-a-buyer) Today the Account API reads buyers and campaigns. Creating a buyer, and attaching it to a campaign, from the API arrive in the next release. Until then, create and attach the buyer in the portal, then find it with the API as shown below. ## How it will work [#how-it-will-work] 1. **Create the buyer with your own ID.** You send your own ID as `externalId`. One call creates the buyer if it is new and updates it if it exists, so running the same sync twice never makes a duplicate. 2. **No email goes out.** A buyer created by API gets no email and no portal invitation unless the request asks for one. 3. **Attach it to a campaign** with its price, caps and hours. 4. **Send an `Idempotency-Key`** with each change, so a retry cannot make it twice. See [safe retries](../concepts/retries). ## What you can do today [#what-you-can-do-today] Find a buyer by your own ID: See which buyers a call campaign has. Each campaign in the list names its buyers and publishers: Your key needs `buyers:read` and `campaigns:read`. The write routes will need `buyers:write` and `campaigns:write`; a key can hold them already. # Show each buyer only their own data (/developers/account/guides/each-buyer-their-own-data) If your own website lets buyers sign in, each buyer must see only their own calls and leads, and never your publisher payouts or margins. An Account API key can see the whole account, so the care is on your side. ## Today: filter and trim on your server [#today-filter-and-trim-on-your-server] 1. **Look up the signed-in buyer's TRAKI ID on your server**, from your own session. Never take it from the page or the address: a buyer could change it. 2. **Always pass it as a filter.** Every list that a buyer sees gets `buyerId`: 3. **Remove fields the buyer must not see** before you send the answer to the page. A call answer from the Account API carries `publisherPayout` and the publisher's name; a buyer should get neither. 4. **Check single records too.** When a buyer opens one call, fetch it and confirm its `buyer.id` is theirs before you show it. ```js const ALLOWED = [ 'id', 'code', 'campaign', 'caller', 'startedAt', 'endedAt', 'durationSec', 'billable', 'buyerCharge', ]; function forBuyer(call, buyerId) { if (call.buyer?.id !== buyerId) return null; // not theirs: answer "not found" return Object.fromEntries(ALLOWED.map((k) => [k, call[k]])); } ``` ## Safer: ask as the buyer, with `Traki-On-Behalf-Of` [#safer-ask-as-the-buyer-with-traki-on-behalf-of] When your server fetches data for one buyer, call the **Buyer API** route with your Account API key and add: ```http GET /v1/buyer/calls Authorization: Bearer traki_account_live_… Traki-On-Behalf-Of: buyer: ``` TRAKI then answers exactly as it would answer that buyer's own key: the same hidden fields, the same sharing settings, the same limits. A mistake in your code can no longer show a buyer your payouts or margins, so you can drop the trimming above. - Reading needs `buyers:read` on your key; changing (a bid, a return) needs `buyers:write`. - The header works only on Buyer API routes (`publisher:` on Publisher API routes) and only narrows. A buyer of another account answers [`not_found`](/developers/errors#not_found); a malformed header answers [`on_behalf_invalid`](/developers/errors#on_behalf_invalid). - Your request log shows which buyer each request was made for. ## From the browser: portal sessions [#from-the-browser-portal-sessions] If you would rather your web page call TRAKI directly, ask your server for a session token for the signed-in buyer and hand only that token to the page: ```http POST /v1/account/portal-sessions Authorization: Bearer traki_account_live_… Content-Type: application/json { "party": "buyer:", "origins": ["https://portal.example.com"] } ``` The answer holds a `traki_session_…` token that: - works only on that buyer's Buyer API routes, read-only unless you ask for `"access": "read_write"` (which needs `buyers:write`); - works only from the origins you name, which are the only sites the API sends cross-site headers to; - ends after 15 minutes (or sooner with `ttlSeconds`), when you call `DELETE /v1/account/portal-sessions/{id}`, or when the key that asked for it is revoked. Never put an account key in a page. The responsibility for asking for the right buyer stays with you; see [security and responsibilities](../concepts/responsibilities). # Export a month of calls (/developers/account/guides/export-a-month-of-calls) The calls list filters by when a call started and pages with a cursor, so a month of calls is a loop of requests. **You need:** a key with `calls:read`. ## 1. Ask for the first page [#1-ask-for-the-first-page] Set `startedAfter` and `startedBefore` to the month's bounds, in the account's time zone, and ask for 100 calls a page: ## 2. Follow the cursor [#2-follow-the-cursor] Pass each page's `nextCursor` as `cursor` until `hasMore` is `false`. ```python import csv import os import time import requests URL = "https://api.traki.io/v1/account/calls" HEADERS = {"Authorization": f"Bearer {os.environ['TRAKI_KEY']}"} params = { "startedAfter": "2026-11-01T00:00:00-05:00", "startedBefore": "2026-12-01T00:00:00-05:00", "limit": 100, } with open("calls-2026-11.csv", "w", newline="") as f: out = csv.writer(f) out.writerow(["id", "code", "startedAt", "durationSec", "billable", "buyerCharge", "publisherPayout"]) while True: res = requests.get(URL, headers=HEADERS, params=params) if res.status_code == 429: time.sleep(int(res.headers.get("Retry-After", "1"))) continue res.raise_for_status() page = res.json() for c in page["data"]: out.writerow([c["id"], c["code"], c["startedAt"], c["durationSec"], c["billable"], c["buyerCharge"], c["publisherPayout"]]) if not page["hasMore"]: break params["cursor"] = page["nextCursor"] ``` ## 3. Mind the limits [#3-mind-the-limits] An Account API key may send 600 requests a minute. A month of 100,000 calls is 1,000 pages, so the loop above finishes in a few minutes. On a 429 it waits for `Retry-After`, as in the example. Recording links in a call expire after a few minutes. Download recordings as you read the pages, not later. Export jobs that build the whole file for you and return a download link arrive in a later release. # Onboard a publisher (/developers/account/guides/onboard-a-publisher) Today the Account API reads publishers and numbers. Creating a publisher, inviting it and assigning numbers from the API arrive in the next release. Until then, do those steps in the portal, then follow the publisher with the API as shown below. ## The steps [#the-steps] 1. **Create the publisher** with your own ID as `externalId`. No email goes out unless you ask for an invitation. 2. **Attach it to a campaign** with its payout terms. 3. **Assign numbers** from your inventory, so its calls are counted as its own. 4. **Give it a Publisher API key**, if it wants to read its own results from its systems. See the [Publisher API](/developers/publisher). ## What you can do today [#what-you-can-do-today] Find the publisher by your own ID: See which numbers are assigned to it: Follow its calls as they come in: Your key needs `publishers:read`, `numbers:read` and `calls:read`. # Receive call events (/developers/account/guides/receive-call-events) Webhooks send an event to your server when a call starts, ends or becomes billable. You do not need to keep asking the API. ## 1. Add an endpoint [#1-add-an-endpoint] In the portal, open **Webhooks**, add your endpoint's address (HTTPS) and tick the events you want: `call.started`, `call.ended` and `call.billable`. Copy the endpoint's secret. It starts `whsec_`. Managing endpoints from the API arrives in release 2. ## 2. Verify, then answer quickly [#2-verify-then-answer-quickly] ```js import express from 'express'; import { verifyWebhook } from './verify-webhook.js'; // from the webhooks page const app = express(); // Keep the raw body: the signature covers it exactly as sent. app.post('/traki/events', express.text({ type: 'application/json' }), (req, res) => { if (!verifyWebhook(req.headers, req.body, process.env.TRAKI_WEBHOOK_SECRET)) { return res.sendStatus(400); } const event = JSON.parse(req.body); res.sendStatus(204); // answer within 10 seconds queue.add(event); // do the slow work afterwards }); ``` The verification code for Node, Python and PHP is on the [webhooks page](../concepts/webhooks#verifying-a-delivery). ## 3. Handle each event once [#3-handle-each-event-once] A failed delivery is retried, with the same `id`. Store the IDs you handled and skip repeats. ```json { "id": "evt_mi7x2k9a3f8c1d0e7b", "type": "call.ended", "createdAt": "2026-12-01T14:03:22.418Z", "data": { "call": "C-7Q2M9K", "campaign": "ROOF-01", "buyerId": "0b6c3d1e-9a4f-4e2b-8d7c-5f1a2e3b4c6d", "stage": "ENDED", "outcome": "BRIDGED", "startedAt": "2026-12-01T14:01:02.000Z", "endedAt": "2026-12-01T14:03:21.000Z", "durationSec": 139, "connectedSec": 121, "billable": true } } ``` `data.call` is the call's code, the same as the `code` field in the calls list. The event carries no money; read the call from the API when you need charges and payouts. ## 4. Fill in the details [#4-fill-in-the-details] Events can arrive out of order. When you need the full, latest record, read recent calls and match on `code`: ## 5. Catch up after downtime [#5-catch-up-after-downtime] Deliveries are retried for 3 days. After a longer outage, read the calls list with `updatedSince` set to the last time you were sure your copy was complete. # Build a reporting dashboard (/developers/account/guides/reporting-dashboard) The reports routes add up calls or leads over a period and group them. One request fills a chart or a table. **You need:** a key with `reports:read`. Add `campaigns:read`, `buyers:read` and `publishers:read` if you also show lists. ## 1. Ask for a period [#1-ask-for-a-period] Give `start` and `end` as ISO 8601 times. Both are required, `end` must be after `start`, and a report covers at most one year. Use the account's time zone (from `GET /v1/account/key`) for day boundaries your users expect. ## 2. Read the rows [#2-read-the-rows] ```json { "start": "2026-11-01T05:00:00.000Z", "end": "2026-12-01T05:00:00.000Z", "groupBy": "day", "rows": [ { "group": "2026-11-01", "label": null, "calls": 412, "answered": 371, "billable": 233, "durationSec": 98412, "revenue": "6990.00", "payout": "4660.00" } ] } ``` Money is a decimal string, so it adds up without rounding errors. Convert it with a decimal type, not a float. ## 3. Group another way [#3-group-another-way] `groupBy` takes `day`, `campaign`, `buyer` or `publisher`. For the last three, `group` is the record's ID and `label` its name. Narrow any report with `campaignId`, `buyerId` or `publisherId`. Lead reports work the same way at . ## 4. Keep it fast [#4-keep-it-fast] - Cache each report for a minute or two. Totals for past days do not change often. - Fetch today's numbers more often than last month's. - Run the requests from your server and send the results to the page. The key never goes to the browser. - Watch the `RateLimit-Remaining` header. See [rate limits](../concepts/rate-limits). # Account API (/developers/account) The Account API is for the TRAKI customer who owns an account: a top-level publisher. With it, your own systems can see everything in the account, and in later releases change it too. It is enough to build your own portal on top of TRAKI. - **Address:** `https://api.traki.io/v1/account/…` - **Keys start:** - **Who makes keys:** the account's Owner or an Admin, on the Developers page in the portal. Making a key needs a fresh two-factor check. ## What it covers [#what-it-covers] | Resource | Today | Later | | --------------------------- | ------------------------------- | -------------------------------------- | | Account | Profile, plan, limits, usage | | | Call and lead campaigns | Lists, details, who is attached | Create, edit, pause, attach and detach | | Buyers and publishers | Lists and details | Create, edit, pause, invite | | Numbers | Inventory and assignments | Assign and release | | Calls and leads | Logs and details | Notes, tags, return decisions | | Reports | Call and lead totals by period | Export jobs | | Statements and payouts | Lists and details | Approve payouts, settle disputes | | Webhooks, events, audit log | Managed in the portal | Managed from the API | Some things never open to a key: team members and roles, two-factor, passwords, the plan and payment methods, the account's own API keys, the custom domain and anything in TRAKI's own administration. ## Keeping your website and TRAKI in step [#keeping-your-website-and-traki-in-step] If you keep a copy of your account on your own website, TRAKI stays the master copy: - Read each list in full once, then ask only for what changed with [`updatedSince`](/developers/account/concepts/paging#keeping-a-copy-in-step-with-updatedsince). - Use [webhooks](/developers/account/concepts/webhooks) to hear about calls, leads and money within seconds. - Every buyer and publisher can carry your own ID as `externalId`, and lists can filter by it, so your records and TRAKI's line up. - Calls and leads name their campaign, buyer and publisher with ID, `externalId` and name, so your copy needs no extra lookups. ## Start here [#start-here] A real answer from the API in five minutes. Call and lead totals by day, campaign, buyer or publisher. Every route, with the scope it needs. # Quickstart (/developers/account/quickstart) ## 1. Make a key [#1-make-a-key] 1. Sign in to the TRAKI portal as the account's Owner or an Admin. 2. Open the **Developers** page and choose **New key**. 3. Pick **Account API**, give the key a name that says where it will run, and choose the **Read only** preset. 4. Confirm with your two-factor code. Copy the key: it is shown once. The key starts for real data, or for test mode once it opens. ## 2. Keep the key out of your code [#2-keep-the-key-out-of-your-code] Put the key in an environment variable on the machine you call from. The examples on these pages all read it from `TRAKI_KEY`. ```bash export TRAKI_KEY="paste your key here" ``` ## 3. Ask the API who you are [#3-ask-the-api-who-you-are] `GET` needs no scope, so it works with any key of this part. ## 4. Read the answer [#4-read-the-answer] A `200` answer means the key works. It tells you what the key can do and which account it is locked to: ```json { "keyId": "8Hq2LmNpXr", "name": "Reporting server", "api": "…", "mode": "live", "scopes": ["…"], "version": "2026-12-01", "expiresAt": null, "account": { "name": "Harbor Lane Media", "timezone": "America/New_York", "currency": "USD" }, "holder": null } ``` For a buyer or publisher key, `holder` names the buyer or publisher that holds it. For an account key it is `null`. If the answer is an error, its `code` says why. The most common ones in a first call: | Code | What to do | | ------------------------------------------------------------------- | ------------------------------------------------------- | | [`key_missing`](/developers/errors#key_missing) | Send the header: `Authorization: Bearer $TRAKI_KEY` | | [`key_malformed`](/developers/errors#key_malformed) | Copy the key again, all of it | | [`wrong_api`](/developers/errors#wrong_api) | Use the address of the part your key opens | | [`plan_no_api`](/developers/errors#plan_no_api) | The account needs a paid plan | ## Next [#next] - Read [authentication and keys](./concepts/authentication) and [scopes](./concepts/scopes). - Try a route from the [reference](./reference). Each page has examples in cURL, Node, Python and PHP. # All routes (/developers/account/reference) Addresses start `https://api.traki.io/v1/account/`. Send your key in the `Authorization` header on every request. This list is built from the same route declarations that run the API, so a new route appears here when it ships. The [changelog](/developers/changelog) says what changed. # Authentication and keys (/developers/buyer/concepts/authentication) Every request carries one key, in one place: the `Authorization` header. ```http GET /v1//key HTTP/1.1 Host: api.traki.io Authorization: Bearer traki__live_8Hq2LmNpXr_… ``` ## The header is the only place [#the-header-is-the-only-place] The API refuses a key anywhere else. A key in the address gets [`key_in_url`](/developers/errors#key_in_url) and a key in the body gets [`key_in_body`](/developers/errors#key_in_body). Addresses end up in server logs, proxies and browser history, so a key sent that way should be rolled. ## The key format [#the-key-format] ```text traki____ traki_account_live_8Hq2LmNpXr_<43 characters><6 characters> ``` | Piece | What it is | | -------- | ------------------------------------------------------------------------------------------------------------------------- | | `traki_` | Marks a TRAKI Developer API key, so secret scanners can find a leaked one | | `part` | `account`, `publisher` or `buyer`: the part of the API the key opens | | `mode` | `live` for real data, `test` for the test copy of the account | | `keyId` | Ten letters and digits. Not secret: it shows in the portal, your request log and support tickets | | `secret` | 43 random letters and digits. Shown once, when the key is made. TRAKI keeps only a hash of the key | | `check` | Six characters of checksum, so a mistyped key is refused at once with [`key_malformed`](/developers/errors#key_malformed) | Keys for this part of the API start . A key for another part is refused with [`wrong_api`](/developers/errors#wrong_api), and the answer names the right part. ## Ask the API about your key [#ask-the-api-about-your-key] `GET` needs no scope. It answers the key's name, mode, scopes, pinned version, expiry and the account it belongs to. Use it to check a key before you rely on it. ## What a key can carry [#what-a-key-can-carry] - **Scopes.** What the key may read and change. See [scopes](./scopes). - **An IP allow-list.** Addresses or ranges the key may be used from. Others get [`ip_not_allowed`](/developers/errors#ip_not_allowed). Keys with a high-risk scope must have one. - **An expiry.** 30, 90 or 365 days, or none. - **A pinned version.** The dated API version the key was made on. See [versions](./versions). ## Rolling a key [#rolling-a-key] Rolling gives a key a new secret and keeps its ID, scopes and settings. You choose how long the old secret keeps working: not at all, 1 hour, 24 hours or 7 days. Deploy the new secret within that time. Revoking stops a key at once and for good. # Errors (/developers/buyer/concepts/errors) When a request fails, the answer is an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem with a stable `code`, the `requestId` and a `docUrl` that links to the code's entry on the [errors page](/developers/errors). ```json { "type": "https://traki.io/developers/errors#key_missing", "title": "Unauthorized", "status": 401, "detail": "Send your key in the Authorization header: \"Authorization: Bearer traki_…\".", "code": "key_missing", "requestId": "2b1f0c3e-6a1d-4a5e-9f0e-6c1d2b7a8e41", "docUrl": "https://traki.io/developers/errors#key_missing" } ``` ## Status codes [#status-codes] | Status | Meaning | | ------------- | -------------------------------------------------------------------------- | | 200, 201, 204 | It worked | | 400 | The request is malformed | | 401 | No key, or the key is unknown, revoked or expired | | 403 | The key is valid but lacks the scope or the plan, or opens another part | | 404 | No such route, or no such record in your account | | 409 | A conflict: a stale version, or the same idempotency key still running | | 422 | The fields are well formed but not acceptable | | 429 | Too many requests | | 5xx | TRAKI's fault. Safe to retry, with the same `Idempotency-Key` for a change | ## Handling errors well [#handling-errors-well] - Branch on `code`, not on `detail`. The wording of `detail` can change; the codes do not. - Log `requestId` with every failure. Support finds the request with it. - Retry 429 after `Retry-After`, and 5xx with a growing wait. Do not retry other 4xx answers unchanged: they will fail the same way. - A record in another account answers 404, never 403. The API does not say whether it exists. The [errors page](/developers/errors) lists every code with what to do. # Paging (/developers/buyer/concepts/paging) Every list in the API pages the same way, with a cursor. ## Asking for a page [#asking-for-a-page] | Parameter | What it does | | -------------- | ----------------------------------------------------------------------- | | `limit` | How many records per page. Default 25, at most 100 | | `cursor` | Where to continue. Pass the `nextCursor` of the page before | | `updatedSince` | Only records changed at or after this time (ISO 8601, with a time zone) | ## The answer [#the-answer] ```json { "data": [{ "id": "…" }, { "id": "…" }], "hasMore": true, "nextCursor": "djE6MDE5MzBhYjQtN2M0ZC03MmUxLWE3ZmMtNGYyZTkwYjA1ZDNi" } ``` Records come newest first. When `hasMore` is `false`, `nextCursor` is `null` and you have them all. New records arriving while you page do not shift your place, because the cursor marks a record, not a position. Treat the cursor as opaque: pass it back exactly as you got it. A cursor TRAKI did not give out is refused with [`validation_error`](/developers/errors#validation_error). ## Reading every page [#reading-every-page] ```js async function readAll(url) { const all = []; let cursor = null; do { const page = new URL(url); page.searchParams.set('limit', '100'); if (cursor) page.searchParams.set('cursor', cursor); const res = await fetch(page, { headers: { Authorization: `Bearer ${process.env.TRAKI_KEY}` }, }); if (!res.ok) throw new Error(`${res.status} ${(await res.json()).code}`); const body = await res.json(); all.push(...body.data); cursor = body.hasMore ? body.nextCursor : null; } while (cursor); return all; } ``` ## Keeping a copy in step with `updatedSince` [#keeping-a-copy-in-step-with-updatedsince] To keep your own copy of a list, read it in full once. After that, ask only for what changed: save the time you start each run, and pass the time of the last run as `updatedSince`. Records that changed in between come back, and you update them in your copy. Running the same sync twice does no harm. # Rate limits (/developers/buyer/concepts/rate-limits) Rate limits keep one busy system from slowing the API for everyone. They are counted per key and per account, separately from use of the portal. ## The limits [#the-limits] Each address also has a wide limit of its own, and many unknown keys from one address in a minute get the address blocked for 15 minutes. ## The headers [#the-headers] Answers to a recognised key carry the state of its limit: | Header | Meaning | | --------------------- | -------------------------------------- | | `RateLimit-Limit` | Requests allowed in the current minute | | `RateLimit-Remaining` | Requests left in the current minute | | `RateLimit-Reset` | Seconds until the minute starts again | Going over answers 429 with [`rate_limited`](/developers/errors#rate_limited) and a `Retry-After` header: the number of seconds to wait. Too many requests running at once answers [`concurrency_limited`](/developers/errors#concurrency_limited). ## Staying inside them [#staying-inside-them] - Watch `RateLimit-Remaining` and slow down before it reaches 0. - On 429, wait for `Retry-After` seconds, then retry. Do not retry at once. - Use webhooks for live updates instead of asking again and again. See [webhooks](./webhooks). - Ask for 100 records a page when you read a whole list. # Security and responsibilities (/developers/buyer/concepts/responsibilities) A key reaches into your account, and your own systems are outside TRAKI's control. So the work is split, and the split is written down. ## What TRAKI guarantees, and what you are responsible for [#what-traki-guarantees-and-what-you-are-responsible-for] | TRAKI guarantees | You are responsible for | | --------------------------------------------------- | ----------------------------------------------------------------- | | A key can only ever reach its own account | Keeping the key on a server, never in a web page or an app | | Buyer and publisher keys see only their own records | Passing the right buyer or publisher when you act on their behalf | | Every webhook is signed | Checking the signature before you trust an event | | Revoking or rolling a key takes effect at once | Rolling a key when someone leaves or a leak is suspected | | A full log of what each key did | Reviewing that log, and setting an IP allow-list on write keys | ## Keeping keys safe [#keeping-keys-safe] - Keep keys in your server's secret store or environment, never in source code. - Never put a key in a web page, a mobile app or anything a browser downloads. - Give each system its own key with only the scopes it needs. One leak then exposes one system. - Set an expiry on keys used by people, and roll keys on a schedule. - If a key may have leaked, roll it on the Developers page. The old secret stops at once, or after the overlap you choose. ## Report a security problem [#report-a-security-problem] If you find a security problem in TRAKI or the Developer API, write to [security@traki.io](mailto:security@traki.io). Include the steps to reproduce it and any request IDs. Please do not test against accounts that are not yours, and give us a reasonable time to fix the problem before you publish it. # Safe retries (/developers/buyer/concepts/retries) A network can fail after TRAKI made a change but before you got the answer. A safe retry lets you send the same change again without making it twice. ## The `Idempotency-Key` header [#the-idempotency-key-header] Send a unique value with every `POST`: ```http POST /v1//… HTTP/1.1 Authorization: Bearer traki_… Idempotency-Key: 6f1c1c62-3a6a-4cf7-9b55-0d7f1f8f2a1e Content-Type: application/json ``` - Use a new value for each new change: a UUID is a good choice. It is 8 to 200 letters, digits, dots, colons, dashes or underscores. - If you retry, send the same value with the same body. TRAKI keeps the first result for 24 hours and answers it again, with the header `Idempotent-Replayed: true`. - The same value with a different body is refused with [`idempotency_key_reused`](/developers/errors#idempotency_key_reused). - A retry while the first request is still running gets [`idempotency_in_progress`](/developers/errors#idempotency_in_progress). Wait a moment and retry again. - Routes that move money or buy something require the header and answer [`idempotency_key_required`](/developers/errors#idempotency_key_required) without it. `GET` requests change nothing, so they need no key. ## When to retry [#when-to-retry] | Answer | Retry? | | ----------------------------- | ------------------------------------------------------ | | No answer, or a network error | Yes, with the same `Idempotency-Key` | | 429 | Yes, after `Retry-After` seconds | | 500, 502, 503, 504 | Yes, with a growing wait: 1, 2, 4, 8 seconds and so on | | Any other 4xx | No. Fix the request first | # Scopes (/developers/buyer/concepts/scopes) A scope says what a key may do with one kind of record. It is written `resource:read` or `resource:write`, for example `buyers:read`. A `write` scope includes `read` of the same resource. A key without the scope a route needs gets [`scope_missing`](/developers/errors#scope_missing), and `errors.scope` names the scope. Every reference page lists the scope its route needs. ## The scopes of the [#the-scopes-of-the-] Scopes marked "in use" are needed by a route that exists today. The others are for routes in later releases; a key can hold them already. ## Presets [#presets] When you make a key on the Developers page you pick a preset or tick scopes one by one. - **Read only.** Every `read` scope. - **Full access.** Every scope except the high-risk ones. - **Custom.** Only the scopes you tick. High-risk scopes move money, buy numbers or issue keys. They are never part of a preset, each must be ticked on its own, and a key that holds one must have an IP allow-list. ## Give each system only what it needs [#give-each-system-only-what-it-needs] A dashboard needs `reports:read`. A system that copies your calls needs `calls:read`. Neither needs `write`. Narrow keys limit what a leaked key can do. # Test mode (/developers/buyer/concepts/test-mode) Test keys contain `_test_`: they start . They work on a separate test copy of the account, with sample data, no real calls and no charges. Live keys contain `_live_` and work on real data. The first test key an account makes creates its test account: a separate copy named after the account, with two sample buyers, two sample publishers, a sample call campaign and a few sample calls. A Buyer or Publisher API test key acts as one of the sample buyers or publishers. Test requests show in your request log marked as test mode, and test keys have lower rate limits than live keys. ## What test mode is [#what-test-mode-is] - **Separate data.** A test key never sees live records, and a live key never sees test records. - **Sample data.** Campaigns, buyers, publishers, calls and leads to read and change. - **No real effects.** No calls are placed, no messages are sent and nothing is charged. - **The same rules.** Scopes, limits, errors and webhooks behave as they do live. ## The request tester [#the-request-tester] Each reference page has a tester that sends a real request from your browser. It accepts test keys only, and refuses a live key before anything is sent. The key stays in the page while it is open and is never saved. # Versions (/developers/buyer/concepts/versions) The API has two kinds of version: the major version in the address, and a dated version pinned on each key. ## `/v1` in the address [#v1-in-the-address] Every address starts `/v1/`. A new major version would get a new address, and `/v1` would keep working beside it. ## The dated version: `Traki-Version` [#the-dated-version-traki-version] Each key is pinned to the dated version that was current when it was made. Every answer to a recognised key carries it in the `Traki-Version` header. The current version is `2026-12-01`, and it is the only one so far. ## The compatibility promise [#the-compatibility-promise] Within `v1`, TRAKI only adds. These changes can arrive at any time, so write your code to accept them: - new routes; - new optional inputs; - new fields in answers; - new event types. These changes count as breaking, and only ever come with a new dated version: - removing or renaming a field; - changing a field's type; - making an optional input required; - changing a default; - tightening a limit on values. An old dated version stays supported for 12 months after its replacement ships. Answers on an old version then carry a `Sunset` header with the end date. ## Changelog [#changelog] Every change is listed on the [changelog](/developers/changelog). # Webhooks (/developers/buyer/concepts/webhooks) Webhooks send you an event within seconds of something happening, so you do not have to keep asking. TRAKI signs every delivery with the [Standard Webhooks](https://www.standardwebhooks.com/) format, which has ready-made libraries in most languages. ## The event [#the-event] Every event has the same envelope: ```json { "id": "evt_mi7x2k9a3f8c1d0e7b", "type": "call.ended", "createdAt": "2026-12-01T14:03:22.418Z", "data": { "…": "…" } } ``` What a receiver can rely on: - The `id` is the same on every retry, so you can skip an event you already handled. - Order is not guaranteed. When you need the latest state, fetch the record. - Answer within 10 seconds with any 2xx status, then do slow work afterwards. - A failed delivery is retried about 10 times over 3 days, waiting longer each time. An endpoint that fails for 3 days is paused, and its owner is emailed. ## The headers [#the-headers] | Header | What it holds | | ------------------- | ----------------------------------------------------------- | | `webhook-id` | The event's `id` | | `webhook-timestamp` | When this attempt was sent, in seconds since 1970 (UTC) | | `webhook-signature` | One or more signatures, space-separated, each `v1,` | ## Verifying a delivery [#verifying-a-delivery] Never trust an event before checking its signature. An unchecked webhook endpoint lets anyone post fake events to you. 1. Take the endpoint's secret. It starts `whsec_`; the rest is base64. Decode the rest to get the signing key. 2. Join the `webhook-id`, the `webhook-timestamp` and the raw body with dots: `id.timestamp.body`. Use the body exactly as received, before any JSON parsing. 3. Compute HMAC-SHA256 of that text with the key, and base64 it. 4. Compare it, in constant time, with each `v1,` signature in the header. One match is enough. While a secret is being rolled, the old and the new secret both sign for 24 hours. 5. Refuse the event if the timestamp is more than 5 minutes away from your clock. This stops a captured event being sent again. ```js tab="Node" import crypto from 'node:crypto'; // rawBody: the request body as a string, exactly as received. export function verifyWebhook(headers, rawBody, secret) { const id = headers['webhook-id']; const timestamp = headers['webhook-timestamp']; const signatures = headers['webhook-signature'] ?? ''; if (!id || !timestamp) return false; if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64'); const expected = crypto .createHmac('sha256', key) .update(`${id}.${timestamp}.${rawBody}`) .digest(); return signatures.split(' ').some((part) => { const [version, value] = part.split(','); if (version !== 'v1' || !value) return false; const given = Buffer.from(value, 'base64'); return given.length === expected.length && crypto.timingSafeEqual(given, expected); }); } ``` ```python tab="Python" import base64 import hashlib import hmac import time # raw_body: the request body as bytes, exactly as received. def verify_webhook(headers, raw_body: bytes, secret: str) -> bool: msg_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature", "") if not msg_id or not timestamp: return False if abs(time.time() - int(timestamp)) > 300: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{msg_id}.{timestamp}.".encode() + raw_body expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() for part in signatures.split(" "): version, _, value = part.partition(",") if version == "v1" and hmac.compare_digest(value, expected): return True return False ``` ```php tab="PHP" 300) return false; $key = base64_decode(preg_replace('/^whsec_/', '', $secret)); $expected = base64_encode(hash_hmac('sha256', "$id.$timestamp.$rawBody", $key, true)); foreach (explode(' ', $signatures) as $part) { [$version, $value] = array_pad(explode(',', $part, 2), 2, ''); if ($version === 'v1' && hash_equals($expected, $value)) return true; } return false; } ``` In PHP, header names arrive in `$_SERVER` as `HTTP_WEBHOOK_ID` and so on; map them to the names above first. ## Catching up after downtime [#catching-up-after-downtime] Your endpoint can be down for a while without losing anything: deliveries are retried for 3 days. After a longer outage, compare your copy with the lists, using `updatedSince` (see [paging](./paging)). ## Managing endpoints [#managing-endpoints] Endpoints are managed in the portal today, on the Webhooks page, where each has its own secret, a delivery log and a replay button. Routes to manage them from the API arrive in release 2. # Ask for a return (/developers/buyer/guides/ask-for-a-return) Returns and disputes join the Buyer API in its second release, with the `returns:read` and `returns:write` scopes. Until then, ask for returns in your buyer portal. ## How a return works [#how-a-return-works] 1. **Ask for the return** of one lead or call, with a reason from the account's list and a note. 2. **The account decides.** It may accept, refuse or ask for more. The answer of your request says its state. 3. **Follow it.** Read your requests to see their state, or add a webhook endpoint for `lead.returned`. 4. **An accepted return is credited** to your balance, and shows in your ledger. ## Good requests are decided faster [#good-requests-are-decided-faster] - Ask soon. Accounts set a window for returns, and a late request is refused. - Give the reason the account lists, not a reason of your own. - For a call, quote the moment in the recording that shows the problem. Send an `Idempotency-Key` with each request, so a retry cannot ask twice. # Pull the leads you bought (/developers/buyer/guides/pull-leads) Today a Buyer API key answers . The lead feed below ships next, with the `leads:read` scope. Until then, the buyer key that starts `b3m_`, from your buyer portal, keeps reading leads at its current address. ## How the feed works [#how-the-feed-works] The lead feed hands you the leads you bought, **oldest first**, so you can read it like a queue: 1. Ask for a page of leads. 2. Store each one in your system. 3. Ask again with the page's `nextCursor`. When `hasMore` is `false` you are up to date. 4. Save the last cursor. Next time, start from it and you get only what arrived since. Because the order is oldest first, a cursor never skips a lead, even while new ones arrive. ## What a lead shows [#what-a-lead-shows] You see what the account shares with buyers: the answers, the contact details and the consent record, exactly as in your buyer portal. If the account hides a field from buyers, the API hides it too. ## Hear about leads as they arrive [#hear-about-leads-as-they-arrive] Instead of asking every minute, add a webhook endpoint for `lead.assigned` in your buyer portal. Read the feed when an event arrives, and once in a while in case one was missed. See [webhooks](../concepts/webhooks). ## Report an outcome [#report-an-outcome] When you work a lead, tell TRAKI what happened (sold, no answer, wrong number). The account sees it. This needs `leads:write`. # Push a bid or budget (/developers/buyer/guides/push-a-bid) Today a Buyer API key answers . The bid and budget routes ship next, with the `bids:write` scope. Until then, the buyer key that starts `b3m_` keeps pushing bids and budgets at its current address. ## Applied, or waiting for approval [#applied-or-waiting-for-approval] The account decides which of your settings you may change yourself. Every push answers which way it went: | Answer | Meaning | | ----------------- | ------------------------------------------------------------------------------------ | | `applied` | The change was inside what the account lets you change. It is live now | | `pendingApproval` | The change goes to the account as a request. It applies when the account approves it | A bid above the campaign's ceiling always waits for approval. ## Never overwrite a newer change [#never-overwrite-a-newer-change] Each setting has a version. Send the version you read with your change. If someone changed it since, in the portal or from another system, TRAKI refuses your change with [`version_conflict`](/developers/errors#version_conflict) instead of overwriting theirs. Read it again and decide. ## Pause and resume [#pause-and-resume] Pausing stops new calls or leads from reaching you at once, without touching your bid. Resume when you are ready again. ## Make each push safe to retry [#make-each-push-safe-to-retry] Send an `Idempotency-Key` with every change. If the network fails, send the same change with the same key: it is made once. See [safe retries](../concepts/retries). # Buyer API (/developers/buyer) The Buyer API is for a buyer that buys calls or leads from a TRAKI account. It lets your own systems see what you bought and manage your own buying, the same as your buyer portal, and nothing else. - **Address:** `https://api.traki.io/v1/buyer/…` - **Keys start:** - **Who makes keys:** the account you buy from. If the account allows it, you can also make keys in your own buyer portal. ## What it covers [#what-it-covers] | Resource | Read | Change | Release | | -------------------- | ----------------------------------------------------------- | --------------------------------------------------- | ------- | | Your key | The key's details and the account it belongs to | | Now | | Profile | Your details, status, and which fields you may change | | 1 | | Campaigns | Campaigns you buy from, your price, caps and hours | | 1 | | Bids and budgets | Current bid, lead rate, budget, caps, hours | Push a bid, rate, budget or hours; pause and resume | 1 | | Leads | The leads you bought, oldest first, as a feed | Report an outcome | 1 | | Calls | The calls you bought; recordings if the account shares them | Notes, outcome | 2 | | Returns and disputes | Your requests and their state | Ask for a return, raise a dispute | 2 | | Balance and invoices | Balance, ledger, invoices | | 2 | | Webhooks | Your own endpoints and delivery log | Manage them | 2 | ## Rules of this API [#rules-of-this-api] - **The account decides what you see.** Contact details, answers and recordings follow the account's sharing settings, exactly as in your buyer portal. - **Some changes need the account's approval.** A change inside the fields the account lets you change applies at once. Anything else becomes a request for the account to approve. A bid above the campaign's ceiling always waits. The answer says which happened: `applied` or `pendingApproval`. - **The account can switch API access off** for each buyer. - **Older buyer keys keep working.** Keys that start `b3m_` stay live for 12 months after the routes that replace them ship. ## Start here [#start-here] A real answer from the API in five minutes. Read the feed of your leads, oldest first. # Quickstart (/developers/buyer/quickstart) ## 1. Get a key [#1-get-a-key] Ask the account you buy from for a Buyer API key. If the account lets buyers make their own, open the **Developers** page in your buyer portal and choose **New key**. Copy the key: it is shown once. The key starts for real data, or for test mode once it opens. ## 2. Keep the key out of your code [#2-keep-the-key-out-of-your-code] Put the key in an environment variable on the machine you call from. The examples on these pages all read it from `TRAKI_KEY`. ```bash export TRAKI_KEY="paste your key here" ``` ## 3. Ask the API who you are [#3-ask-the-api-who-you-are] `GET` needs no scope, so it works with any key of this part. ## 4. Read the answer [#4-read-the-answer] A `200` answer means the key works. It tells you what the key can do and which account it is locked to: ```json { "keyId": "8Hq2LmNpXr", "name": "Reporting server", "api": "…", "mode": "live", "scopes": ["…"], "version": "2026-12-01", "expiresAt": null, "account": { "name": "Harbor Lane Media", "timezone": "America/New_York", "currency": "USD" }, "holder": null } ``` For a buyer or publisher key, `holder` names the buyer or publisher that holds it. For an account key it is `null`. If the answer is an error, its `code` says why. The most common ones in a first call: | Code | What to do | | ------------------------------------------------------------------- | ------------------------------------------------------- | | [`key_missing`](/developers/errors#key_missing) | Send the header: `Authorization: Bearer $TRAKI_KEY` | | [`key_malformed`](/developers/errors#key_malformed) | Copy the key again, all of it | | [`wrong_api`](/developers/errors#wrong_api) | Use the address of the part your key opens | | [`plan_no_api`](/developers/errors#plan_no_api) | The account needs a paid plan | ## Next [#next] - Read [authentication and keys](./concepts/authentication) and [scopes](./concepts/scopes). - Try a route from the [reference](./reference). Each page has examples in cURL, Node, Python and PHP. # All routes (/developers/buyer/reference) Addresses start `https://api.traki.io/v1/buyer/`. Send your key in the `Authorization` header on every request. This list is built from the same route declarations that run the API, so a new route appears here when it ships. The [changelog](/developers/changelog) says what changed. # Changelog (/developers/changelog) Within `v1`, TRAKI only adds: new routes, new optional inputs, new fields in answers and new event types. A change that could break your code comes with a new dated version. See [versions](/developers/account/concepts/versions). ## 1 December 2026: version 2026-12-01 [#1-december-2026-version-2026-12-01] The first release of the TRAKI Developer API, with everything below. - **Account API changes:** add, change, pause and resume buyers, publishers and call campaigns (and upsert by your own `externalId`), attach and detach their buyers and publishers, assign numbers, manage webhooks and the suppression list. Creating a buyer or publisher sends no email unless you ask. Every change takes an `Idempotency-Key`; edits take `ifVersion`. - **Buyer API and Publisher API:** each party's own campaigns, calls, leads, earnings or billing, through the same masking as their portals; buyers push bids and budgets and place lead orders. - **Lead orders and wallets:** read and manage lead orders, wallets and payments. - **Events:** webhooks signed the Standard Webhooks way, retried for about three days, and eight record-change events (`buyer.created` … `number.released`). `GET /v1/account/events` holds 30 days for catching up. - **Test mode:** `_test_` keys work on a sandbox copy of your account with sample data. - **Acting for your parties:** the `Traki-On-Behalf-Of` header, partner keys (`/v1/account/partner-keys`) and portal sessions for your own web pages (`/v1/account/portal-sessions`). - **TypeScript library:** generated from these specs. - **All three parts:** `GET /v1//key` answers the details of the key you sent. - **Account API:** read routes for the account, buyers, publishers, call campaigns, lead campaigns, numbers, calls, leads, statements, payouts and reports. Every list pages with `limit` and `cursor`, and takes `updatedSince`. - **Keys:** the `traki___…` format, scopes per resource, IP allow-lists, expiry and rolling with an overlap. - **Answers:** RFC 9457 errors with a stable `code`, `X-Request-Id` on every answer, `RateLimit-*` headers, and `Traki-Version` on every answer to a recognised key. # Errors (/developers/errors) Every error has the same shape, in all three parts of the API. It is an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem, sent as `application/problem+json`, with three fields of TRAKI's own: ```json { "type": "https://traki.io/developers/errors#scope_missing", "title": "Forbidden", "status": 403, "detail": "This key does not have the calls:read scope. Add it to the key on the Developers page.", "code": "scope_missing", "requestId": "2b1f0c3e-6a1d-4a5e-9f0e-6c1d2b7a8e41", "docUrl": "https://traki.io/developers/errors#scope_missing", "errors": { "scope": "calls:read" } } ``` - **`code`** is stable. Write your code against it, not against `detail`, whose wording can change. - **`requestId`** is also in the `X-Request-Id` header. Quote it when you contact support: it finds the request in your log and in ours. - **`docUrl`** links to the code's entry below. - **`errors`** is there only when there is more to say, such as the fields that failed or the scope that is missing. A key that is missing, unknown, revoked or expired gets the same kind of answer whichever account it might belong to. The API never says whether a key exists in another account. ## Keys [#keys] ### `key_missing` [#key_missing] **401.** The request has no `Authorization` header. Send `Authorization: Bearer `. ### `key_malformed` [#key_malformed] **401.** The header is there, but what follows `Bearer` is not a TRAKI key. Every key ends in a checksum, so a key that was cut short or mistyped is refused before anything else is checked. Copy the key again. ### `key_unknown` [#key_unknown] **401.** The key has the right shape but TRAKI does not know it. It may have been rolled, or it belongs to no account. Many unknown keys from one address in a minute get that address blocked for a while (see [`ip_blocked`](#ip_blocked)). ### `key_revoked` [#key_revoked] **401.** The key was revoked on the Developers page. Make a new one. ### `key_expired` [#key_expired] **401.** The key reached its expiry date. Make a new one on the Developers page. ### `key_suspended` [#key_suspended] **403.** TRAKI suspended this key, usually because it looked leaked or misused. Contact support. ### `key_in_url` [#key_in_url] **400.** The key was sent in the address. Addresses end up in logs and browser history, so the API refuses it. Send the key in the `Authorization` header, and roll the key, since it may have been recorded. ### `key_in_body` [#key_in_body] **400.** The key was sent in the request body. Send it in the `Authorization` header instead. ### `wrong_api` [#wrong_api] **403.** The key opens a different part of the API. An Account API key only opens addresses under `/v1/account/`, a Buyer API key only `/v1/buyer/`, and a Publisher API key only `/v1/publisher/`. ### `scope_missing` [#scope_missing] **403.** The key is valid but lacks the scope this route needs. `errors.scope` names it. Add the scope to the key on the Developers page. Each reference page lists the scope its route needs. ### `ip_not_allowed` [#ip_not_allowed] **403.** The key has an IP allow-list and the request came from an address not on it. Add the address to the key's list. ### `holder_inactive` [#holder_inactive] **403.** The buyer or publisher that holds this key is paused or archived, or the account switched off its API access. `detail` says which. ### `test_mode_unavailable` [#test_mode_unavailable] **403.** Kept for older integrations: test mode is open now and test keys are not refused with this code. ## The account [#the-account] ### `plan_no_api` [#plan_no_api] **403.** API access comes with a paid plan, and this account is on a trial. Choose a plan in the portal. ### `account_inactive` [#account_inactive] **403.** The account is suspended or closed, so all of its keys are refused. ### `api_suspended` [#api_suspended] **403.** TRAKI suspended API access for this account. The portal still works. Contact support. ## Limits [#limits] ### `rate_limited` [#rate_limited] **429.** Too many requests in the current minute, for this key, this account or this address. Wait for the number of seconds in `Retry-After`, then retry. See [rate limits](/developers/account/concepts/rate-limits). ### `concurrency_limited` [#concurrency_limited] **429.** This key already has as many requests running as it may. Wait for one to finish. ### `ip_blocked` [#ip_blocked] **403.** Requests from this address are blocked, either by TRAKI or because it sent many unknown keys in a short time. An automatic block lifts after 15 minutes. ## The request [#the-request] ### `validation_error` [#validation_error] **400.** The request does not match the documented shape: a wrong type, a value out of range, an unknown field or a cursor TRAKI did not give out. `errors` lists each problem with its `path` and `message`. ### `not_found` [#not_found] **404.** No route matches the address, or no record with this ID exists in your account. A record in another account is always "not found", never "forbidden". ### `version_conflict` [#version_conflict] **409.** The record changed since you read it. Fetch it again and redo your change on the new version. ### `on_behalf_invalid` [#on_behalf_invalid] **400.** The `Traki-On-Behalf-Of` header is written wrongly, sent on an Account API route, or names the wrong kind of party for the route. It is written `buyer:` on Buyer API routes and `publisher:` on Publisher API routes. A buyer or publisher of another account answers `not_found`. ### `origin_not_allowed` [#origin_not_allowed] **403.** A browser called from a site that may not use this credential. Only a portal session's own origins (and the docs site's tester, with test keys) may call the API from a page. ## Safe retries [#safe-retries] ### `idempotency_key_required` [#idempotency_key_required] **400.** This change moves money or buys something, so it must carry an `Idempotency-Key` header. See [safe retries](/developers/account/concepts/retries). ### `idempotency_key_reused` [#idempotency_key_reused] **422.** This `Idempotency-Key` was already used for a different request. Use a new key for a new request. ### `idempotency_in_progress` [#idempotency_in_progress] **409.** A request with this `Idempotency-Key` is still running. Retry in a moment to get its result. ## TRAKI's side [#trakis-side] ### `internal_error` [#internal_error] **500.** Something went wrong at TRAKI. It is safe to retry; for a change, retry with the same `Idempotency-Key`. If it keeps happening, contact support with the `requestId`. ### `api_disabled` [#api_disabled] **503.** The whole Developer API is switched off for maintenance. Retry later. ### `api_read_only` [#api_read_only] **503.** The API is read-only for a while: reads work, changes are refused. Retry the change later. ### `route_disabled` [#route_disabled] **503.** This one route is switched off for a while. Other routes still work. ## Other codes [#other-codes] A route may answer a code from the rest of TRAKI, such as a conflict on a record. Those answers have the same shape. When you meet a code that is not listed here, act on the `status`. # TRAKI Developer API (/developers) The TRAKI Developer API lives at `https://api.traki.io/v1`. It has three parts. The address and the key both say which part you are using, and a key for one part is refused by the other two. ## Pick your API [#pick-your-api] | You are | Use | Keys start | Addresses start | | ----------------------------------------- | ----------------- | ------------------ | ---------------- | | The TRAKI customer who owns the account | The Account API | `traki_account_` | `/v1/account/` | | A publisher sending traffic to an account | The Publisher API | `traki_publisher_` | `/v1/publisher/` | | A buyer buying from an account | The Buyer API | `traki_buyer_` | `/v1/buyer/` | ## Quickstart [#quickstart] Every part answers `GET /v1//key` with the details of the key you sent. It needs no scope, so it is the first call to make. ```bash export TRAKI_KEY="traki_account_test_..." # your own key, from the Developers page in the portal curl https://api.traki.io/v1/account/key \ -H "Authorization: Bearer $TRAKI_KEY" ``` Each part has its own five-minute quickstart: [Account](/developers/account/quickstart), [Publisher](/developers/publisher/quickstart), [Buyer](/developers/buyer/quickstart). ## How the docs are organised [#how-the-docs-are-organised] Each part has the same four kinds of page: - **Getting started.** What the part is for, and a quickstart that ends with a real answer. - **Concepts.** Keys, scopes, errors, paging, rate limits, safe retries, versions, test mode and webhooks. - **Guides.** One task from start to finish. - **Reference.** One page per route, built from the same code that runs the API, with examples in cURL, Node, Python and PHP. Every error answer links to its entry on the [errors page](/developers/errors). What TRAKI promises, and what you must do on your side, is on the [security page](/developers/security). ## Status [#status] The Account API reads every part of an account and can add and change buyers, publishers, campaigns, numbers, webhooks and the suppression list. The Buyer API and the Publisher API serve each party's own view. The [changelog](/developers/changelog) lists each change. Test mode is open: a key that contains `_test_` works on a separate test copy of your account with sample data, no real calls and no charges. ## For AI coding assistants [#for-ai-coding-assistants] The docs are also published as plain text: [/developers/llms.txt](/developers/llms.txt) lists every page, and [/developers/llms-full.txt](/developers/llms-full.txt) holds all of them in one file. # Authentication and keys (/developers/publisher/concepts/authentication) Every request carries one key, in one place: the `Authorization` header. ```http GET /v1//key HTTP/1.1 Host: api.traki.io Authorization: Bearer traki__live_8Hq2LmNpXr_… ``` ## The header is the only place [#the-header-is-the-only-place] The API refuses a key anywhere else. A key in the address gets [`key_in_url`](/developers/errors#key_in_url) and a key in the body gets [`key_in_body`](/developers/errors#key_in_body). Addresses end up in server logs, proxies and browser history, so a key sent that way should be rolled. ## The key format [#the-key-format] ```text traki____ traki_account_live_8Hq2LmNpXr_<43 characters><6 characters> ``` | Piece | What it is | | -------- | ------------------------------------------------------------------------------------------------------------------------- | | `traki_` | Marks a TRAKI Developer API key, so secret scanners can find a leaked one | | `part` | `account`, `publisher` or `buyer`: the part of the API the key opens | | `mode` | `live` for real data, `test` for the test copy of the account | | `keyId` | Ten letters and digits. Not secret: it shows in the portal, your request log and support tickets | | `secret` | 43 random letters and digits. Shown once, when the key is made. TRAKI keeps only a hash of the key | | `check` | Six characters of checksum, so a mistyped key is refused at once with [`key_malformed`](/developers/errors#key_malformed) | Keys for this part of the API start . A key for another part is refused with [`wrong_api`](/developers/errors#wrong_api), and the answer names the right part. ## Ask the API about your key [#ask-the-api-about-your-key] `GET` needs no scope. It answers the key's name, mode, scopes, pinned version, expiry and the account it belongs to. Use it to check a key before you rely on it. ## What a key can carry [#what-a-key-can-carry] - **Scopes.** What the key may read and change. See [scopes](./scopes). - **An IP allow-list.** Addresses or ranges the key may be used from. Others get [`ip_not_allowed`](/developers/errors#ip_not_allowed). Keys with a high-risk scope must have one. - **An expiry.** 30, 90 or 365 days, or none. - **A pinned version.** The dated API version the key was made on. See [versions](./versions). ## Rolling a key [#rolling-a-key] Rolling gives a key a new secret and keeps its ID, scopes and settings. You choose how long the old secret keeps working: not at all, 1 hour, 24 hours or 7 days. Deploy the new secret within that time. Revoking stops a key at once and for good. # Errors (/developers/publisher/concepts/errors) When a request fails, the answer is an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem with a stable `code`, the `requestId` and a `docUrl` that links to the code's entry on the [errors page](/developers/errors). ```json { "type": "https://traki.io/developers/errors#key_missing", "title": "Unauthorized", "status": 401, "detail": "Send your key in the Authorization header: \"Authorization: Bearer traki_…\".", "code": "key_missing", "requestId": "2b1f0c3e-6a1d-4a5e-9f0e-6c1d2b7a8e41", "docUrl": "https://traki.io/developers/errors#key_missing" } ``` ## Status codes [#status-codes] | Status | Meaning | | ------------- | -------------------------------------------------------------------------- | | 200, 201, 204 | It worked | | 400 | The request is malformed | | 401 | No key, or the key is unknown, revoked or expired | | 403 | The key is valid but lacks the scope or the plan, or opens another part | | 404 | No such route, or no such record in your account | | 409 | A conflict: a stale version, or the same idempotency key still running | | 422 | The fields are well formed but not acceptable | | 429 | Too many requests | | 5xx | TRAKI's fault. Safe to retry, with the same `Idempotency-Key` for a change | ## Handling errors well [#handling-errors-well] - Branch on `code`, not on `detail`. The wording of `detail` can change; the codes do not. - Log `requestId` with every failure. Support finds the request with it. - Retry 429 after `Retry-After`, and 5xx with a growing wait. Do not retry other 4xx answers unchanged: they will fail the same way. - A record in another account answers 404, never 403. The API does not say whether it exists. The [errors page](/developers/errors) lists every code with what to do. # Paging (/developers/publisher/concepts/paging) Every list in the API pages the same way, with a cursor. ## Asking for a page [#asking-for-a-page] | Parameter | What it does | | -------------- | ----------------------------------------------------------------------- | | `limit` | How many records per page. Default 25, at most 100 | | `cursor` | Where to continue. Pass the `nextCursor` of the page before | | `updatedSince` | Only records changed at or after this time (ISO 8601, with a time zone) | ## The answer [#the-answer] ```json { "data": [{ "id": "…" }, { "id": "…" }], "hasMore": true, "nextCursor": "djE6MDE5MzBhYjQtN2M0ZC03MmUxLWE3ZmMtNGYyZTkwYjA1ZDNi" } ``` Records come newest first. When `hasMore` is `false`, `nextCursor` is `null` and you have them all. New records arriving while you page do not shift your place, because the cursor marks a record, not a position. Treat the cursor as opaque: pass it back exactly as you got it. A cursor TRAKI did not give out is refused with [`validation_error`](/developers/errors#validation_error). ## Reading every page [#reading-every-page] ```js async function readAll(url) { const all = []; let cursor = null; do { const page = new URL(url); page.searchParams.set('limit', '100'); if (cursor) page.searchParams.set('cursor', cursor); const res = await fetch(page, { headers: { Authorization: `Bearer ${process.env.TRAKI_KEY}` }, }); if (!res.ok) throw new Error(`${res.status} ${(await res.json()).code}`); const body = await res.json(); all.push(...body.data); cursor = body.hasMore ? body.nextCursor : null; } while (cursor); return all; } ``` ## Keeping a copy in step with `updatedSince` [#keeping-a-copy-in-step-with-updatedsince] To keep your own copy of a list, read it in full once. After that, ask only for what changed: save the time you start each run, and pass the time of the last run as `updatedSince`. Records that changed in between come back, and you update them in your copy. Running the same sync twice does no harm. # Rate limits (/developers/publisher/concepts/rate-limits) Rate limits keep one busy system from slowing the API for everyone. They are counted per key and per account, separately from use of the portal. ## The limits [#the-limits] Each address also has a wide limit of its own, and many unknown keys from one address in a minute get the address blocked for 15 minutes. ## The headers [#the-headers] Answers to a recognised key carry the state of its limit: | Header | Meaning | | --------------------- | -------------------------------------- | | `RateLimit-Limit` | Requests allowed in the current minute | | `RateLimit-Remaining` | Requests left in the current minute | | `RateLimit-Reset` | Seconds until the minute starts again | Going over answers 429 with [`rate_limited`](/developers/errors#rate_limited) and a `Retry-After` header: the number of seconds to wait. Too many requests running at once answers [`concurrency_limited`](/developers/errors#concurrency_limited). ## Staying inside them [#staying-inside-them] - Watch `RateLimit-Remaining` and slow down before it reaches 0. - On 429, wait for `Retry-After` seconds, then retry. Do not retry at once. - Use webhooks for live updates instead of asking again and again. See [webhooks](./webhooks). - Ask for 100 records a page when you read a whole list. # Security and responsibilities (/developers/publisher/concepts/responsibilities) A key reaches into your account, and your own systems are outside TRAKI's control. So the work is split, and the split is written down. ## What TRAKI guarantees, and what you are responsible for [#what-traki-guarantees-and-what-you-are-responsible-for] | TRAKI guarantees | You are responsible for | | --------------------------------------------------- | ----------------------------------------------------------------- | | A key can only ever reach its own account | Keeping the key on a server, never in a web page or an app | | Buyer and publisher keys see only their own records | Passing the right buyer or publisher when you act on their behalf | | Every webhook is signed | Checking the signature before you trust an event | | Revoking or rolling a key takes effect at once | Rolling a key when someone leaves or a leak is suspected | | A full log of what each key did | Reviewing that log, and setting an IP allow-list on write keys | ## Keeping keys safe [#keeping-keys-safe] - Keep keys in your server's secret store or environment, never in source code. - Never put a key in a web page, a mobile app or anything a browser downloads. - Give each system its own key with only the scopes it needs. One leak then exposes one system. - Set an expiry on keys used by people, and roll keys on a schedule. - If a key may have leaked, roll it on the Developers page. The old secret stops at once, or after the overlap you choose. ## Report a security problem [#report-a-security-problem] If you find a security problem in TRAKI or the Developer API, write to [security@traki.io](mailto:security@traki.io). Include the steps to reproduce it and any request IDs. Please do not test against accounts that are not yours, and give us a reasonable time to fix the problem before you publish it. # Safe retries (/developers/publisher/concepts/retries) A network can fail after TRAKI made a change but before you got the answer. A safe retry lets you send the same change again without making it twice. ## The `Idempotency-Key` header [#the-idempotency-key-header] Send a unique value with every `POST`: ```http POST /v1//… HTTP/1.1 Authorization: Bearer traki_… Idempotency-Key: 6f1c1c62-3a6a-4cf7-9b55-0d7f1f8f2a1e Content-Type: application/json ``` - Use a new value for each new change: a UUID is a good choice. It is 8 to 200 letters, digits, dots, colons, dashes or underscores. - If you retry, send the same value with the same body. TRAKI keeps the first result for 24 hours and answers it again, with the header `Idempotent-Replayed: true`. - The same value with a different body is refused with [`idempotency_key_reused`](/developers/errors#idempotency_key_reused). - A retry while the first request is still running gets [`idempotency_in_progress`](/developers/errors#idempotency_in_progress). Wait a moment and retry again. - Routes that move money or buy something require the header and answer [`idempotency_key_required`](/developers/errors#idempotency_key_required) without it. `GET` requests change nothing, so they need no key. ## When to retry [#when-to-retry] | Answer | Retry? | | ----------------------------- | ------------------------------------------------------ | | No answer, or a network error | Yes, with the same `Idempotency-Key` | | 429 | Yes, after `Retry-After` seconds | | 500, 502, 503, 504 | Yes, with a growing wait: 1, 2, 4, 8 seconds and so on | | Any other 4xx | No. Fix the request first | # Scopes (/developers/publisher/concepts/scopes) A scope says what a key may do with one kind of record. It is written `resource:read` or `resource:write`, for example `buyers:read`. A `write` scope includes `read` of the same resource. A key without the scope a route needs gets [`scope_missing`](/developers/errors#scope_missing), and `errors.scope` names the scope. Every reference page lists the scope its route needs. ## The scopes of the [#the-scopes-of-the-] Scopes marked "in use" are needed by a route that exists today. The others are for routes in later releases; a key can hold them already. ## Presets [#presets] When you make a key on the Developers page you pick a preset or tick scopes one by one. - **Read only.** Every `read` scope. - **Full access.** Every scope except the high-risk ones. - **Custom.** Only the scopes you tick. High-risk scopes move money, buy numbers or issue keys. They are never part of a preset, each must be ticked on its own, and a key that holds one must have an IP allow-list. ## Give each system only what it needs [#give-each-system-only-what-it-needs] A dashboard needs `reports:read`. A system that copies your calls needs `calls:read`. Neither needs `write`. Narrow keys limit what a leaked key can do. # Test mode (/developers/publisher/concepts/test-mode) Test keys contain `_test_`: they start . They work on a separate test copy of the account, with sample data, no real calls and no charges. Live keys contain `_live_` and work on real data. The first test key an account makes creates its test account: a separate copy named after the account, with two sample buyers, two sample publishers, a sample call campaign and a few sample calls. A Buyer or Publisher API test key acts as one of the sample buyers or publishers. Test requests show in your request log marked as test mode, and test keys have lower rate limits than live keys. ## What test mode is [#what-test-mode-is] - **Separate data.** A test key never sees live records, and a live key never sees test records. - **Sample data.** Campaigns, buyers, publishers, calls and leads to read and change. - **No real effects.** No calls are placed, no messages are sent and nothing is charged. - **The same rules.** Scopes, limits, errors and webhooks behave as they do live. ## The request tester [#the-request-tester] Each reference page has a tester that sends a real request from your browser. It accepts test keys only, and refuses a live key before anything is sent. The key stays in the page while it is open and is never saved. # Versions (/developers/publisher/concepts/versions) The API has two kinds of version: the major version in the address, and a dated version pinned on each key. ## `/v1` in the address [#v1-in-the-address] Every address starts `/v1/`. A new major version would get a new address, and `/v1` would keep working beside it. ## The dated version: `Traki-Version` [#the-dated-version-traki-version] Each key is pinned to the dated version that was current when it was made. Every answer to a recognised key carries it in the `Traki-Version` header. The current version is `2026-12-01`, and it is the only one so far. ## The compatibility promise [#the-compatibility-promise] Within `v1`, TRAKI only adds. These changes can arrive at any time, so write your code to accept them: - new routes; - new optional inputs; - new fields in answers; - new event types. These changes count as breaking, and only ever come with a new dated version: - removing or renaming a field; - changing a field's type; - making an optional input required; - changing a default; - tightening a limit on values. An old dated version stays supported for 12 months after its replacement ships. Answers on an old version then carry a `Sunset` header with the end date. ## Changelog [#changelog] Every change is listed on the [changelog](/developers/changelog). # Webhooks (/developers/publisher/concepts/webhooks) Webhooks send you an event within seconds of something happening, so you do not have to keep asking. TRAKI signs every delivery with the [Standard Webhooks](https://www.standardwebhooks.com/) format, which has ready-made libraries in most languages. ## The event [#the-event] Every event has the same envelope: ```json { "id": "evt_mi7x2k9a3f8c1d0e7b", "type": "call.ended", "createdAt": "2026-12-01T14:03:22.418Z", "data": { "…": "…" } } ``` What a receiver can rely on: - The `id` is the same on every retry, so you can skip an event you already handled. - Order is not guaranteed. When you need the latest state, fetch the record. - Answer within 10 seconds with any 2xx status, then do slow work afterwards. - A failed delivery is retried about 10 times over 3 days, waiting longer each time. An endpoint that fails for 3 days is paused, and its owner is emailed. ## The headers [#the-headers] | Header | What it holds | | ------------------- | ----------------------------------------------------------- | | `webhook-id` | The event's `id` | | `webhook-timestamp` | When this attempt was sent, in seconds since 1970 (UTC) | | `webhook-signature` | One or more signatures, space-separated, each `v1,` | ## Verifying a delivery [#verifying-a-delivery] Never trust an event before checking its signature. An unchecked webhook endpoint lets anyone post fake events to you. 1. Take the endpoint's secret. It starts `whsec_`; the rest is base64. Decode the rest to get the signing key. 2. Join the `webhook-id`, the `webhook-timestamp` and the raw body with dots: `id.timestamp.body`. Use the body exactly as received, before any JSON parsing. 3. Compute HMAC-SHA256 of that text with the key, and base64 it. 4. Compare it, in constant time, with each `v1,` signature in the header. One match is enough. While a secret is being rolled, the old and the new secret both sign for 24 hours. 5. Refuse the event if the timestamp is more than 5 minutes away from your clock. This stops a captured event being sent again. ```js tab="Node" import crypto from 'node:crypto'; // rawBody: the request body as a string, exactly as received. export function verifyWebhook(headers, rawBody, secret) { const id = headers['webhook-id']; const timestamp = headers['webhook-timestamp']; const signatures = headers['webhook-signature'] ?? ''; if (!id || !timestamp) return false; if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64'); const expected = crypto .createHmac('sha256', key) .update(`${id}.${timestamp}.${rawBody}`) .digest(); return signatures.split(' ').some((part) => { const [version, value] = part.split(','); if (version !== 'v1' || !value) return false; const given = Buffer.from(value, 'base64'); return given.length === expected.length && crypto.timingSafeEqual(given, expected); }); } ``` ```python tab="Python" import base64 import hashlib import hmac import time # raw_body: the request body as bytes, exactly as received. def verify_webhook(headers, raw_body: bytes, secret: str) -> bool: msg_id = headers.get("webhook-id") timestamp = headers.get("webhook-timestamp") signatures = headers.get("webhook-signature", "") if not msg_id or not timestamp: return False if abs(time.time() - int(timestamp)) > 300: return False key = base64.b64decode(secret.removeprefix("whsec_")) signed = f"{msg_id}.{timestamp}.".encode() + raw_body expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode() for part in signatures.split(" "): version, _, value = part.partition(",") if version == "v1" and hmac.compare_digest(value, expected): return True return False ``` ```php tab="PHP" 300) return false; $key = base64_decode(preg_replace('/^whsec_/', '', $secret)); $expected = base64_encode(hash_hmac('sha256', "$id.$timestamp.$rawBody", $key, true)); foreach (explode(' ', $signatures) as $part) { [$version, $value] = array_pad(explode(',', $part, 2), 2, ''); if ($version === 'v1' && hash_equals($expected, $value)) return true; } return false; } ``` In PHP, header names arrive in `$_SERVER` as `HTTP_WEBHOOK_ID` and so on; map them to the names above first. ## Catching up after downtime [#catching-up-after-downtime] Your endpoint can be down for a while without losing anything: deliveries are retried for 3 days. After a longer outage, compare your copy with the lists, using `updatedSince` (see [paging](./paging)). ## Managing endpoints [#managing-endpoints] Endpoints are managed in the portal today, on the Webhooks page, where each has its own secret, a delivery log and a replay button. Routes to manage them from the API arrive in release 2. # Post a lead (/developers/publisher/guides/post-a-lead) ## Lead posts use a posting key, not a Publisher API key [#lead-posts-use-a-posting-key-not-a-publisher-api-key] Each lead campaign you may send to shows its posting key, its address and its fields in your publisher portal. A Publisher API key () only reads your results; it does not send leads. ## The flow [#the-flow] 1. **Collect the lead** with every field the campaign requires, and the consent the campaign needs. 2. **Post it** to the campaign's address with its posting key. 3. **Read the answer.** It says at once whether the lead was accepted or rejected, and why. 4. **Keep the answer's lead code** with your own record, so you can match the two later. ## Getting leads accepted [#getting-leads-accepted] - Send every required field, in the format the campaign lists. - Send phone numbers in E.164 form, like `+13055550123`. - Send the consent text and the time it was given. A campaign can refuse a lead without it. - Do not post the same person twice in a short time: campaigns can reject duplicates. ## Following your leads [#following-your-leads] Leads you sent, accepted or rejected and why, join the Publisher API in release 2 with the `leads:read` scope. Until then, your publisher portal lists them. # Reconcile your earnings (/developers/publisher/guides/reconcile-earnings) Today a Publisher API key answers . Calls join it next; earnings, statements and payouts follow in release 2 with the `earnings:read` scope. ## The idea [#the-idea] You keep your own record of what you sent. TRAKI keeps its record of what converted and what it pays. Reconciling means matching the two, line by line, and explaining every difference. ## The steps [#the-steps] 1. **Read your calls for the period**, each with its code, campaign, duration and whether it was billable. 2. **Match them to your own records** by the time and the number the caller rang. 3. **Read your earnings by day and campaign** and check they add up to the billable calls you counted. 4. **Read the statement** for the period, and the payout that settled it. Read every list with `updatedSince` to pick up late changes, such as a call made billable after a review. See [paging](../concepts/paging). ## When numbers differ [#when-numbers-differ] - A call under the campaign's billable duration earns nothing. Check `durationSec`. - A returned lead or a disputed call can be taken back after the fact. - Statements close on the account's schedule, in the account's time zone. If a difference stays, contact the account with the call or lead code. # Send a ping (/developers/publisher/guides/send-a-ping) A ping asks the account: "I have a caller like this; what would you pay, and where do I send the call?" It is how real-time bidding works for calls. ## Pings use a ping key, not a Publisher API key [#pings-use-a-ping-key-not-a-publisher-api-key] Sending traffic is built for very high volume, so it has its own keys and its own address. Each campaign you may send to shows its ping key and its ping address in your publisher portal. A Publisher API key () only reads your results; it does not send traffic. ## The flow [#the-flow] 1. **Ping** with the caller's area code or ZIP and anything the campaign asks for. 2. **Read the answer.** It is either `reserved`, with the payout, a number to send the call to and a reservation key, or `rejected` or `no-target`, with a reason code. 3. **Send the call** to the number you were given, within the time the reservation lasts. 4. **Confirm** the reservation when the call is placed, with its reservation key. The payout is what the call pays you once it converts, on your terms with that campaign. ## Common reasons for a rejection [#common-reasons-for-a-rejection] | Reason | What it means | | --------------------- | ------------------------------------------------- | | `source_not_approved` | You are not approved to send to this campaign yet | | `no_source_number` | The campaign has no number assigned to you | | `duplicate_caller` | This caller already has a live reservation | ## After the call [#after-the-call] Your calls and their earnings show in the Publisher API: see [reconcile your earnings](./reconcile-earnings). # Publisher API (/developers/publisher) The Publisher API is for a publisher that sends calls or leads to a TRAKI account. It shows your own results and earnings, the same as your publisher portal, and nothing else. - **Address:** `https://api.traki.io/v1/publisher/…` - **Keys start:** - **Who makes keys:** the account you send traffic to. If the account allows it, you can also make keys in your own publisher portal. ## What it covers [#what-it-covers] | Resource | What you can read | Release | | -------------------- | -------------------------------------------------------------- | ------- | | Your key | The key's details and the account it belongs to | Now | | Profile | Your own details and status | 1 | | Campaigns | Campaigns you may send to, and your payout terms | 1 | | Calls | Your own calls, as your portal shows them | 1 | | Leads | Leads you sent, accepted or rejected, and why | 2 | | Numbers | Numbers and pools assigned to you | 2 | | Earnings and payouts | Earnings by day and campaign, statements, payouts | 2 | | Reports | Grouped reports over your own traffic | 2 | | Postbacks | Your own webhook endpoints and delivery log (also change them) | 2 | ## Rules of this API [#rules-of-this-api] - **It reads; it does not change the account.** The one exception is your own webhooks. Changes go through the account. - **It never shows the buyer side.** No buyer names, buyer prices or margins, as in your portal. - **Sending traffic uses its own keys.** Pings and lead posts use the posting keys from your publisher portal, built for high volume. A Publisher API key does not send traffic. See [send a ping](/developers/publisher/guides/send-a-ping) and [post a lead](/developers/publisher/guides/post-a-lead). ## Start here [#start-here] A real answer from the API in five minutes. Match what you sent with what you are paid. # Quickstart (/developers/publisher/quickstart) ## 1. Get a key [#1-get-a-key] Ask the account you send traffic to for a Publisher API key. If the account lets publishers make their own, open the **Developers** page in your publisher portal and choose **New key**. Copy the key: it is shown once. The key starts for real data, or for test mode once it opens. ## 2. Keep the key out of your code [#2-keep-the-key-out-of-your-code] Put the key in an environment variable on the machine you call from. The examples on these pages all read it from `TRAKI_KEY`. ```bash export TRAKI_KEY="paste your key here" ``` ## 3. Ask the API who you are [#3-ask-the-api-who-you-are] `GET` needs no scope, so it works with any key of this part. ## 4. Read the answer [#4-read-the-answer] A `200` answer means the key works. It tells you what the key can do and which account it is locked to: ```json { "keyId": "8Hq2LmNpXr", "name": "Reporting server", "api": "…", "mode": "live", "scopes": ["…"], "version": "2026-12-01", "expiresAt": null, "account": { "name": "Harbor Lane Media", "timezone": "America/New_York", "currency": "USD" }, "holder": null } ``` For a buyer or publisher key, `holder` names the buyer or publisher that holds it. For an account key it is `null`. If the answer is an error, its `code` says why. The most common ones in a first call: | Code | What to do | | ------------------------------------------------------------------- | ------------------------------------------------------- | | [`key_missing`](/developers/errors#key_missing) | Send the header: `Authorization: Bearer $TRAKI_KEY` | | [`key_malformed`](/developers/errors#key_malformed) | Copy the key again, all of it | | [`wrong_api`](/developers/errors#wrong_api) | Use the address of the part your key opens | | [`plan_no_api`](/developers/errors#plan_no_api) | The account needs a paid plan | ## Next [#next] - Read [authentication and keys](./concepts/authentication) and [scopes](./concepts/scopes). - Try a route from the [reference](./reference). Each page has examples in cURL, Node, Python and PHP. # All routes (/developers/publisher/reference) Addresses start `https://api.traki.io/v1/publisher/`. Send your key in the `Authorization` header on every request. This list is built from the same route declarations that run the API, so a new route appears here when it ships. The [changelog](/developers/changelog) says what changed. # Security and responsibilities (/developers/security) A key reaches into your account, and your own systems are outside TRAKI's control. So the work is split, and the split is written down. ## What TRAKI guarantees, and what you are responsible for [#what-traki-guarantees-and-what-you-are-responsible-for] | TRAKI guarantees | You are responsible for | | --------------------------------------------------- | ----------------------------------------------------------------- | | A key can only ever reach its own account | Keeping the key on a server, never in a web page or an app | | Buyer and publisher keys see only their own records | Passing the right buyer or publisher when you act on their behalf | | Every webhook is signed | Checking the signature before you trust an event | | Revoking or rolling a key takes effect at once | Rolling a key when someone leaves or a leak is suspected | | A full log of what each key did | Reviewing that log, and setting an IP allow-list on write keys | ## Keeping keys safe [#keeping-keys-safe] - Keep keys in your server's secret store or environment, never in source code. - Never put a key in a web page, a mobile app or anything a browser downloads. - Give each system its own key with only the scopes it needs. One leak then exposes one system. - Set an expiry on keys used by people, and roll keys on a schedule. - If a key may have leaked, roll it on the Developers page. The old secret stops at once, or after the overlap you choose. ## Report a security problem [#report-a-security-problem] If you find a security problem in TRAKI or the Developer API, write to [security@traki.io](mailto:security@traki.io). Include the steps to reproduce it and any request IDs. Please do not test against accounts that are not yours, and give us a reasonable time to fix the problem before you publish it. # The key making this request (/developers/account/reference/keys/get-key) Answers the Account API key's own details and the account it is locked to. Needs no scope. ```json { "GET /v1/account/key": { "operationId": "get_v1_account_key", "summary": "The key making this request", "description": "Answers the Account API key's own details and the account it is locked to. Needs no scope.", "tags": [ "Keys" ], "x-traki-scope": null, "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "keyId": { "type": "string" }, "name": { "type": "string" }, "api": { "type": "string", "enum": [ "account", "publisher", "buyer" ] }, "mode": { "type": "string", "enum": [ "live", "test" ] }, "scopes": { "type": "array", "items": { "type": "string" } }, "version": { "type": "string" }, "expiresAt": { "type": [ "string", "null" ] }, "account": { "type": "object", "properties": { "name": { "type": "string" }, "timezone": { "type": "string" }, "currency": { "type": "string" } }, "required": [ "name", "timezone", "currency" ], "additionalProperties": false }, "holder": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "keyId", "name", "api", "mode", "scopes", "version", "expiresAt", "account", "holder" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Approve a payout (/developers/account/reference/money/post-payouts-id-approve) Approves a payout waiting for review, so it can be paid. Only a payout in `pending_review` can be approved (422 bad_transition). Needs an Idempotency-Key: sending the same request again with the same key answers as the first did and approves once. ```json { "POST /v1/account/payouts/{id}/approve": { "operationId": "post_v1_account_payouts_id_approve", "summary": "Approve a payout", "description": "Approves a payout waiting for review, so it can be paid. Only a payout in `pending_review` can be approved (422 bad_transition). Needs an Idempotency-Key: sending the same request again with the same key answers as the first did and approves once.", "tags": [ "Money" ], "x-traki-scope": "money:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "note": { "description": "Kept on the payout.", "type": "string", "minLength": 1, "maxLength": 500 } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "statementId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "amount": { "type": "string" }, "currency": { "type": "string" }, "state": { "type": "string" }, "method": { "type": [ "string", "null" ] }, "reference": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "version": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "publisher", "statementId", "amount", "currency", "state", "method", "reference", "paidAt", "version", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Hold a payout (/developers/account/reference/money/post-payouts-id-hold) Holds a payout waiting for review or approved, so it is not paid until released. Needs an Idempotency-Key. ```json { "POST /v1/account/payouts/{id}/hold": { "operationId": "post_v1_account_payouts_id_hold", "summary": "Hold a payout", "description": "Holds a payout waiting for review or approved, so it is not paid until released. Needs an Idempotency-Key.", "tags": [ "Money" ], "x-traki-scope": "money:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "note": { "description": "Kept on the payout.", "type": "string", "minLength": 1, "maxLength": 500 } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "statementId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "amount": { "type": "string" }, "currency": { "type": "string" }, "state": { "type": "string" }, "method": { "type": [ "string", "null" ] }, "reference": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "version": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "publisher", "statementId", "amount", "currency", "state", "method", "reference", "paidAt", "version", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Release a held payout (/developers/account/reference/money/post-payouts-id-release) Puts a held payout back to `pending_review`, to be approved again. Needs an Idempotency-Key. ```json { "POST /v1/account/payouts/{id}/release": { "operationId": "post_v1_account_payouts_id_release", "summary": "Release a held payout", "description": "Puts a held payout back to `pending_review`, to be approved again. Needs an Idempotency-Key.", "tags": [ "Money" ], "x-traki-scope": "money:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "note": { "description": "Kept on the payout.", "type": "string", "minLength": 1, "maxLength": 500 } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "statementId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "amount": { "type": "string" }, "currency": { "type": "string" }, "state": { "type": "string" }, "method": { "type": [ "string", "null" ] }, "reference": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "version": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "publisher", "statementId", "amount", "currency", "state", "method", "reference", "paidAt", "version", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Settle a buyer’s dispute (/developers/account/reference/money/post-disputes-id-settle) Decides an open dispute, as the portal’s Accept and Reject do. `accept` credits the buyer (the disputed amount, or `creditAmount`; 0 accepts with no credit) on the buyer statement covering the charge; `reject` closes it with no credit. A dispute already decided answers 422 dispute_closed. Needs an Idempotency-Key, so a retry credits once. ```json { "POST /v1/account/disputes/{id}/settle": { "operationId": "post_v1_account_disputes_id_settle", "summary": "Settle a buyer’s dispute", "description": "Decides an open dispute, as the portal’s Accept and Reject do. `accept` credits the buyer (the disputed amount, or `creditAmount`; 0 accepts with no credit) on the buyer statement covering the charge; `reject` closes it with no credit. A dispute already decided answers 422 dispute_closed. Needs an Idempotency-Key, so a retry credits once.", "tags": [ "Money" ], "x-traki-scope": "money:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "decision": { "type": "string", "enum": [ "accept", "reject" ] }, "resolution": { "description": "Why, shown to the buyer.", "type": "string", "minLength": 1, "maxLength": 500 }, "creditAmount": { "description": "With accept: the credit, when it is not the disputed amount.", "type": "number", "minimum": 0, "maximum": 100000 } }, "required": [ "decision" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "callId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "leadId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "reason": { "type": "string" }, "amount": { "type": "string" }, "currency": { "type": "string" }, "state": { "type": "string" }, "resolution": { "type": [ "string", "null" ] }, "resolvedAt": { "type": [ "string", "null" ] }, "creditedAmount": { "type": "string" }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "buyer", "callId", "leadId", "reason", "amount", "currency", "state", "resolution", "resolvedAt", "creditedAmount", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Buyer statements and publisher payout statements (/developers/account/reference/money/get-statements) ```json { "GET /v1/account/statements": { "operationId": "get_v1_account_statements", "summary": "Buyer statements and publisher payout statements", "tags": [ "Money" ], "x-traki-scope": "money:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "buyerId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "publisherId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "kind": { "type": "string" }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "periodStart": { "type": "string" }, "periodEnd": { "type": "string" }, "billableCalls": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billableLeads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "amount": { "type": "string" }, "currency": { "type": "string" }, "state": { "type": "string" }, "settledAt": { "type": [ "string", "null" ] }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "kind", "buyer", "publisher", "periodStart", "periodEnd", "billableCalls", "billableLeads", "amount", "currency", "state", "settledAt", "updatedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One statement (/developers/account/reference/money/get-statements-id) ```json { "GET /v1/account/statements/{id}": { "operationId": "get_v1_account_statements_id", "summary": "One statement", "tags": [ "Money" ], "x-traki-scope": "money:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "kind": { "type": "string" }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "periodStart": { "type": "string" }, "periodEnd": { "type": "string" }, "billableCalls": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billableLeads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "amount": { "type": "string" }, "currency": { "type": "string" }, "state": { "type": "string" }, "settledAt": { "type": [ "string", "null" ] }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "kind", "buyer", "publisher", "periodStart", "periodEnd", "billableCalls", "billableLeads", "amount", "currency", "state", "settledAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Payouts to publishers (/developers/account/reference/money/get-payouts) ```json { "GET /v1/account/payouts": { "operationId": "get_v1_account_payouts", "summary": "Payouts to publishers", "tags": [ "Money" ], "x-traki-scope": "money:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "publisherId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "state", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "pending_review", "approved", "paid", "held" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "statementId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "amount": { "type": "string" }, "currency": { "type": "string" }, "state": { "type": "string" }, "method": { "type": [ "string", "null" ] }, "reference": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "version": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "publisher", "statementId", "amount", "currency", "state", "method", "reference", "paidAt", "version", "updatedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One payout (/developers/account/reference/money/get-payouts-id) ```json { "GET /v1/account/payouts/{id}": { "operationId": "get_v1_account_payouts_id", "summary": "One payout", "tags": [ "Money" ], "x-traki-scope": "money:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "statementId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "amount": { "type": "string" }, "currency": { "type": "string" }, "state": { "type": "string" }, "method": { "type": [ "string", "null" ] }, "reference": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "version": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "publisher", "statementId", "amount", "currency", "state", "method", "reference", "paidAt", "version", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Search numbers for sale (/developers/account/reference/buying-numbers/get-numbers-available) Searches the carrier’s numbers by country, type and area code or prefix, as the portal’s Buy numbers search does. Nothing is reserved: order the ones you want with POST /numbers/orders. ```json { "GET /v1/account/numbers/available": { "operationId": "get_v1_account_numbers_available", "summary": "Search numbers for sale", "description": "Searches the carrier’s numbers by country, type and area code or prefix, as the portal’s Buy numbers search does. Nothing is reserved: order the ones you want with POST /numbers/orders.", "tags": [ "Buying numbers" ], "x-traki-scope": "numbers-purchase:read", "parameters": [ { "name": "country", "in": "query", "required": false, "schema": { "default": "US", "type": "string", "enum": [ "US", "CA" ] } }, { "name": "type", "in": "query", "required": false, "schema": { "default": "local", "type": "string", "enum": [ "local", "toll_free" ] } }, { "name": "prefix", "in": "query", "required": false, "schema": { "type": "string", "pattern": "^\\d{3,7}$" } }, { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "number": { "type": "string", "description": "E.164, as an order names it in `phoneNumbers`." }, "type": { "type": "string" }, "country": { "type": "string" }, "locality": { "type": [ "string", "null" ] }, "region": { "type": [ "string", "null" ] }, "features": { "type": "array", "items": { "type": "string" } }, "monthlyPrice": { "type": "string", "description": "The price list’s rent a month, paid from the balance when there is no plan." }, "setupPrice": { "type": "string", "description": "What the number is charged up front by the account’s rule." } }, "required": [ "number", "type", "country", "locality", "region", "features", "monthlyPrice", "setupPrice" ], "additionalProperties": false } }, "currency": { "type": "string" }, "inStock": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991, "description": "Numbers of this type the account already holds on no campaign: worth using first." } }, "required": [ "data", "currency", "inStock" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Order numbers (costs money) (/developers/account/reference/buying-numbers/post-numbers-orders) Buys the numbers chosen from a search (`phoneNumbers`), or a `quantity` (returned numbers the account holds are reused first and the carrier supplies the rest), through the portal’s own purchase flow: the plan’s number limits (402 limit_reached), a card on file (402 card_required) and the balance for setup fees apply as they do in the portal. Each chosen number comes back purchased or failed with its reason. An order for a publisher without purchase bypass waits in `pending_approval`. Needs an Idempotency-Key: the same request sent again with the same key answers as the first did and buys once. ```json { "POST /v1/account/numbers/orders": { "operationId": "post_v1_account_numbers_orders", "summary": "Order numbers (costs money)", "description": "Buys the numbers chosen from a search (`phoneNumbers`), or a `quantity` (returned numbers the account holds are reused first and the carrier supplies the rest), through the portal’s own purchase flow: the plan’s number limits (402 limit_reached), a card on file (402 card_required) and the balance for setup fees apply as they do in the portal. Each chosen number comes back purchased or failed with its reason. An order for a publisher without purchase bypass waits in `pending_approval`. Needs an Idempotency-Key: the same request sent again with the same key answers as the first did and buys once.", "tags": [ "Buying numbers" ], "x-traki-scope": "numbers-purchase:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "type": { "default": "local", "type": "string", "enum": [ "local", "toll_free" ] }, "country": { "default": "US", "type": "string", "enum": [ "US", "CA" ] }, "areaCode": { "description": "With `quantity`: the area code the carrier supplies numbers from.", "type": "string", "pattern": "^\\d{3}$" }, "quantity": { "type": "integer", "minimum": 1, "maximum": 100 }, "phoneNumbers": { "description": "The numbers chosen from GET /numbers/available. Give these or `quantity`, not both.", "minItems": 1, "maxItems": 50, "type": "array", "items": { "type": "string", "pattern": "^\\+\\d{8,15}$" } }, "campaignId": { "description": "A call campaign of the account the numbers go on.", "type": "string", "format": "uuid" }, "publisherId": { "description": "A publisher of the account the numbers are for; it must be approved on the campaign.", "type": "string", "format": "uuid" }, "purposeKind": { "type": "string", "enum": [ "CAMPAIGN_TRACKING", "DNI_POOL", "QUALIFIER_CALLBACK", "LEAD_CALLS", "TESTING", "PORTED", "OTHER" ] }, "purpose": { "type": "string", "maxLength": 200 } }, "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "state": { "type": "string" }, "type": { "type": "string" }, "country": { "type": "string" }, "areaCode": { "type": [ "string", "null" ] }, "requested": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "reused": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991, "description": "Numbers the account already held that the order reused." }, "campaignId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "publisherId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "purposeKind": { "type": [ "string", "null" ] }, "purpose": { "type": [ "string", "null" ] }, "estimateMonthly": { "type": [ "string", "null" ] }, "estimateSetup": { "type": [ "string", "null" ] }, "estimateNote": { "type": [ "string", "null" ] }, "currency": { "type": "string" }, "lines": { "type": "array", "items": { "type": "object", "properties": { "number": { "type": "string" }, "status": { "type": "string" }, "failureReason": { "type": [ "string", "null" ] }, "numberId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "monthlyPrice": { "type": "string" }, "setupPrice": { "type": "string" } }, "required": [ "number", "status", "failureReason", "numberId", "monthlyPrice", "setupPrice" ], "additionalProperties": false } }, "fulfilledAt": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "code", "state", "type", "country", "areaCode", "requested", "reused", "campaignId", "publisherId", "purposeKind", "purpose", "estimateMonthly", "estimateSetup", "estimateNote", "currency", "lines", "fulfilledAt", "createdAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Give a number back to the carrier (/developers/account/reference/buying-numbers/post-numbers-id-carrier-release) Releases a number the account owns at the carrier, for good: it stops ringing and leaves the account’s bill. The portal asks for the release and confirms it in two steps; this route does both. The number must be on no campaign and in no pool (422 number_assigned, pooled_number), and no visitor session may hold it (422 number_leased). `state` is `confirmed`, or `failed` with the carrier’s reason in `checksNote` (the number then stays in the account as returned). To take a number off its campaign without giving it up, use POST /numbers/{id}/release. Needs an Idempotency-Key. ```json { "POST /v1/account/numbers/{id}/carrier-release": { "operationId": "post_v1_account_numbers_id_carrier_release", "summary": "Give a number back to the carrier", "description": "Releases a number the account owns at the carrier, for good: it stops ringing and leaves the account’s bill. The portal asks for the release and confirms it in two steps; this route does both. The number must be on no campaign and in no pool (422 number_assigned, pooled_number), and no visitor session may hold it (422 number_leased). `state` is `confirmed`, or `failed` with the carrier’s reason in `checksNote` (the number then stays in the account as returned). To take a number off its campaign without giving it up, use POST /numbers/{id}/release. Needs an Idempotency-Key.", "tags": [ "Buying numbers" ], "x-traki-scope": "numbers-purchase:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "numberId": { "type": "string", "format": "uuid" }, "number": { "type": "string" }, "state": { "type": "string" }, "checksNote": { "type": [ "string", "null" ] }, "requestedAt": { "type": "string" }, "confirmedAt": { "type": [ "string", "null" ] } }, "required": [ "id", "numberId", "number", "state", "checksNote", "requestedAt", "confirmedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # A call campaign’s routing and bidding settings (/developers/account/reference/routing/get-call-campaigns-id-routing) How a call picks among the campaign’s buyers (routing mode, bid type, floor, ceiling and auction timeout), retries and ring times, the call flow it runs, and each buyer’s tier, weight and bid. ```json { "GET /v1/account/call-campaigns/{id}/routing": { "operationId": "get_v1_account_call_campaigns_id_routing", "summary": "A call campaign’s routing and bidding settings", "description": "How a call picks among the campaign’s buyers (routing mode, bid type, floor, ceiling and auction timeout), retries and ring times, the call flow it runs, and each buyer’s tier, weight and bid.", "tags": [ "Routing" ], "x-traki-scope": "routing:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "campaignId": { "type": "string", "format": "uuid" }, "routingMode": { "type": "string" }, "bidType": { "type": "string" }, "bidFloor": { "type": [ "string", "null" ] }, "bidCeiling": { "type": [ "string", "null" ] }, "bidTimeoutMs": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "duplicateWindowSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "retryEnabled": { "type": "boolean" }, "ringTimeoutSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "routingBudgetSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "maxCallSec": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "callFlowId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "weight": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "status": { "type": "string" } }, "required": [ "buyer", "tier", "weight", "bid", "status" ], "additionalProperties": false } }, "version": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "campaignId", "routingMode", "bidType", "bidFloor", "bidCeiling", "bidTimeoutMs", "duplicateWindowSec", "retryEnabled", "ringTimeoutSec", "routingBudgetSec", "maxCallSec", "callFlowId", "buyers", "version", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a call campaign’s routing (/developers/account/reference/routing/patch-call-campaigns-id-routing) Changes the routing and bidding settings sent and each named buyer’s tier, weight and bid, and leaves the rest. A buyer not on the campaign answers 404. With `ifVersion`, a change based on an older version of the campaign is refused (409 version_conflict). Archived campaigns cannot be changed. ```json { "PATCH /v1/account/call-campaigns/{id}/routing": { "operationId": "patch_v1_account_call_campaigns_id_routing", "summary": "Change a call campaign’s routing", "description": "Changes the routing and bidding settings sent and each named buyer’s tier, weight and bid, and leaves the rest. A buyer not on the campaign answers 404. With `ifVersion`, a change based on an older version of the campaign is refused (409 version_conflict). Archived campaigns cannot be changed.", "tags": [ "Routing" ], "x-traki-scope": "routing:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "routingMode": { "type": "string", "enum": [ "weighted", "priority", "round_robin", "bid" ] }, "bidType": { "type": "string", "enum": [ "fixed", "dynamic", "rtb" ] }, "bidFloor": { "anyOf": [ { "type": "number", "minimum": 0, "maximum": 100000 }, { "type": "null" } ] }, "bidCeiling": { "anyOf": [ { "type": "number", "minimum": 0, "maximum": 100000 }, { "type": "null" } ] }, "bidTimeoutMs": { "type": "integer", "minimum": 200, "maximum": 5000 }, "duplicateWindowSec": { "type": "integer", "minimum": 0, "maximum": 2592000 }, "retryEnabled": { "type": "boolean" }, "ringTimeoutSec": { "type": "integer", "minimum": 5, "maximum": 120 }, "routingBudgetSec": { "type": "integer", "minimum": 10, "maximum": 600 }, "maxCallSec": { "anyOf": [ { "type": "integer", "minimum": 60, "maximum": 14400 }, { "type": "null" } ] }, "callFlowId": { "description": "One of the campaign’s own call flows to run, or null for none. Needs the call flow feature for steps beyond ringing buyers.", "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "buyers": { "description": "Per-buyer routing on this campaign; buyers left out keep theirs.", "maxItems": 200, "type": "array", "items": { "type": "object", "properties": { "buyerId": { "type": "string", "format": "uuid", "description": "A buyer on the campaign." }, "tier": { "type": "integer", "minimum": 1, "maximum": 20 }, "weight": { "type": "integer", "minimum": 0, "maximum": 1000 }, "bid": { "type": "number", "minimum": 0, "maximum": 100000 } }, "required": [ "buyerId" ], "additionalProperties": false } }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "campaignId": { "type": "string", "format": "uuid" }, "routingMode": { "type": "string" }, "bidType": { "type": "string" }, "bidFloor": { "type": [ "string", "null" ] }, "bidCeiling": { "type": [ "string", "null" ] }, "bidTimeoutMs": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "duplicateWindowSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "retryEnabled": { "type": "boolean" }, "ringTimeoutSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "routingBudgetSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "maxCallSec": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "callFlowId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "weight": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "status": { "type": "string" } }, "required": [ "buyer", "tier", "weight", "bid", "status" ], "additionalProperties": false } }, "version": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "campaignId", "routingMode", "bidType", "bidFloor", "bidCeiling", "bidTimeoutMs", "duplicateWindowSec", "retryEnabled", "ringTimeoutSec", "routingBudgetSec", "maxCallSec", "callFlowId", "buyers", "version", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # List call flows (/developers/account/reference/routing/get-call-flows) ```json { "GET /v1/account/call-flows": { "operationId": "get_v1_account_call_flows", "summary": "List call flows", "tags": [ "Routing" ], "x-traki-scope": "routing:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "status", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "draft", "published", "archived" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "campaignId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "status": { "type": "string" }, "publishedVersion": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "publishedAt": { "type": [ "string", "null" ] }, "latestVersion": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "draftRevision": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "name", "description", "campaignId", "status", "publishedVersion", "publishedAt", "latestVersion", "draftRevision", "version", "createdAt", "updatedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One call flow, with its draft (/developers/account/reference/routing/get-call-flows-id) ```json { "GET /v1/account/call-flows/{id}": { "operationId": "get_v1_account_call_flows_id", "summary": "One call flow, with its draft", "tags": [ "Routing" ], "x-traki-scope": "routing:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "campaignId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "status": { "type": "string" }, "publishedVersion": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "publishedAt": { "type": [ "string", "null" ] }, "latestVersion": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "draftRevision": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "draft": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {}, "description": "The draft document: the same JSON the portal’s flow builder edits (schema 1)." }, "draftChanged": { "type": "boolean", "description": "Whether the draft differs from the published version." }, "issues": { "type": "array", "items": { "type": "object", "properties": { "code": { "type": "string" }, "severity": { "type": "string" }, "message": { "type": "string" }, "nodeId": { "type": "string" } }, "required": [ "code", "severity", "message" ], "additionalProperties": false } } }, "required": [ "id", "code", "name", "description", "campaignId", "status", "publishedVersion", "publishedAt", "latestVersion", "draftRevision", "version", "createdAt", "updatedAt", "draft", "draftChanged", "issues" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a call flow’s name, description or draft (/developers/account/reference/routing/patch-call-flows-id) Saves what is sent. `draft` replaces the draft document whole (it is not published until POST /call-flows/{id}/publish); its issues come back with the flow and do not block the save. With `ifVersion`, a change based on an older version is refused (409 version_conflict). Archived flows cannot be changed (422 flow_archived). ```json { "PATCH /v1/account/call-flows/{id}": { "operationId": "patch_v1_account_call_flows_id", "summary": "Change a call flow’s name, description or draft", "description": "Saves what is sent. `draft` replaces the draft document whole (it is not published until POST /call-flows/{id}/publish); its issues come back with the flow and do not block the save. With `ifVersion`, a change based on an older version is refused (409 version_conflict). Archived flows cannot be changed (422 flow_archived).", "tags": [ "Routing" ], "x-traki-scope": "routing:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 2, "maxLength": 80 }, "description": { "anyOf": [ { "type": "string", "maxLength": 300 }, { "type": "null" } ] }, "draft": { "description": "The whole draft document, as GET /call-flows/{id} gives it.", "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "campaignId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "status": { "type": "string" }, "publishedVersion": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "publishedAt": { "type": [ "string", "null" ] }, "latestVersion": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "draftRevision": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "draft": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {}, "description": "The draft document: the same JSON the portal’s flow builder edits (schema 1)." }, "draftChanged": { "type": "boolean", "description": "Whether the draft differs from the published version." }, "issues": { "type": "array", "items": { "type": "object", "properties": { "code": { "type": "string" }, "severity": { "type": "string" }, "message": { "type": "string" }, "nodeId": { "type": "string" } }, "required": [ "code", "severity", "message" ], "additionalProperties": false } } }, "required": [ "id", "code", "name", "description", "campaignId", "status", "publishedVersion", "publishedAt", "latestVersion", "draftRevision", "version", "createdAt", "updatedAt", "draft", "draftChanged", "issues" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Publish a call flow’s draft (/developers/account/reference/routing/post-call-flows-id-publish) Publishes the draft as the flow’s next version; the campaign’s calls run it from then on. The draft is checked again first (422 flow_not_ready, with the issues), a draft equal to the published version is refused (422 flow_unchanged), and a flow on no campaign cannot be published (422 flow_unassigned). With `ifVersion`, a flow changed since is refused (409 version_conflict). ```json { "POST /v1/account/call-flows/{id}/publish": { "operationId": "post_v1_account_call_flows_id_publish", "summary": "Publish a call flow’s draft", "description": "Publishes the draft as the flow’s next version; the campaign’s calls run it from then on. The draft is checked again first (422 flow_not_ready, with the issues), a draft equal to the published version is refused (422 flow_unchanged), and a flow on no campaign cannot be published (422 flow_unassigned). With `ifVersion`, a flow changed since is refused (409 version_conflict).", "tags": [ "Routing" ], "x-traki-scope": "routing:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "note": { "description": "What changed, kept on the version.", "type": "string", "maxLength": 200 }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "campaignId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "status": { "type": "string" }, "publishedVersion": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "publishedAt": { "type": [ "string", "null" ] }, "latestVersion": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "draftRevision": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "draft": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {}, "description": "The draft document: the same JSON the portal’s flow builder edits (schema 1)." }, "draftChanged": { "type": "boolean", "description": "Whether the draft differs from the published version." }, "issues": { "type": "array", "items": { "type": "object", "properties": { "code": { "type": "string" }, "severity": { "type": "string" }, "message": { "type": "string" }, "nodeId": { "type": "string" } }, "required": [ "code", "severity", "message" ], "additionalProperties": false } } }, "required": [ "id", "code", "name", "description", "campaignId", "status", "publishedVersion", "publishedAt", "latestVersion", "draftRevision", "version", "createdAt", "updatedAt", "draft", "draftChanged", "issues" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # List lead campaigns, with their buyers and publishers (/developers/account/reference/lead-campaigns/get-lead-campaigns) ```json { "GET /v1/account/lead-campaigns": { "operationId": "get_v1_account_lead_campaigns", "summary": "List lead campaigns, with their buyers and publishers", "tags": [ "Lead campaigns" ], "x-traki-scope": "campaigns:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "externalId", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "maxLength": 200 } }, { "name": "status", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "draft", "active", "paused", "archived" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "distribution": { "type": "string" }, "saleType": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "currency": { "type": "string" }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "price": { "type": "string" } }, "required": [ "buyer", "priority", "price" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "publisher" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "distribution", "saleType", "buyerPrice", "publisherPayout", "currency", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Create a lead campaign (/developers/account/reference/lead-campaigns/post-lead-campaigns) Creates a lead campaign as a draft, with the account’s own traffic on it. Attach buyers and publishers, then POST /lead-campaigns/{id}/resume to activate it. `externalId` must be unique in the account (409 external_id_taken). ```json { "POST /v1/account/lead-campaigns": { "operationId": "post_v1_account_lead_campaigns", "summary": "Create a lead campaign", "description": "Creates a lead campaign as a draft, with the account’s own traffic on it. Attach buyers and publishers, then POST /lead-campaigns/{id}/resume to activate it. `externalId` must be unique in the account (409 external_id_taken).", "tags": [ "Lead campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "externalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The account’s own id for the record, unique in the account." }, "name": { "type": "string", "minLength": 3, "maxLength": 120 }, "vertical": { "type": "string", "minLength": 2, "maxLength": 80 }, "leadTypeId": { "description": "A lead type of the account’s catalog; the vertical then follows its label.", "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "distribution": { "description": "How a lead picks among the campaign’s buyers.", "type": "string", "enum": [ "waterfall", "round_robin", "weighted", "bid", "all" ] }, "saleType": { "type": "string", "enum": [ "exclusive", "shared" ] }, "saleLimit": { "description": "How many buyers a shared lead is sold to.", "type": "integer", "minimum": 1, "maximum": 10 }, "buyerPrice": { "type": "number", "minimum": 0, "maximum": 10000 }, "publisherPayout": { "type": "number", "minimum": 0, "maximum": 10000 }, "states": { "description": "US states taken; empty takes all.", "maxItems": 60, "type": "array", "items": { "type": "string", "enum": [ "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY" ] } }, "returnsAllowed": { "type": "boolean" }, "returnWindowDays": { "type": "integer", "minimum": 0, "maximum": 60 }, "isTest": { "description": "A test campaign: left out of every figure; every lead it takes is a test lead.", "type": "boolean" } }, "required": [ "name", "vertical" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "distribution": { "type": "string" }, "saleType": { "type": "string" }, "saleLimit": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "currency": { "type": "string" }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "weight": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "price": { "type": "string" }, "status": { "type": "string" } }, "required": [ "buyer", "priority", "weight", "price", "status" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "status": { "type": "string" }, "testMode": { "type": "boolean" } }, "required": [ "publisher", "status", "testMode" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "distribution", "saleType", "saleLimit", "buyerPrice", "publisherPayout", "currency", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One lead campaign (/developers/account/reference/lead-campaigns/get-lead-campaigns-id) ```json { "GET /v1/account/lead-campaigns/{id}": { "operationId": "get_v1_account_lead_campaigns_id", "summary": "One lead campaign", "tags": [ "Lead campaigns" ], "x-traki-scope": "campaigns:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "distribution": { "type": "string" }, "saleType": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "currency": { "type": "string" }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "price": { "type": "string" } }, "required": [ "buyer", "priority", "price" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "publisher" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "distribution", "saleType", "buyerPrice", "publisherPayout", "currency", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a lead campaign (/developers/account/reference/lead-campaigns/patch-lead-campaigns-id) Changes the fields sent and leaves the rest. An exclusive campaign sells each lead once (422 sale_limit for a sale limit above 1). With `ifVersion`, a change based on an older version is refused. Archived campaigns cannot be changed. ```json { "PATCH /v1/account/lead-campaigns/{id}": { "operationId": "patch_v1_account_lead_campaigns_id", "summary": "Change a lead campaign", "description": "Changes the fields sent and leaves the rest. An exclusive campaign sells each lead once (422 sale_limit for a sale limit above 1). With `ifVersion`, a change based on an older version is refused. Archived campaigns cannot be changed.", "tags": [ "Lead campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "externalId": { "anyOf": [ { "type": "string", "minLength": 1, "maxLength": 200, "description": "The account’s own id for the record, unique in the account." }, { "type": "null" } ] }, "name": { "type": "string", "minLength": 3, "maxLength": 120 }, "vertical": { "type": "string", "minLength": 2, "maxLength": 80 }, "leadTypeId": { "description": "A lead type of the account’s catalog; the vertical then follows its label.", "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "distribution": { "description": "How a lead picks among the campaign’s buyers.", "type": "string", "enum": [ "waterfall", "round_robin", "weighted", "bid", "all" ] }, "saleType": { "type": "string", "enum": [ "exclusive", "shared" ] }, "saleLimit": { "description": "How many buyers a shared lead is sold to.", "type": "integer", "minimum": 1, "maximum": 10 }, "buyerPrice": { "type": "number", "minimum": 0, "maximum": 10000 }, "publisherPayout": { "type": "number", "minimum": 0, "maximum": 10000 }, "states": { "description": "US states taken; empty takes all.", "maxItems": 60, "type": "array", "items": { "type": "string", "enum": [ "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY" ] } }, "returnsAllowed": { "type": "boolean" }, "returnWindowDays": { "type": "integer", "minimum": 0, "maximum": 60 }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "distribution": { "type": "string" }, "saleType": { "type": "string" }, "saleLimit": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "currency": { "type": "string" }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "weight": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "price": { "type": "string" }, "status": { "type": "string" } }, "required": [ "buyer", "priority", "weight", "price", "status" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "status": { "type": "string" }, "testMode": { "type": "boolean" } }, "required": [ "publisher", "status", "testMode" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "distribution", "saleType", "saleLimit", "buyerPrice", "publisherPayout", "currency", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Pause a lead campaign (/developers/account/reference/lead-campaigns/post-lead-campaigns-id-pause) Stops taking new leads; only an active campaign can be paused. ```json { "POST /v1/account/lead-campaigns/{id}/pause": { "operationId": "post_v1_account_lead_campaigns_id_pause", "summary": "Pause a lead campaign", "description": "Stops taking new leads; only an active campaign can be paused.", "tags": [ "Lead campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "distribution": { "type": "string" }, "saleType": { "type": "string" }, "saleLimit": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "currency": { "type": "string" }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "weight": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "price": { "type": "string" }, "status": { "type": "string" } }, "required": [ "buyer", "priority", "weight", "price", "status" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "status": { "type": "string" }, "testMode": { "type": "boolean" } }, "required": [ "publisher", "status", "testMode" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "distribution", "saleType", "saleLimit", "buyerPrice", "publisherPayout", "currency", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Resume or activate a lead campaign (/developers/account/reference/lead-campaigns/post-lead-campaigns-id-resume) Takes leads again. A draft is activated when it is ready (422 campaign_not_ready lists what is missing). ```json { "POST /v1/account/lead-campaigns/{id}/resume": { "operationId": "post_v1_account_lead_campaigns_id_resume", "summary": "Resume or activate a lead campaign", "description": "Takes leads again. A draft is activated when it is ready (422 campaign_not_ready lists what is missing).", "tags": [ "Lead campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "distribution": { "type": "string" }, "saleType": { "type": "string" }, "saleLimit": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "currency": { "type": "string" }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "weight": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "price": { "type": "string" }, "status": { "type": "string" } }, "required": [ "buyer", "priority", "weight", "price", "status" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "status": { "type": "string" }, "testMode": { "type": "boolean" } }, "required": [ "publisher", "status", "testMode" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "distribution", "saleType", "saleLimit", "buyerPrice", "publisherPayout", "currency", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Attach a buyer to a lead campaign (/developers/account/reference/lead-campaigns/post-lead-campaigns-id-buyers) Puts one of the account’s buyers on the campaign at a priority and price. The buyer must take form leads (422 buyer_no_leads); a buyer already on it answers 409 buyer_exists. ```json { "POST /v1/account/lead-campaigns/{id}/buyers": { "operationId": "post_v1_account_lead_campaigns_id_buyers", "summary": "Attach a buyer to a lead campaign", "description": "Puts one of the account’s buyers on the campaign at a priority and price. The buyer must take form leads (422 buyer_no_leads); a buyer already on it answers 409 buyer_exists.", "tags": [ "Lead campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "buyerId": { "type": "string", "format": "uuid" }, "priority": { "type": "integer", "minimum": 1, "maximum": 20 }, "weight": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 1000 }, { "type": "null" } ] }, "price": { "description": "What the buyer pays for a lead.", "type": "number", "minimum": 0, "maximum": 10000 }, "capDay": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 100000 }, { "type": "null" } ] } }, "required": [ "buyerId" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "distribution": { "type": "string" }, "saleType": { "type": "string" }, "saleLimit": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "currency": { "type": "string" }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "weight": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "price": { "type": "string" }, "status": { "type": "string" } }, "required": [ "buyer", "priority", "weight", "price", "status" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "status": { "type": "string" }, "testMode": { "type": "boolean" } }, "required": [ "publisher", "status", "testMode" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "distribution", "saleType", "saleLimit", "buyerPrice", "publisherPayout", "currency", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Detach a buyer from a lead campaign (/developers/account/reference/lead-campaigns/delete-lead-campaigns-id-buyers-buyerId) Takes the buyer off the campaign; it is sent no more of its leads. ```json { "DELETE /v1/account/lead-campaigns/{id}/buyers/{buyerId}": { "operationId": "delete_v1_account_lead_campaigns_id_buyers_buyerId", "summary": "Detach a buyer from a lead campaign", "description": "Takes the buyer off the campaign; it is sent no more of its leads.", "tags": [ "Lead campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "buyerId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "distribution": { "type": "string" }, "saleType": { "type": "string" }, "saleLimit": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "currency": { "type": "string" }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "weight": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "price": { "type": "string" }, "status": { "type": "string" } }, "required": [ "buyer", "priority", "weight", "price", "status" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "status": { "type": "string" }, "testMode": { "type": "boolean" } }, "required": [ "publisher", "status", "testMode" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "distribution", "saleType", "saleLimit", "buyerPrice", "publisherPayout", "currency", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Attach a publisher to a lead campaign (/developers/account/reference/lead-campaigns/post-lead-campaigns-id-publishers) Puts one of the account’s publishers on the campaign, approved, with its payout. A publisher detached earlier is approved again with its terms as they were. It starts in test mode unless `testMode` is false. A publisher already on it answers 409 source_exists. ```json { "POST /v1/account/lead-campaigns/{id}/publishers": { "operationId": "post_v1_account_lead_campaigns_id_publishers", "summary": "Attach a publisher to a lead campaign", "description": "Puts one of the account’s publishers on the campaign, approved, with its payout. A publisher detached earlier is approved again with its terms as they were. It starts in test mode unless `testMode` is false. A publisher already on it answers 409 source_exists.", "tags": [ "Lead campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "publisherId": { "type": "string", "format": "uuid" }, "payoutKind": { "type": "string", "enum": [ "none", "fixed", "share" ] }, "payoutValue": { "anyOf": [ { "type": "number", "minimum": 0, "maximum": 10000 }, { "type": "null" } ] }, "capDay": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 100000 }, { "type": "null" } ] }, "testMode": { "type": "boolean" } }, "required": [ "publisherId" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "distribution": { "type": "string" }, "saleType": { "type": "string" }, "saleLimit": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "currency": { "type": "string" }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "weight": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "price": { "type": "string" }, "status": { "type": "string" } }, "required": [ "buyer", "priority", "weight", "price", "status" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "status": { "type": "string" }, "testMode": { "type": "boolean" } }, "required": [ "publisher", "status", "testMode" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "distribution", "saleType", "saleLimit", "buyerPrice", "publisherPayout", "currency", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Detach a publisher from a lead campaign (/developers/account/reference/lead-campaigns/delete-lead-campaigns-id-publishers-publisherId) Revokes the publisher on the campaign (or declines it, if it was waiting): its leads to this campaign are refused from then on. Its history stays. ```json { "DELETE /v1/account/lead-campaigns/{id}/publishers/{publisherId}": { "operationId": "delete_v1_account_lead_campaigns_id_publishers_publisherId", "summary": "Detach a publisher from a lead campaign", "description": "Revokes the publisher on the campaign (or declines it, if it was waiting): its leads to this campaign are refused from then on. Its history stays.", "tags": [ "Lead campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "publisherId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "distribution": { "type": "string" }, "saleType": { "type": "string" }, "saleLimit": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "currency": { "type": "string" }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "weight": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "price": { "type": "string" }, "status": { "type": "string" } }, "required": [ "buyer", "priority", "weight", "price", "status" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "status": { "type": "string" }, "testMode": { "type": "boolean" } }, "required": [ "publisher", "status", "testMode" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "distribution", "saleType", "saleLimit", "buyerPrice", "publisherPayout", "currency", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The account: profile, current limits and API usage (/developers/account/reference/account/get-account) ```json { "GET /v1/account": { "operationId": "get_v1_account", "summary": "The account: profile, current limits and API usage", "tags": [ "Account" ], "x-traki-scope": "account:read", "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "status": { "type": "string" }, "timezone": { "type": "string" }, "currency": { "type": "string" }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "limits": { "type": "object", "properties": { "perKeyPerMinute": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "perAccountPerMinute": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ "perKeyPerMinute", "perAccountPerMinute" ], "additionalProperties": false }, "usage": { "type": "object", "properties": { "requestsToday": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "requestsThisMonth": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ "requestsToday", "requestsThisMonth" ], "additionalProperties": false } }, "required": [ "id", "name", "status", "timezone", "currency", "modules", "limits", "usage" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # List buyers (/developers/account/reference/buyers/get-buyers) ```json { "GET /v1/account/buyers": { "operationId": "get_v1_account_buyers", "summary": "List buyers", "tags": [ "Buyers" ], "x-traki-scope": "buyers:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "externalId", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "maxLength": 200 } }, { "name": "status", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "active", "paused", "invited", "archived" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "timezone": { "type": "string" }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "available": { "type": "boolean" }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "apiAccess": { "type": "boolean" }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "status", "companyName", "contactName", "contactEmail", "contactPhone", "timezone", "modules", "available", "concurrencyCap", "apiAccess", "version", "createdAt", "updatedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Create a buyer (/developers/account/reference/buyers/post-buyers) Creates a buyer that can take traffic at once. Creation is silent: TRAKI sends no email and no portal invitation unless `invite` is given. `externalId`, the account’s own id, must be unique in the account (409 external_id_taken). ```json { "POST /v1/account/buyers": { "operationId": "post_v1_account_buyers", "summary": "Create a buyer", "description": "Creates a buyer that can take traffic at once. Creation is silent: TRAKI sends no email and no portal invitation unless `invite` is given. `externalId`, the account’s own id, must be unique in the account (409 external_id_taken).", "tags": [ "Buyers" ], "x-traki-scope": "buyers:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "externalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The account’s own id for the record, unique in the account." }, "name": { "type": "string", "minLength": 2, "maxLength": 120 }, "companyName": { "anyOf": [ { "type": "string", "maxLength": 160 }, { "type": "null" } ] }, "contactName": { "anyOf": [ { "type": "string", "maxLength": 120 }, { "type": "null" } ] }, "contactEmail": { "anyOf": [ { "type": "string", "maxLength": 254, "format": "email" }, { "type": "null" } ] }, "contactPhone": { "anyOf": [ { "type": "string", "maxLength": 40 }, { "type": "null" } ] }, "timezone": { "type": "string", "maxLength": 64, "description": "An IANA time zone, such as America/Chicago." }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "additionalProperties": false, "description": "Which modules the party works in: call leads, form leads or both." }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 10000 }, { "type": "null" } ] }, "invite": { "type": "object", "properties": { "email": { "type": "string", "maxLength": 254, "format": "email" }, "message": { "type": "string", "maxLength": 500 } }, "required": [ "email" ], "additionalProperties": false, "description": "Send a portal invitation to this email. Without it the record is created silently: no email and no invitation. Applies only when the call creates the record." } }, "required": [ "name" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "timezone": { "type": "string" }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "available": { "type": "boolean" }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "apiAccess": { "type": "boolean" }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "status", "companyName", "contactName", "contactEmail", "contactPhone", "timezone", "modules", "available", "concurrencyCap", "apiAccess", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One buyer (/developers/account/reference/buyers/get-buyers-id) ```json { "GET /v1/account/buyers/{id}": { "operationId": "get_v1_account_buyers_id", "summary": "One buyer", "tags": [ "Buyers" ], "x-traki-scope": "buyers:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "timezone": { "type": "string" }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "available": { "type": "boolean" }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "apiAccess": { "type": "boolean" }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "status", "companyName", "contactName", "contactEmail", "contactPhone", "timezone", "modules", "available", "concurrencyCap", "apiAccess", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a buyer (/developers/account/reference/buyers/patch-buyers-id) Changes the fields sent and leaves the rest: name, contact, time zone, modules, concurrency cap, API access and the account’s own `externalId`. With `ifVersion`, a change based on an older version is refused. ```json { "PATCH /v1/account/buyers/{id}": { "operationId": "patch_v1_account_buyers_id", "summary": "Change a buyer", "description": "Changes the fields sent and leaves the rest: name, contact, time zone, modules, concurrency cap, API access and the account’s own `externalId`. With `ifVersion`, a change based on an older version is refused.", "tags": [ "Buyers" ], "x-traki-scope": "buyers:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "externalId": { "anyOf": [ { "type": "string", "minLength": 1, "maxLength": 200, "description": "The account’s own id for the record, unique in the account." }, { "type": "null" } ] }, "name": { "type": "string", "minLength": 2, "maxLength": 120 }, "companyName": { "anyOf": [ { "type": "string", "maxLength": 160 }, { "type": "null" } ] }, "contactName": { "anyOf": [ { "type": "string", "maxLength": 120 }, { "type": "null" } ] }, "contactEmail": { "anyOf": [ { "type": "string", "maxLength": 254, "format": "email" }, { "type": "null" } ] }, "contactPhone": { "anyOf": [ { "type": "string", "maxLength": 40 }, { "type": "null" } ] }, "timezone": { "type": "string", "maxLength": 64, "description": "An IANA time zone, such as America/Chicago." }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "additionalProperties": false, "description": "Which modules the party works in: call leads, form leads or both." }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 10000 }, { "type": "null" } ] }, "apiAccess": { "description": "Whether the buyer may use machine access (needs the buyer API feature).", "type": "boolean" }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "timezone": { "type": "string" }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "available": { "type": "boolean" }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "apiAccess": { "type": "boolean" }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "status", "companyName", "contactName", "contactEmail", "contactPhone", "timezone", "modules", "available", "concurrencyCap", "apiAccess", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Create or update a buyer by the account’s own id (/developers/account/reference/buyers/post-buyers-by-external-id-externalId) Creates the buyer when no buyer of the account has this `externalId`, else updates it, so running the same sync twice never makes a duplicate. `created` says which happened. `invite` applies only when the buyer is created. ```json { "POST /v1/account/buyers/by-external-id/{externalId}": { "operationId": "post_v1_account_buyers_by_external_id_externalId", "summary": "Create or update a buyer by the account’s own id", "description": "Creates the buyer when no buyer of the account has this `externalId`, else updates it, so running the same sync twice never makes a duplicate. `created` says which happened. `invite` applies only when the buyer is created.", "tags": [ "Buyers" ], "x-traki-scope": "buyers:write", "parameters": [ { "name": "externalId", "in": "path", "required": true, "schema": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The account’s own id for the record, unique in the account." } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 2, "maxLength": 120 }, "companyName": { "anyOf": [ { "type": "string", "maxLength": 160 }, { "type": "null" } ] }, "contactName": { "anyOf": [ { "type": "string", "maxLength": 120 }, { "type": "null" } ] }, "contactEmail": { "anyOf": [ { "type": "string", "maxLength": 254, "format": "email" }, { "type": "null" } ] }, "contactPhone": { "anyOf": [ { "type": "string", "maxLength": 40 }, { "type": "null" } ] }, "timezone": { "type": "string", "maxLength": 64, "description": "An IANA time zone, such as America/Chicago." }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "additionalProperties": false, "description": "Which modules the party works in: call leads, form leads or both." }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 10000 }, { "type": "null" } ] }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" }, "invite": { "type": "object", "properties": { "email": { "type": "string", "maxLength": 254, "format": "email" }, "message": { "type": "string", "maxLength": 500 } }, "required": [ "email" ], "additionalProperties": false, "description": "Send a portal invitation to this email. Without it the record is created silently: no email and no invitation. Applies only when the call creates the record." } }, "required": [ "name" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "timezone": { "type": "string" }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "available": { "type": "boolean" }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "apiAccess": { "type": "boolean" }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "created": { "type": "boolean" } }, "required": [ "id", "externalId", "code", "name", "status", "companyName", "contactName", "contactEmail", "contactPhone", "timezone", "modules", "available", "concurrencyCap", "apiAccess", "version", "createdAt", "updatedAt", "created" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Pause a buyer (/developers/account/reference/buyers/post-buyers-id-pause) A paused buyer stays on its campaigns but takes no calls or leads until resumed. ```json { "POST /v1/account/buyers/{id}/pause": { "operationId": "post_v1_account_buyers_id_pause", "summary": "Pause a buyer", "description": "A paused buyer stays on its campaigns but takes no calls or leads until resumed.", "tags": [ "Buyers" ], "x-traki-scope": "buyers:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "timezone": { "type": "string" }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "available": { "type": "boolean" }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "apiAccess": { "type": "boolean" }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "status", "companyName", "contactName", "contactEmail", "contactPhone", "timezone", "modules", "available", "concurrencyCap", "apiAccess", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Resume a paused buyer (/developers/account/reference/buyers/post-buyers-id-resume) The buyer takes traffic again. ```json { "POST /v1/account/buyers/{id}/resume": { "operationId": "post_v1_account_buyers_id_resume", "summary": "Resume a paused buyer", "description": "The buyer takes traffic again.", "tags": [ "Buyers" ], "x-traki-scope": "buyers:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "timezone": { "type": "string" }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "available": { "type": "boolean" }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "apiAccess": { "type": "boolean" }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "status", "companyName", "contactName", "contactEmail", "contactPhone", "timezone", "modules", "available", "concurrencyCap", "apiAccess", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # List publishers (/developers/account/reference/publishers/get-publishers) ```json { "GET /v1/account/publishers": { "operationId": "get_v1_account_publishers", "summary": "List publishers", "tags": [ "Publishers" ], "x-traki-scope": "publishers:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "externalId", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "maxLength": 200 } }, { "name": "status", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "active", "invited", "paused", "revoked" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "kind": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "payout": { "type": "object", "properties": { "method": { "type": [ "string", "null" ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "minimum": { "type": [ "string", "null" ] } }, "required": [ "method", "termsDays", "minimum" ], "additionalProperties": false }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "kind", "status", "companyName", "contactName", "contactEmail", "contactPhone", "modules", "payout", "version", "createdAt", "updatedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Create a publisher (/developers/account/reference/publishers/post-publishers) Creates a publisher (a sub-publisher sending traffic under the account). Creation is silent: TRAKI sends no email and no portal invitation unless `invite` is given. `externalId` must be unique in the account (409 external_id_taken). ```json { "POST /v1/account/publishers": { "operationId": "post_v1_account_publishers", "summary": "Create a publisher", "description": "Creates a publisher (a sub-publisher sending traffic under the account). Creation is silent: TRAKI sends no email and no portal invitation unless `invite` is given. `externalId` must be unique in the account (409 external_id_taken).", "tags": [ "Publishers" ], "x-traki-scope": "publishers:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "externalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The account’s own id for the record, unique in the account." }, "name": { "type": "string", "minLength": 2, "maxLength": 120 }, "companyName": { "anyOf": [ { "type": "string", "maxLength": 160 }, { "type": "null" } ] }, "contactName": { "anyOf": [ { "type": "string", "maxLength": 120 }, { "type": "null" } ] }, "contactEmail": { "anyOf": [ { "type": "string", "maxLength": 254, "format": "email" }, { "type": "null" } ] }, "contactPhone": { "anyOf": [ { "type": "string", "maxLength": 40 }, { "type": "null" } ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "additionalProperties": false, "description": "Which modules the party works in: call leads, form leads or both." }, "payout": { "type": "object", "properties": { "method": { "anyOf": [ { "type": "string", "enum": [ "ACH", "WIRE", "PAYPAL", "CHECK" ] }, { "type": "null" } ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 120 }, { "type": "null" } ] }, "minimum": { "anyOf": [ { "type": "number", "minimum": 0, "maximum": 1000000 }, { "type": "null" } ] } }, "additionalProperties": false, "description": "How and when the publisher is paid: method, payment terms in days, minimum payout." }, "invite": { "type": "object", "properties": { "email": { "type": "string", "maxLength": 254, "format": "email" }, "message": { "type": "string", "maxLength": 500 } }, "required": [ "email" ], "additionalProperties": false, "description": "Send a portal invitation to this email. Without it the record is created silently: no email and no invitation. Applies only when the call creates the record." } }, "required": [ "name" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "kind": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "payout": { "type": "object", "properties": { "method": { "type": [ "string", "null" ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "minimum": { "type": [ "string", "null" ] } }, "required": [ "method", "termsDays", "minimum" ], "additionalProperties": false }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "kind", "status", "companyName", "contactName", "contactEmail", "contactPhone", "modules", "payout", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One publisher (/developers/account/reference/publishers/get-publishers-id) ```json { "GET /v1/account/publishers/{id}": { "operationId": "get_v1_account_publishers_id", "summary": "One publisher", "tags": [ "Publishers" ], "x-traki-scope": "publishers:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "kind": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "payout": { "type": "object", "properties": { "method": { "type": [ "string", "null" ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "minimum": { "type": [ "string", "null" ] } }, "required": [ "method", "termsDays", "minimum" ], "additionalProperties": false }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "kind", "status", "companyName", "contactName", "contactEmail", "contactPhone", "modules", "payout", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a publisher (/developers/account/reference/publishers/patch-publishers-id) Changes the fields sent and leaves the rest: name, contact, modules, payout terms and the account’s own `externalId`. With `ifVersion`, a change based on an older version is refused. ```json { "PATCH /v1/account/publishers/{id}": { "operationId": "patch_v1_account_publishers_id", "summary": "Change a publisher", "description": "Changes the fields sent and leaves the rest: name, contact, modules, payout terms and the account’s own `externalId`. With `ifVersion`, a change based on an older version is refused.", "tags": [ "Publishers" ], "x-traki-scope": "publishers:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "externalId": { "anyOf": [ { "type": "string", "minLength": 1, "maxLength": 200, "description": "The account’s own id for the record, unique in the account." }, { "type": "null" } ] }, "name": { "type": "string", "minLength": 2, "maxLength": 120 }, "companyName": { "anyOf": [ { "type": "string", "maxLength": 160 }, { "type": "null" } ] }, "contactName": { "anyOf": [ { "type": "string", "maxLength": 120 }, { "type": "null" } ] }, "contactEmail": { "anyOf": [ { "type": "string", "maxLength": 254, "format": "email" }, { "type": "null" } ] }, "contactPhone": { "anyOf": [ { "type": "string", "maxLength": 40 }, { "type": "null" } ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "additionalProperties": false, "description": "Which modules the party works in: call leads, form leads or both." }, "payout": { "type": "object", "properties": { "method": { "anyOf": [ { "type": "string", "enum": [ "ACH", "WIRE", "PAYPAL", "CHECK" ] }, { "type": "null" } ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 120 }, { "type": "null" } ] }, "minimum": { "anyOf": [ { "type": "number", "minimum": 0, "maximum": 1000000 }, { "type": "null" } ] } }, "additionalProperties": false, "description": "How and when the publisher is paid: method, payment terms in days, minimum payout." }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "kind": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "payout": { "type": "object", "properties": { "method": { "type": [ "string", "null" ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "minimum": { "type": [ "string", "null" ] } }, "required": [ "method", "termsDays", "minimum" ], "additionalProperties": false }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "kind", "status", "companyName", "contactName", "contactEmail", "contactPhone", "modules", "payout", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Create or update a publisher by the account’s own id (/developers/account/reference/publishers/post-publishers-by-external-id-externalId) Creates the publisher when no publisher of the account has this `externalId`, else updates it, so running the same sync twice never makes a duplicate. `created` says which happened. `invite` applies only when the publisher is created. ```json { "POST /v1/account/publishers/by-external-id/{externalId}": { "operationId": "post_v1_account_publishers_by_external_id_externalId", "summary": "Create or update a publisher by the account’s own id", "description": "Creates the publisher when no publisher of the account has this `externalId`, else updates it, so running the same sync twice never makes a duplicate. `created` says which happened. `invite` applies only when the publisher is created.", "tags": [ "Publishers" ], "x-traki-scope": "publishers:write", "parameters": [ { "name": "externalId", "in": "path", "required": true, "schema": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The account’s own id for the record, unique in the account." } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 2, "maxLength": 120 }, "companyName": { "anyOf": [ { "type": "string", "maxLength": 160 }, { "type": "null" } ] }, "contactName": { "anyOf": [ { "type": "string", "maxLength": 120 }, { "type": "null" } ] }, "contactEmail": { "anyOf": [ { "type": "string", "maxLength": 254, "format": "email" }, { "type": "null" } ] }, "contactPhone": { "anyOf": [ { "type": "string", "maxLength": 40 }, { "type": "null" } ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "additionalProperties": false, "description": "Which modules the party works in: call leads, form leads or both." }, "payout": { "type": "object", "properties": { "method": { "anyOf": [ { "type": "string", "enum": [ "ACH", "WIRE", "PAYPAL", "CHECK" ] }, { "type": "null" } ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 120 }, { "type": "null" } ] }, "minimum": { "anyOf": [ { "type": "number", "minimum": 0, "maximum": 1000000 }, { "type": "null" } ] } }, "additionalProperties": false, "description": "How and when the publisher is paid: method, payment terms in days, minimum payout." }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" }, "invite": { "type": "object", "properties": { "email": { "type": "string", "maxLength": 254, "format": "email" }, "message": { "type": "string", "maxLength": 500 } }, "required": [ "email" ], "additionalProperties": false, "description": "Send a portal invitation to this email. Without it the record is created silently: no email and no invitation. Applies only when the call creates the record." } }, "required": [ "name" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "kind": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "payout": { "type": "object", "properties": { "method": { "type": [ "string", "null" ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "minimum": { "type": [ "string", "null" ] } }, "required": [ "method", "termsDays", "minimum" ], "additionalProperties": false }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "created": { "type": "boolean" } }, "required": [ "id", "externalId", "code", "name", "kind", "status", "companyName", "contactName", "contactEmail", "contactPhone", "modules", "payout", "version", "createdAt", "updatedAt", "created" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Pause a publisher (/developers/account/reference/publishers/post-publishers-id-pause) A paused publisher keeps its campaigns and numbers but its traffic is not routed until resumed. The account’s own traffic cannot be paused. ```json { "POST /v1/account/publishers/{id}/pause": { "operationId": "post_v1_account_publishers_id_pause", "summary": "Pause a publisher", "description": "A paused publisher keeps its campaigns and numbers but its traffic is not routed until resumed. The account’s own traffic cannot be paused.", "tags": [ "Publishers" ], "x-traki-scope": "publishers:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "kind": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "payout": { "type": "object", "properties": { "method": { "type": [ "string", "null" ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "minimum": { "type": [ "string", "null" ] } }, "required": [ "method", "termsDays", "minimum" ], "additionalProperties": false }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "kind", "status", "companyName", "contactName", "contactEmail", "contactPhone", "modules", "payout", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Resume a paused publisher (/developers/account/reference/publishers/post-publishers-id-resume) The publisher’s traffic is routed again. ```json { "POST /v1/account/publishers/{id}/resume": { "operationId": "post_v1_account_publishers_id_resume", "summary": "Resume a paused publisher", "description": "The publisher’s traffic is routed again.", "tags": [ "Publishers" ], "x-traki-scope": "publishers:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "kind": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "payout": { "type": "object", "properties": { "method": { "type": [ "string", "null" ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "minimum": { "type": [ "string", "null" ] } }, "required": [ "method", "termsDays", "minimum" ], "additionalProperties": false }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "kind", "status", "companyName", "contactName", "contactEmail", "contactPhone", "modules", "payout", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Approve a publisher’s application to a campaign (/developers/account/reference/publishers/post-publishers-id-approve) Approves the publisher’s pending application to the campaign named in the body, as the portal’s Applications page does. Approval is participation only: no number pool or purchase approval comes with it. 404 when there is no pending application. ```json { "POST /v1/account/publishers/{id}/approve": { "operationId": "post_v1_account_publishers_id_approve", "summary": "Approve a publisher’s application to a campaign", "description": "Approves the publisher’s pending application to the campaign named in the body, as the portal’s Applications page does. Approval is participation only: no number pool or purchase approval comes with it. 404 when there is no pending application.", "tags": [ "Publishers" ], "x-traki-scope": "publishers:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "campaignId": { "type": "string", "format": "uuid", "description": "The call or lead campaign the publisher applied to." }, "note": { "type": "string", "maxLength": 500 } }, "required": [ "campaignId" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "publisher": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "kind": { "type": "string", "enum": [ "call", "lead" ] }, "name": { "type": "string" } }, "required": [ "id", "kind", "name" ], "additionalProperties": false }, "status": { "type": "string" }, "decidedAt": { "type": [ "string", "null" ] } }, "required": [ "id", "publisher", "campaign", "status", "decidedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # List call campaigns, with their buyers and publishers (/developers/account/reference/call-campaigns/get-call-campaigns) ```json { "GET /v1/account/call-campaigns": { "operationId": "get_v1_account_call_campaigns", "summary": "List call campaigns, with their buyers and publishers", "tags": [ "Call campaigns" ], "x-traki-scope": "campaigns:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "externalId", "in": "query", "required": false, "schema": { "type": "string", "minLength": 1, "maxLength": 200 } }, { "name": "status", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "draft", "active", "paused", "archived" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "routingMode": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "billableAfterSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyer", "tier", "bid", "capDay", "capMonth" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "status": { "type": "string" }, "payout": { "type": [ "string", "null" ] } }, "required": [ "publisher", "status", "payout" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "routingMode", "buyerPrice", "publisherPayout", "billableAfterSec", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Create a call campaign (/developers/account/reference/call-campaigns/post-call-campaigns) Creates a call campaign as a draft with the account’s own traffic on it. Attach buyers and publishers, then resume it to start routing (resuming a draft activates it once it has what it needs). Counts against the plan’s campaigns (402 limit_reached). ```json { "POST /v1/account/call-campaigns": { "operationId": "post_v1_account_call_campaigns", "summary": "Create a call campaign", "description": "Creates a call campaign as a draft with the account’s own traffic on it. Attach buyers and publishers, then resume it to start routing (resuming a draft activates it once it has what it needs). Counts against the plan’s campaigns (402 limit_reached).", "tags": [ "Call campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "externalId": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The account’s own id for the record, unique in the account." }, "name": { "type": "string", "minLength": 2, "maxLength": 120 }, "vertical": { "type": "string", "minLength": 2, "maxLength": 80 }, "buyerPrice": { "type": "number", "minimum": 0, "maximum": 100000, "description": "What a buyer pays for a billable call." }, "publisherPayout": { "description": "What a publisher is paid for a billable call, unless its own terms say otherwise.", "type": "number", "minimum": 0, "maximum": 100000 }, "billableAfterSec": { "description": "Connected seconds after which a call is billable.", "type": "integer", "minimum": 0, "maximum": 3600 }, "routingMode": { "type": "string", "enum": [ "weighted", "priority", "round_robin", "bid" ], "description": "How a call picks among the campaign’s buyers." } }, "required": [ "name", "vertical", "buyerPrice" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "routingMode": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "billableAfterSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyer", "tier", "bid", "capDay", "capMonth" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "status": { "type": "string" }, "payout": { "type": [ "string", "null" ] } }, "required": [ "publisher", "status", "payout" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "routingMode", "buyerPrice", "publisherPayout", "billableAfterSec", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One call campaign (/developers/account/reference/call-campaigns/get-call-campaigns-id) ```json { "GET /v1/account/call-campaigns/{id}": { "operationId": "get_v1_account_call_campaigns_id", "summary": "One call campaign", "tags": [ "Call campaigns" ], "x-traki-scope": "campaigns:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "routingMode": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "billableAfterSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyer", "tier", "bid", "capDay", "capMonth" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "status": { "type": "string" }, "payout": { "type": [ "string", "null" ] } }, "required": [ "publisher", "status", "payout" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "routingMode", "buyerPrice", "publisherPayout", "billableAfterSec", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a call campaign (/developers/account/reference/call-campaigns/patch-call-campaigns-id) Changes the fields sent and leaves the rest. With `ifVersion`, a change based on an older version is refused. Archived campaigns cannot be changed. ```json { "PATCH /v1/account/call-campaigns/{id}": { "operationId": "patch_v1_account_call_campaigns_id", "summary": "Change a call campaign", "description": "Changes the fields sent and leaves the rest. With `ifVersion`, a change based on an older version is refused. Archived campaigns cannot be changed.", "tags": [ "Call campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "externalId": { "anyOf": [ { "type": "string", "minLength": 1, "maxLength": 200, "description": "The account’s own id for the record, unique in the account." }, { "type": "null" } ] }, "name": { "type": "string", "minLength": 2, "maxLength": 120 }, "vertical": { "type": "string", "minLength": 2, "maxLength": 80 }, "buyerPrice": { "type": "number", "minimum": 0, "maximum": 100000, "description": "What a buyer pays for a billable call." }, "publisherPayout": { "description": "What a publisher is paid for a billable call, unless its own terms say otherwise.", "type": "number", "minimum": 0, "maximum": 100000 }, "billableAfterSec": { "description": "Connected seconds after which a call is billable.", "type": "integer", "minimum": 0, "maximum": 3600 }, "routingMode": { "type": "string", "enum": [ "weighted", "priority", "round_robin", "bid" ], "description": "How a call picks among the campaign’s buyers." }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "routingMode": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "billableAfterSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyer", "tier", "bid", "capDay", "capMonth" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "status": { "type": "string" }, "payout": { "type": [ "string", "null" ] } }, "required": [ "publisher", "status", "payout" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "routingMode", "buyerPrice", "publisherPayout", "billableAfterSec", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Pause a call campaign (/developers/account/reference/call-campaigns/post-call-campaigns-id-pause) Stops routing new calls; only an active campaign can be paused. ```json { "POST /v1/account/call-campaigns/{id}/pause": { "operationId": "post_v1_account_call_campaigns_id_pause", "summary": "Pause a call campaign", "description": "Stops routing new calls; only an active campaign can be paused.", "tags": [ "Call campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "routingMode": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "billableAfterSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyer", "tier", "bid", "capDay", "capMonth" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "status": { "type": "string" }, "payout": { "type": [ "string", "null" ] } }, "required": [ "publisher", "status", "payout" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "routingMode", "buyerPrice", "publisherPayout", "billableAfterSec", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Resume or activate a call campaign (/developers/account/reference/call-campaigns/post-call-campaigns-id-resume) Starts routing again. A draft is activated when it is ready (422 campaign_not_ready lists what is missing). ```json { "POST /v1/account/call-campaigns/{id}/resume": { "operationId": "post_v1_account_call_campaigns_id_resume", "summary": "Resume or activate a call campaign", "description": "Starts routing again. A draft is activated when it is ready (422 campaign_not_ready lists what is missing).", "tags": [ "Call campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "routingMode": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "billableAfterSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyer", "tier", "bid", "capDay", "capMonth" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "status": { "type": "string" }, "payout": { "type": [ "string", "null" ] } }, "required": [ "publisher", "status", "payout" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "routingMode", "buyerPrice", "publisherPayout", "billableAfterSec", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Attach a buyer to a call campaign (/developers/account/reference/call-campaigns/post-call-campaigns-id-buyers) Puts one of the account’s buyers on the campaign with its bid, tier and caps. The bid defaults to the campaign’s buyer price. 409 buyer_exists when it is already on. ```json { "POST /v1/account/call-campaigns/{id}/buyers": { "operationId": "post_v1_account_call_campaigns_id_buyers", "summary": "Attach a buyer to a call campaign", "description": "Puts one of the account’s buyers on the campaign with its bid, tier and caps. The bid defaults to the campaign’s buyer price. 409 buyer_exists when it is already on.", "tags": [ "Call campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "buyerId": { "type": "string", "format": "uuid" }, "bid": { "type": "number", "minimum": 0, "maximum": 100000 }, "tier": { "description": "Priority tier, 1 first.", "type": "integer", "minimum": 1, "maximum": 20 }, "weight": { "type": "integer", "minimum": 0, "maximum": 1000 }, "capHour": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capDay": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, { "type": "null" } ] }, "concurrency": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyerId" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "routingMode": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "billableAfterSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyer", "tier", "bid", "capDay", "capMonth" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "status": { "type": "string" }, "payout": { "type": [ "string", "null" ] } }, "required": [ "publisher", "status", "payout" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "routingMode", "buyerPrice", "publisherPayout", "billableAfterSec", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Detach a buyer from a call campaign (/developers/account/reference/call-campaigns/delete-call-campaigns-id-buyers-buyerId) Takes the buyer off the campaign; its history on the campaign is kept. ```json { "DELETE /v1/account/call-campaigns/{id}/buyers/{buyerId}": { "operationId": "delete_v1_account_call_campaigns_id_buyers_buyerId", "summary": "Detach a buyer from a call campaign", "description": "Takes the buyer off the campaign; its history on the campaign is kept.", "tags": [ "Call campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "buyerId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "routingMode": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "billableAfterSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyer", "tier", "bid", "capDay", "capMonth" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "status": { "type": "string" }, "payout": { "type": [ "string", "null" ] } }, "required": [ "publisher", "status", "payout" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "routingMode", "buyerPrice", "publisherPayout", "billableAfterSec", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Attach a publisher to a call campaign (/developers/account/reference/call-campaigns/post-call-campaigns-id-publishers) Puts one of the account’s publishers on the campaign with its payout. `approved` (the default) lets it route at once; `invited` asks it to apply. 409 source_exists when it is already on. ```json { "POST /v1/account/call-campaigns/{id}/publishers": { "operationId": "post_v1_account_call_campaigns_id_publishers", "summary": "Attach a publisher to a call campaign", "description": "Puts one of the account’s publishers on the campaign with its payout. `approved` (the default) lets it route at once; `invited` asks it to apply. 409 source_exists when it is already on.", "tags": [ "Call campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "publisherId": { "type": "string", "format": "uuid" }, "status": { "type": "string", "enum": [ "approved", "invited" ] }, "payout": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "fixed", "revshare" ] }, "value": { "anyOf": [ { "type": "number", "minimum": 0, "maximum": 100000 }, { "type": "null" } ], "description": "fixed: the amount per paid call (null pays the campaign payout). revshare: percent of the buyer charge." }, "afterSec": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 3600 }, { "type": "null" } ], "description": "fixed: connected seconds that earn the payout, 0 on connection, null under the campaign’s billable rule. revshare: null." } }, "required": [ "type", "value", "afterSec" ], "additionalProperties": false, "description": "The publisher’s payout on this campaign; the campaign payout when left out." }, "note": { "type": "string", "maxLength": 300 } }, "required": [ "publisherId" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "routingMode": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "billableAfterSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyer", "tier", "bid", "capDay", "capMonth" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "status": { "type": "string" }, "payout": { "type": [ "string", "null" ] } }, "required": [ "publisher", "status", "payout" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "routingMode", "buyerPrice", "publisherPayout", "billableAfterSec", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Detach a publisher from a call campaign (/developers/account/reference/call-campaigns/delete-call-campaigns-id-publishers-publisherId) Takes the publisher off the campaign. Its numbers on the campaign stop routing through it but stay owned, to be assigned again. The account’s own traffic cannot be detached. ```json { "DELETE /v1/account/call-campaigns/{id}/publishers/{publisherId}": { "operationId": "delete_v1_account_call_campaigns_id_publishers_publisherId", "summary": "Detach a publisher from a call campaign", "description": "Takes the publisher off the campaign. Its numbers on the campaign stop routing through it but stay owned, to be assigned again. The account’s own traffic cannot be detached.", "tags": [ "Call campaigns" ], "x-traki-scope": "campaigns:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "publisherId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "routingMode": { "type": "string" }, "buyerPrice": { "type": "string" }, "publisherPayout": { "type": "string" }, "billableAfterSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "buyers": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "tier": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "bid": { "type": "string" }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "capMonth": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "buyer", "tier", "bid", "capDay", "capMonth" ], "additionalProperties": false } }, "publishers": { "type": "array", "items": { "type": "object", "properties": { "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "status": { "type": "string" }, "payout": { "type": [ "string", "null" ] } }, "required": [ "publisher", "status", "payout" ], "additionalProperties": false } }, "version": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "externalId", "code", "name", "vertical", "status", "routingMode", "buyerPrice", "publisherPayout", "billableAfterSec", "buyers", "publishers", "version", "createdAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # List the account’s numbers and their assignments (/developers/account/reference/numbers/get-numbers) ```json { "GET /v1/account/numbers": { "operationId": "get_v1_account_numbers", "summary": "List the account’s numbers and their assignments", "tags": [ "Numbers" ], "x-traki-scope": "numbers:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "publisherId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "number": { "type": "string" }, "name": { "type": [ "string", "null" ] }, "type": { "type": "string" }, "country": { "type": "string" }, "region": { "type": [ "string", "null" ] }, "state": { "type": "string" }, "campaignId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "monthlyRent": { "type": "string" }, "acquiredAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "number", "name", "type", "country", "region", "state", "campaignId", "publisher", "monthlyRent", "acquiredAt", "updatedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One number (/developers/account/reference/numbers/get-numbers-id) ```json { "GET /v1/account/numbers/{id}": { "operationId": "get_v1_account_numbers_id", "summary": "One number", "tags": [ "Numbers" ], "x-traki-scope": "numbers:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "number": { "type": "string" }, "name": { "type": [ "string", "null" ] }, "type": { "type": "string" }, "country": { "type": "string" }, "region": { "type": [ "string", "null" ] }, "state": { "type": "string" }, "campaignId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "monthlyRent": { "type": "string" }, "acquiredAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "number", "name", "type", "country", "region", "state", "campaignId", "publisher", "monthlyRent", "acquiredAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Assign a number to a campaign and publisher (/developers/account/reference/numbers/post-numbers-id-assign) Puts the number on one of the account’s call campaigns, for one of its publishers. Give `campaignId`, `publisherId` or both: without `campaignId` the number stays on its current campaign and changes publisher; without `publisherId` it keeps its publisher. The publisher must be approved on the campaign (422 source_not_approved). Pool numbers follow their pool and cannot be assigned one by one. ```json { "POST /v1/account/numbers/{id}/assign": { "operationId": "post_v1_account_numbers_id_assign", "summary": "Assign a number to a campaign and publisher", "description": "Puts the number on one of the account’s call campaigns, for one of its publishers. Give `campaignId`, `publisherId` or both: without `campaignId` the number stays on its current campaign and changes publisher; without `publisherId` it keeps its publisher. The publisher must be approved on the campaign (422 source_not_approved). Pool numbers follow their pool and cannot be assigned one by one.", "tags": [ "Numbers" ], "x-traki-scope": "numbers:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "campaignId": { "type": "string", "format": "uuid" }, "publisherId": { "type": "string", "format": "uuid" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "number": { "type": "string" }, "name": { "type": [ "string", "null" ] }, "type": { "type": "string" }, "country": { "type": "string" }, "region": { "type": [ "string", "null" ] }, "state": { "type": "string" }, "campaignId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "monthlyRent": { "type": "string" }, "acquiredAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "number", "name", "type", "country", "region", "state", "campaignId", "publisher", "monthlyRent", "acquiredAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Take a number off its campaign (and publisher) (/developers/account/reference/numbers/post-numbers-id-release) Unassigns the number: it leaves its campaign and stops routing calls, and with `publisher: true` it also leaves its publisher and returns to the account’s own use. The account keeps the number. This is not a release to the carrier: giving a number back to the carrier is a purchase-side action that comes with the numbers-purchase routes. Pool numbers follow their pool and cannot be released one by one. ```json { "POST /v1/account/numbers/{id}/release": { "operationId": "post_v1_account_numbers_id_release", "summary": "Take a number off its campaign (and publisher)", "description": "Unassigns the number: it leaves its campaign and stops routing calls, and with `publisher: true` it also leaves its publisher and returns to the account’s own use. The account keeps the number. This is not a release to the carrier: giving a number back to the carrier is a purchase-side action that comes with the numbers-purchase routes. Pool numbers follow their pool and cannot be released one by one.", "tags": [ "Numbers" ], "x-traki-scope": "numbers:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "publisher": { "description": "Also take the number off its publisher. Off by default.", "type": "boolean" } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "number": { "type": "string" }, "name": { "type": [ "string", "null" ] }, "type": { "type": "string" }, "country": { "type": "string" }, "region": { "type": [ "string", "null" ] }, "state": { "type": "string" }, "campaignId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "monthlyRent": { "type": "string" }, "acquiredAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "number", "name", "type", "country", "region", "state", "campaignId", "publisher", "monthlyRent", "acquiredAt", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The call log, newest first (/developers/account/reference/calls/get-calls) ```json { "GET /v1/account/calls": { "operationId": "get_v1_account_calls", "summary": "The call log, newest first", "tags": [ "Calls" ], "x-traki-scope": "calls:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "startedAfter", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "startedBefore", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "buyerId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "publisherId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "billable", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "true", "false" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "campaign": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "caller": { "type": "string" }, "trackingNumberId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "startedAt": { "type": "string" }, "answeredAt": { "type": [ "string", "null" ] }, "endedAt": { "type": [ "string", "null" ] }, "durationSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "connectedSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "stage": { "type": "string" }, "outcome": { "type": [ "string", "null" ] }, "billable": { "type": "boolean" }, "buyerCharge": { "type": "string" }, "publisherPayout": { "type": "string" }, "recordingUrl": { "type": [ "string", "null" ] }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "campaign", "buyer", "publisher", "caller", "trackingNumberId", "startedAt", "answeredAt", "endedAt", "durationSec", "connectedSec", "stage", "outcome", "billable", "buyerCharge", "publisherPayout", "recordingUrl", "updatedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One call (/developers/account/reference/calls/get-calls-id) ```json { "GET /v1/account/calls/{id}": { "operationId": "get_v1_account_calls_id", "summary": "One call", "tags": [ "Calls" ], "x-traki-scope": "calls:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "campaign": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "caller": { "type": "string" }, "trackingNumberId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "startedAt": { "type": "string" }, "answeredAt": { "type": [ "string", "null" ] }, "endedAt": { "type": [ "string", "null" ] }, "durationSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "connectedSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "stage": { "type": "string" }, "outcome": { "type": [ "string", "null" ] }, "billable": { "type": "boolean" }, "buyerCharge": { "type": "string" }, "publisherPayout": { "type": "string" }, "recordingUrl": { "type": [ "string", "null" ] }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "campaign", "buyer", "publisher", "caller", "trackingNumberId", "startedAt", "answeredAt", "endedAt", "durationSec", "connectedSec", "stage", "outcome", "billable", "buyerCharge", "publisherPayout", "recordingUrl", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The lead log, newest first (/developers/account/reference/leads/get-leads) ```json { "GET /v1/account/leads": { "operationId": "get_v1_account_leads", "summary": "The lead log, newest first", "tags": [ "Leads" ], "x-traki-scope": "leads:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "receivedAfter", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "receivedBefore", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "buyerId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "publisherId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "campaign": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "receivedAt": { "type": "string" }, "status": { "type": "string" }, "price": { "type": "string" }, "payout": { "type": "string" }, "firstName": { "type": [ "string", "null" ] }, "lastName": { "type": [ "string", "null" ] }, "email": { "type": [ "string", "null" ] }, "phoneMasked": { "type": [ "string", "null" ] }, "postalCode": { "type": [ "string", "null" ] }, "region": { "type": [ "string", "null" ] }, "rejectReason": { "type": [ "string", "null" ] }, "fields": { "anyOf": [ { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, { "type": "null" } ] }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "campaign", "buyer", "publisher", "receivedAt", "status", "price", "payout", "firstName", "lastName", "email", "phoneMasked", "postalCode", "region", "rejectReason", "fields", "updatedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One lead (/developers/account/reference/leads/get-leads-id) ```json { "GET /v1/account/leads/{id}": { "operationId": "get_v1_account_leads_id", "summary": "One lead", "tags": [ "Leads" ], "x-traki-scope": "leads:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "campaign": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "publisher": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "receivedAt": { "type": "string" }, "status": { "type": "string" }, "price": { "type": "string" }, "payout": { "type": "string" }, "firstName": { "type": [ "string", "null" ] }, "lastName": { "type": [ "string", "null" ] }, "email": { "type": [ "string", "null" ] }, "phoneMasked": { "type": [ "string", "null" ] }, "postalCode": { "type": [ "string", "null" ] }, "region": { "type": [ "string", "null" ] }, "rejectReason": { "type": [ "string", "null" ] }, "fields": { "anyOf": [ { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, { "type": "null" } ] }, "updatedAt": { "type": "string" } }, "required": [ "id", "code", "campaign", "buyer", "publisher", "receivedAt", "status", "price", "payout", "firstName", "lastName", "email", "phoneMasked", "postalCode", "region", "rejectReason", "fields", "updatedAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Call totals over a period, grouped by day, campaign, buyer or publisher (/developers/account/reference/reports/get-reports-calls) ```json { "GET /v1/account/reports/calls": { "operationId": "get_v1_account_reports_calls", "summary": "Call totals over a period, grouped by day, campaign, buyer or publisher", "tags": [ "Reports" ], "x-traki-scope": "reports:read", "parameters": [ { "name": "start", "in": "query", "required": true, "schema": { "type": "string", "format": "date-time" } }, { "name": "end", "in": "query", "required": true, "schema": { "type": "string", "format": "date-time" } }, { "name": "groupBy", "in": "query", "required": false, "schema": { "default": "day", "type": "string", "enum": [ "day", "campaign", "buyer", "publisher" ] } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "buyerId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "publisherId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "start": { "type": "string" }, "end": { "type": "string" }, "groupBy": { "type": "string" }, "rows": { "type": "array", "items": { "type": "object", "properties": { "group": { "type": "string" }, "label": { "type": [ "string", "null" ] }, "calls": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "answered": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billable": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "durationSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "revenue": { "type": "string" }, "payout": { "type": "string" } }, "required": [ "group", "label", "calls", "answered", "billable", "durationSec", "revenue", "payout" ], "additionalProperties": false } } }, "required": [ "start", "end", "groupBy", "rows" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Lead totals over a period, grouped by day, campaign, buyer or publisher (/developers/account/reference/reports/get-reports-leads) ```json { "GET /v1/account/reports/leads": { "operationId": "get_v1_account_reports_leads", "summary": "Lead totals over a period, grouped by day, campaign, buyer or publisher", "tags": [ "Reports" ], "x-traki-scope": "reports:read", "parameters": [ { "name": "start", "in": "query", "required": true, "schema": { "type": "string", "format": "date-time" } }, { "name": "end", "in": "query", "required": true, "schema": { "type": "string", "format": "date-time" } }, { "name": "groupBy", "in": "query", "required": false, "schema": { "default": "day", "type": "string", "enum": [ "day", "campaign", "buyer", "publisher" ] } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "buyerId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "publisherId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "start": { "type": "string" }, "end": { "type": "string" }, "groupBy": { "type": "string" }, "rows": { "type": "array", "items": { "type": "object", "properties": { "group": { "type": "string" }, "label": { "type": [ "string", "null" ] }, "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "sold": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "rejected": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "revenue": { "type": "string" }, "payout": { "type": "string" } }, "required": [ "group", "label", "leads", "sold", "rejected", "revenue", "payout" ], "additionalProperties": false } } }, "required": [ "start", "end", "groupBy", "rows" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Every event of the last 30 days, oldest first, for catching up after downtime (/developers/account/reference/events/get-events) The same events webhooks carry (calls, leads, orders, money and record changes), with the same ids, so a receiver can skip one it already handled. ```json { "GET /v1/account/events": { "operationId": "get_v1_account_events", "summary": "Every event of the last 30 days, oldest first, for catching up after downtime", "description": "The same events webhooks carry (calls, leads, orders, money and record changes), with the same ids, so a receiver can skip one it already handled.", "tags": [ "Events" ], "x-traki-scope": "events:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "type", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 60 } }, { "name": "createdAfter", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string" }, "timestamp": { "type": "string" }, "data": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} } }, "required": [ "id", "type", "timestamp", "data" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Who changed what in the account, newest first (/developers/account/reference/audit-log/get-audit) ```json { "GET /v1/account/audit": { "operationId": "get_v1_account_audit", "summary": "Who changed what in the account, newest first", "tags": [ "Audit log" ], "x-traki-scope": "audit:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 20, "pattern": "^\\d+$" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "at": { "type": "string" }, "actor": { "type": "string" }, "action": { "type": "string" }, "entityType": { "type": "string" }, "entityId": { "type": [ "string", "null" ] }, "summary": { "type": "string" }, "portal": { "type": [ "string", "null" ] } }, "required": [ "id", "at", "actor", "action", "entityType", "entityId", "summary", "portal" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Webhook endpoints (/developers/account/reference/webhooks/get-webhooks) ```json { "GET /v1/account/webhooks": { "operationId": "get_v1_account_webhooks", "summary": "Webhook endpoints", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:read", "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "ownerType": { "type": "string", "enum": [ "WORKSPACE", "SOURCE", "BUYER" ] }, "owner": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string", "enum": [ "ACTIVE", "FAILING", "PAUSED" ] }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "code", "ownerType", "owner", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false } } }, "required": [ "data" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Add a webhook endpoint; its signing secret is answered once (/developers/account/reference/webhooks/post-webhooks) Only public HTTPS addresses are accepted. Events are signed the Standard Webhooks way. ```json { "POST /v1/account/webhooks": { "operationId": "post_v1_account_webhooks", "summary": "Add a webhook endpoint; its signing secret is answered once", "description": "Only public HTTPS addresses are accepted. Events are signed the Standard Webhooks way.", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "url": { "type": "string", "maxLength": 2000, "format": "uri" }, "events": { "minItems": 1, "maxItems": 26, "type": "array", "items": { "type": "string", "enum": [ "call.started", "call.ended", "call.billable", "lead.received", "lead.allocated", "lead.disclosed", "lead.returned", "lead.assigned", "order.paid", "lead.dnc_flagged", "order.filled", "tier.filled", "callback.completed", "sms.status_changed", "statement.closed", "payout.paid", "approval.decided", "alert.fired", "buyer.created", "buyer.updated", "publisher.created", "publisher.updated", "campaign.created", "campaign.updated", "number.assigned", "number.released" ] } }, "owner": { "default": { "type": "account" }, "anyOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "account" } }, "required": [ "type" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "publisher" }, "id": { "type": "string", "format": "uuid" } }, "required": [ "type", "id" ], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "buyer" }, "id": { "type": "string", "format": "uuid" } }, "required": [ "type", "id" ], "additionalProperties": false } ] } }, "required": [ "url", "events" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "endpoint": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "ownerType": { "type": "string", "enum": [ "WORKSPACE", "SOURCE", "BUYER" ] }, "owner": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string", "enum": [ "ACTIVE", "FAILING", "PAUSED" ] }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "code", "ownerType", "owner", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false }, "secret": { "type": "string" } }, "required": [ "endpoint", "secret" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change an endpoint’s address or events (/developers/account/reference/webhooks/patch-webhooks-id) ```json { "PATCH /v1/account/webhooks/{id}": { "operationId": "patch_v1_account_webhooks_id", "summary": "Change an endpoint’s address or events", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "url": { "type": "string", "maxLength": 2000, "format": "uri" }, "events": { "minItems": 1, "maxItems": 26, "type": "array", "items": { "type": "string", "enum": [ "call.started", "call.ended", "call.billable", "lead.received", "lead.allocated", "lead.disclosed", "lead.returned", "lead.assigned", "order.paid", "lead.dnc_flagged", "order.filled", "tier.filled", "callback.completed", "sms.status_changed", "statement.closed", "payout.paid", "approval.decided", "alert.fired", "buyer.created", "buyer.updated", "publisher.created", "publisher.updated", "campaign.created", "campaign.updated", "number.assigned", "number.released" ] } } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "ownerType": { "type": "string", "enum": [ "WORKSPACE", "SOURCE", "BUYER" ] }, "owner": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string", "enum": [ "ACTIVE", "FAILING", "PAUSED" ] }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "code", "ownerType", "owner", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Remove an endpoint (/developers/account/reference/webhooks/delete-webhooks-id) ```json { "DELETE /v1/account/webhooks/{id}": { "operationId": "delete_v1_account_webhooks_id", "summary": "Remove an endpoint", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "deleted": { "type": "boolean", "const": true } }, "required": [ "deleted" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Roll the signing secret; the old one keeps signing for 24 hours (/developers/account/reference/webhooks/post-webhooks-id-roll-secret) ```json { "POST /v1/account/webhooks/{id}/roll-secret": { "operationId": "post_v1_account_webhooks_id_roll_secret", "summary": "Roll the signing secret; the old one keeps signing for 24 hours", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "endpoint": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "ownerType": { "type": "string", "enum": [ "WORKSPACE", "SOURCE", "BUYER" ] }, "owner": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string", "enum": [ "ACTIVE", "FAILING", "PAUSED" ] }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "code", "ownerType", "owner", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false }, "secret": { "type": "string" } }, "required": [ "endpoint", "secret" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Pause an endpoint (events are kept) (/developers/account/reference/webhooks/post-webhooks-id-pause) ```json { "POST /v1/account/webhooks/{id}/pause": { "operationId": "post_v1_account_webhooks_id_pause", "summary": "Pause an endpoint (events are kept)", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "ownerType": { "type": "string", "enum": [ "WORKSPACE", "SOURCE", "BUYER" ] }, "owner": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string", "enum": [ "ACTIVE", "FAILING", "PAUSED" ] }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "code", "ownerType", "owner", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Resume a paused endpoint (/developers/account/reference/webhooks/post-webhooks-id-resume) ```json { "POST /v1/account/webhooks/{id}/resume": { "operationId": "post_v1_account_webhooks_id_resume", "summary": "Resume a paused endpoint", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "ownerType": { "type": "string", "enum": [ "WORKSPACE", "SOURCE", "BUYER" ] }, "owner": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string", "enum": [ "ACTIVE", "FAILING", "PAUSED" ] }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "code", "ownerType", "owner", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # An endpoint’s delivery log (/developers/account/reference/webhooks/get-webhooks-id-deliveries) ```json { "GET /v1/account/webhooks/{id}/deliveries": { "operationId": "get_v1_account_webhooks_id_deliveries", "summary": "An endpoint’s delivery log", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "page", "in": "query", "required": false, "schema": { "default": 1, "type": "integer", "minimum": 1, "maximum": 1000 } }, { "name": "state", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "PENDING", "DELIVERED", "FAILED", "DEAD_LETTER" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "endpoint": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "url": { "type": "string" } }, "required": [ "id", "code", "url" ], "additionalProperties": false }, "eventId": { "type": "string" }, "eventType": { "type": "string" }, "attempts": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "state": { "type": "string", "enum": [ "PENDING", "DELIVERED", "FAILED", "DEAD_LETTER" ] }, "nextAttemptAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "lastAttemptAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "lastResponseCode": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "lastError": { "type": [ "string", "null" ] }, "createdAt": { "type": "string", "format": "date-time" } }, "required": [ "id", "endpoint", "eventId", "eventType", "attempts", "state", "nextAttemptAt", "lastAttemptAt", "lastResponseCode", "lastError", "createdAt" ], "additionalProperties": false } }, "total": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ "data", "total" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Send a delivered or failed event again (/developers/account/reference/webhooks/post-webhook-deliveries-id-replay) ```json { "POST /v1/account/webhook-deliveries/{id}/replay": { "operationId": "post_v1_account_webhook_deliveries_id_replay", "summary": "Send a delivered or failed event again", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "state": { "type": "string" } }, "required": [ "id", "state" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Blocked caller numbers (/developers/account/reference/suppression/get-suppression) ```json { "GET /v1/account/suppression": { "operationId": "get_v1_account_suppression", "summary": "Blocked caller numbers", "tags": [ "Suppression" ], "x-traki-scope": "suppression:read", "parameters": [ { "name": "q", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 40 } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "limit", "in": "query", "required": false, "schema": { "default": 100, "type": "integer", "minimum": 1, "maximum": 500 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "number": { "type": "string" }, "reason": { "type": [ "string", "null" ] }, "scope": { "type": "string" }, "campaign": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "addedBy": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" }, "blockedCalls": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ "id", "number", "reason", "scope", "campaign", "addedBy", "createdAt", "blockedCalls" ], "additionalProperties": false } } }, "required": [ "data" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Block caller numbers, for the account or one campaign (/developers/account/reference/suppression/post-suppression) ```json { "POST /v1/account/suppression": { "operationId": "post_v1_account_suppression", "summary": "Block caller numbers, for the account or one campaign", "tags": [ "Suppression" ], "x-traki-scope": "suppression:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "numbers": { "minItems": 1, "maxItems": 1000, "type": "array", "items": { "type": "string", "minLength": 3, "maxLength": 40 } }, "reason": { "type": "string", "minLength": 1, "maxLength": 200 }, "campaignId": { "type": "string", "format": "uuid" } }, "required": [ "numbers", "reason" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "added": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "duplicates": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "invalid": { "type": "array", "items": { "type": "object", "properties": { "row": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "value": { "type": "string" }, "message": { "type": "string" } }, "required": [ "row", "value", "message" ], "additionalProperties": false } } }, "required": [ "added", "duplicates", "invalid" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Is a number blocked? (/developers/account/reference/suppression/get-suppression-check) ```json { "GET /v1/account/suppression/check": { "operationId": "get_v1_account_suppression_check", "summary": "Is a number blocked?", "tags": [ "Suppression" ], "x-traki-scope": "suppression:read", "parameters": [ { "name": "number", "in": "query", "required": true, "schema": { "type": "string", "minLength": 3, "maxLength": 40 } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "number": { "type": "string" }, "blocked": { "type": "boolean" } }, "required": [ "number", "blocked" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Unblock a number (/developers/account/reference/suppression/delete-suppression-id) ```json { "DELETE /v1/account/suppression/{id}": { "operationId": "delete_v1_account_suppression_id", "summary": "Unblock a number", "tags": [ "Suppression" ], "x-traki-scope": "suppression:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "deleted": { "type": "boolean", "const": true } }, "required": [ "deleted" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # List lead orders (/developers/account/reference/lead-orders/get-lead-orders) Every buyer’s prepaid lead orders, newest first: buyer, campaign, tier, quantity, how many are filled, price and status. Test orders are left out unless `includeTest=true`. ```json { "GET /v1/account/lead-orders": { "operationId": "get_v1_account_lead_orders", "summary": "List lead orders", "description": "Every buyer’s prepaid lead orders, newest first: buyer, campaign, tier, quantity, how many are filled, price and status. Test orders are left out unless `includeTest=true`.", "tags": [ "Lead orders" ], "x-traki-scope": "orders:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "buyerId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "status", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "pending_payment", "paid", "paused", "payment_hold", "completed", "expired", "cancelled", "refunded" ] } }, { "name": "open", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "true", "false" ] } }, { "name": "includeTest", "in": "query", "required": false, "schema": { "default": "false", "type": "string", "enum": [ "true", "false" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "notes": { "type": [ "string", "null" ] } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version", "buyer", "notes" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Place a lead order for one of your buyers (/developers/account/reference/lead-orders/post-lead-orders) The same as placing an order on the Lead orders screen: a quantity of leads on a campaign’s tier at the tier’s price, for a buyer that takes form leads. `payment: manual_paid` records the payment as taken by hand and opens the order at once; `pending` leaves it pending payment. Send an Idempotency-Key: a retry places one order. ```json { "POST /v1/account/lead-orders": { "operationId": "post_v1_account_lead_orders", "summary": "Place a lead order for one of your buyers", "description": "The same as placing an order on the Lead orders screen: a quantity of leads on a campaign’s tier at the tier’s price, for a buyer that takes form leads. `payment: manual_paid` records the payment as taken by hand and opens the order at once; `pending` leaves it pending payment. Send an Idempotency-Key: a retry places one order.", "tags": [ "Lead orders" ], "x-traki-scope": "orders:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "campaignId": { "type": "string", "format": "uuid" }, "tierId": { "type": "string", "format": "uuid" }, "buyerId": { "type": "string", "format": "uuid" }, "states": { "default": [], "maxItems": 60, "type": "array", "items": { "type": "string", "minLength": 2, "maxLength": 2 } }, "quantity": { "type": "integer", "minimum": 1, "maximum": 100000 }, "dailyCap": { "default": null, "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 100000 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": 1, "maximum": 10000 }, "deliveryDays": { "default": null, "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 365 }, { "type": "null" } ] }, "isTest": { "default": false, "type": "boolean" }, "payment": { "default": "manual_paid", "type": "string", "enum": [ "manual_paid", "pending" ] }, "notes": { "default": null, "anyOf": [ { "type": "string", "maxLength": 500 }, { "type": "null" } ] }, "shelf": { "default": "FRESH", "type": "string", "enum": [ "FRESH", "RECENT", "AGED" ] }, "agedBucketId": { "default": null, "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] } }, "required": [ "campaignId", "tierId", "buyerId", "quantity" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "notes": { "type": [ "string", "null" ] } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version", "buyer", "notes" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Get a lead order (/developers/account/reference/lead-orders/get-lead-orders-id) ```json { "GET /v1/account/lead-orders/{id}": { "operationId": "get_v1_account_lead_orders_id", "summary": "Get a lead order", "tags": [ "Lead orders" ], "x-traki-scope": "orders:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "notes": { "type": [ "string", "null" ] } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version", "buyer", "notes" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a lead order’s terms (/developers/account/reference/lead-orders/patch-lead-orders-id) States, quantity (never below what is filled), daily cap, pace, run length and notes of an open order, with the reason its history keeps. The price per lead is the tier’s at the time of the order and does not change here. ```json { "PATCH /v1/account/lead-orders/{id}": { "operationId": "patch_v1_account_lead_orders_id", "summary": "Change a lead order’s terms", "description": "States, quantity (never below what is filled), daily cap, pace, run length and notes of an open order, with the reason its history keeps. The price per lead is the tier’s at the time of the order and does not change here.", "tags": [ "Lead orders" ], "x-traki-scope": "orders:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "states": { "maxItems": 60, "type": "array", "items": { "type": "string", "minLength": 2, "maxLength": 2 } }, "quantity": { "type": "integer", "minimum": 1, "maximum": 100000 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 100000 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": 1, "maximum": 10000 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 365 }, { "type": "null" } ] }, "notes": { "anyOf": [ { "type": "string", "maxLength": 500 }, { "type": "null" } ] }, "reason": { "type": "string", "minLength": 3, "maxLength": 300 }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" } }, "required": [ "reason" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "notes": { "type": [ "string", "null" ] } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version", "buyer", "notes" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Pause, resume, hold, release, cancel or mark a lead order paid (/developers/account/reference/lead-orders/post-lead-orders-id-actions) The order actions of the Lead orders screen. A reason is required to pause, hold or cancel. Cancelling a paid order with leads still owed refunds them the way they were paid, and `mark_paid` records the full price as paid by hand; both move money, so send an Idempotency-Key. ```json { "POST /v1/account/lead-orders/{id}/actions": { "operationId": "post_v1_account_lead_orders_id_actions", "summary": "Pause, resume, hold, release, cancel or mark a lead order paid", "description": "The order actions of the Lead orders screen. A reason is required to pause, hold or cancel. Cancelling a paid order with leads still owed refunds them the way they were paid, and `mark_paid` records the full price as paid by hand; both move money, so send an Idempotency-Key.", "tags": [ "Lead orders" ], "x-traki-scope": "orders:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "pause", "resume", "hold", "release", "cancel", "mark_paid" ] }, "reason": { "type": "string", "maxLength": 300 }, "ifVersion": { "description": "The `version` the change is based on. When the record has changed since, the change is refused with 409 version_conflict.", "type": "string", "pattern": "^\\d{1,16}$" } }, "required": [ "action" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "notes": { "type": [ "string", "null" ] } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version", "buyer", "notes" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # List buyers’ lead wallets (/developers/account/reference/lead-wallets/get-lead-wallets) Each buyer that takes form leads, with the cash and credit its lead-order wallet holds. Paged by buyer. ```json { "GET /v1/account/lead-wallets": { "operationId": "get_v1_account_lead_wallets", "summary": "List buyers’ lead wallets", "description": "Each buyer that takes form leads, with the cash and credit its lead-order wallet holds. Paged by buyer.", "tags": [ "Lead wallets" ], "x-traki-scope": "orders:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "currency": { "type": "string" }, "cashBalance": { "type": "string" }, "creditBalance": { "type": "string" }, "minimum": { "type": [ "string", "null" ] }, "autoRecharge": { "type": [ "string", "null" ] }, "lastEntryAt": { "type": [ "string", "null" ] }, "openPayments": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ "buyer", "currency", "cashBalance", "creditBalance", "minimum", "autoRecharge", "lastEntryAt", "openPayments" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Get a buyer’s lead wallet (/developers/account/reference/lead-wallets/get-buyers-buyerId-lead-wallet) ```json { "GET /v1/account/buyers/{buyerId}/lead-wallet": { "operationId": "get_v1_account_buyers_buyerId_lead_wallet", "summary": "Get a buyer’s lead wallet", "tags": [ "Lead wallets" ], "x-traki-scope": "orders:read", "parameters": [ { "name": "buyerId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "currency": { "type": "string" }, "cashBalance": { "type": "string" }, "creditBalance": { "type": "string" }, "minimum": { "type": [ "string", "null" ] }, "autoRecharge": { "type": [ "string", "null" ] }, "lastEntryAt": { "type": [ "string", "null" ] }, "openPayments": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ "buyer", "currency", "cashBalance", "creditBalance", "minimum", "autoRecharge", "lastEntryAt", "openPayments" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # A buyer’s wallet ledger, newest first (/developers/account/reference/lead-wallets/get-buyers-buyerId-lead-wallet-entries) ```json { "GET /v1/account/buyers/{buyerId}/lead-wallet/entries": { "operationId": "get_v1_account_buyers_buyerId_lead_wallet_entries", "summary": "A buyer’s wallet ledger, newest first", "tags": [ "Lead wallets" ], "x-traki-scope": "orders:read", "parameters": [ { "name": "buyerId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "at": { "type": "string" }, "type": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "cashAfter": { "type": "string" }, "creditAfter": { "type": "string" }, "order": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" } }, "required": [ "id", "code" ], "additionalProperties": false }, { "type": "null" } ] }, "note": { "type": [ "string", "null" ] }, "createdBy": { "type": [ "string", "null" ] } }, "required": [ "id", "at", "type", "cash", "credit", "cashAfter", "creditAfter", "order", "note", "createdBy" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Add cash or credit to a buyer’s wallet, or take it back (/developers/account/reference/lead-wallets/post-buyers-buyerId-lead-wallet-entries) The same as adding to a wallet on the Lead payments screen: cash received outside the platform, or credit, positive or negative (never below zero), with the reason the ledger keeps. Send an Idempotency-Key: a retry adds one entry. ```json { "POST /v1/account/buyers/{buyerId}/lead-wallet/entries": { "operationId": "post_v1_account_buyers_buyerId_lead_wallet_entries", "summary": "Add cash or credit to a buyer’s wallet, or take it back", "description": "The same as adding to a wallet on the Lead payments screen: cash received outside the platform, or credit, positive or negative (never below zero), with the reason the ledger keeps. Send an Idempotency-Key: a retry adds one entry.", "tags": [ "Lead wallets" ], "x-traki-scope": "orders:write", "parameters": [ { "name": "buyerId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "cash": { "default": 0, "type": "number", "minimum": -1000000, "maximum": 1000000 }, "credit": { "default": 0, "type": "number", "minimum": -1000000, "maximum": 1000000 }, "reason": { "type": "string", "minLength": 3, "maxLength": 300 } }, "required": [ "reason" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "currency": { "type": "string" }, "cashBalance": { "type": "string" }, "creditBalance": { "type": "string" }, "minimum": { "type": [ "string", "null" ] }, "autoRecharge": { "type": [ "string", "null" ] }, "lastEntryAt": { "type": [ "string", "null" ] }, "openPayments": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ "buyer", "currency", "cashBalance", "creditBalance", "minimum", "autoRecharge", "lastEntryAt", "openPayments" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # List lead payments (/developers/account/reference/lead-payments/get-lead-payments) Card payments for lead orders and wallet top-ups, newest first. A payment recorded by hand shows on the order itself (`paymentMethod: manual`). ```json { "GET /v1/account/lead-payments": { "operationId": "get_v1_account_lead_payments", "summary": "List lead payments", "description": "Card payments for lead orders and wallet top-ups, newest first. A payment recorded by hand shows on the order itself (`paymentMethod: manual`).", "tags": [ "Lead payments" ], "x-traki-scope": "orders:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "buyerId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "orderId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "status", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "open", "paid", "expired", "canceled", "failed" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "kind": { "type": "string" }, "status": { "type": "string" }, "provider": { "type": "string" }, "buyer": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "externalId": { "type": [ "string", "null" ] }, "name": { "type": "string" } }, "required": [ "id", "externalId", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "order": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" } }, "required": [ "id", "code" ], "additionalProperties": false }, { "type": "null" } ] }, "currency": { "type": "string" }, "amount": { "type": "string" }, "creditApplied": { "type": "string" }, "cashFromWallet": { "type": "string" }, "discount": { "type": "string" }, "platformFee": { "type": "string" }, "promoCode": { "type": [ "string", "null" ] }, "url": { "type": [ "string", "null" ] }, "expiresAt": { "type": "string" }, "paidAt": { "type": [ "string", "null" ] }, "closedAt": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "kind", "status", "provider", "buyer", "order", "currency", "amount", "creditApplied", "cashFromWallet", "discount", "platformFee", "promoCode", "url", "expiresAt", "paidAt", "closedAt", "createdAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The Buyer API and Publisher API keys of the account’s parties (never their secrets) (/developers/account/reference/partner-keys/get-partner-keys) ```json { "GET /v1/account/partner-keys": { "operationId": "get_v1_account_partner_keys", "summary": "The Buyer API and Publisher API keys of the account’s parties (never their secrets)", "tags": [ "Partner keys" ], "x-traki-scope": "partner-keys:read", "parameters": [ { "name": "api", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "buyer", "publisher" ] } }, { "name": "holderId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "keyId": { "type": "string" }, "api": { "type": "string", "enum": [ "account", "publisher", "buyer" ] }, "mode": { "type": "string", "enum": [ "live", "test" ] }, "name": { "type": "string" }, "preview": { "type": "string" }, "holder": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "scopes": { "type": "array", "items": { "type": "string" } }, "ipAllowlist": { "type": "array", "items": { "type": "string" } }, "version": { "type": "string" }, "state": { "type": "string", "enum": [ "active", "suspended", "revoked", "expired" ] }, "suspendedReason": { "type": [ "string", "null" ] }, "expiresAt": { "type": [ "string", "null" ] }, "lastUsedAt": { "type": [ "string", "null" ] }, "lastUsedIp": { "type": [ "string", "null" ] }, "rotatedAt": { "type": [ "string", "null" ] }, "previousExpiresAt": { "type": [ "string", "null" ] }, "createdBy": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "keyId", "api", "mode", "name", "preview", "holder", "scopes", "ipAllowlist", "version", "state", "suspendedReason", "expiresAt", "lastUsedAt", "lastUsedIp", "rotatedAt", "previousExpiresAt", "createdBy", "createdAt" ], "additionalProperties": false } } }, "required": [ "data" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Issue a key for one of the account’s buyers or publishers; the key is answered once (/developers/account/reference/partner-keys/post-partner-keys) ```json { "POST /v1/account/partner-keys": { "operationId": "post_v1_account_partner_keys", "summary": "Issue a key for one of the account’s buyers or publishers; the key is answered once", "tags": [ "Partner keys" ], "x-traki-scope": "partner-keys:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "api": { "type": "string", "enum": [ "buyer", "publisher" ] }, "holderId": { "type": "string", "format": "uuid" }, "name": { "type": "string", "minLength": 1, "maxLength": 80 }, "mode": { "default": "live", "type": "string", "enum": [ "live", "test" ] }, "preset": { "default": "read_only", "type": "string", "enum": [ "read_only", "full_access", "custom" ] }, "scopes": { "maxItems": 80, "type": "array", "items": { "type": "string", "maxLength": 64 } }, "ipAllowlist": { "default": [], "maxItems": 50, "type": "array", "items": { "type": "string", "minLength": 2, "maxLength": 64, "pattern": "^[0-9a-fA-F:.]+(\\/\\d{1,3})?$" } }, "expiresInDays": { "default": null, "anyOf": [ { "anyOf": [ { "type": "number", "const": 30 }, { "type": "number", "const": 90 }, { "type": "number", "const": 365 } ] }, { "type": "null" } ] } }, "required": [ "api", "holderId", "name" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "key": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "keyId": { "type": "string" }, "api": { "type": "string", "enum": [ "account", "publisher", "buyer" ] }, "mode": { "type": "string", "enum": [ "live", "test" ] }, "name": { "type": "string" }, "preview": { "type": "string" }, "holder": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "scopes": { "type": "array", "items": { "type": "string" } }, "ipAllowlist": { "type": "array", "items": { "type": "string" } }, "version": { "type": "string" }, "state": { "type": "string", "enum": [ "active", "suspended", "revoked", "expired" ] }, "suspendedReason": { "type": [ "string", "null" ] }, "expiresAt": { "type": [ "string", "null" ] }, "lastUsedAt": { "type": [ "string", "null" ] }, "lastUsedIp": { "type": [ "string", "null" ] }, "rotatedAt": { "type": [ "string", "null" ] }, "previousExpiresAt": { "type": [ "string", "null" ] }, "createdBy": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "keyId", "api", "mode", "name", "preview", "holder", "scopes", "ipAllowlist", "version", "state", "suspendedReason", "expiresAt", "lastUsedAt", "lastUsedIp", "rotatedAt", "previousExpiresAt", "createdBy", "createdAt" ], "additionalProperties": false }, "secret": { "type": "string" } }, "required": [ "key", "secret" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Roll a partner key: a new secret, the old one working for the chosen overlap (/developers/account/reference/partner-keys/post-partner-keys-id-roll) ```json { "POST /v1/account/partner-keys/{id}/roll": { "operationId": "post_v1_account_partner_keys_id_roll", "summary": "Roll a partner key: a new secret, the old one working for the chosen overlap", "tags": [ "Partner keys" ], "x-traki-scope": "partner-keys:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "overlap": { "default": "24h", "type": "string", "enum": [ "now", "1h", "24h", "7d" ] } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "key": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "keyId": { "type": "string" }, "api": { "type": "string", "enum": [ "account", "publisher", "buyer" ] }, "mode": { "type": "string", "enum": [ "live", "test" ] }, "name": { "type": "string" }, "preview": { "type": "string" }, "holder": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "scopes": { "type": "array", "items": { "type": "string" } }, "ipAllowlist": { "type": "array", "items": { "type": "string" } }, "version": { "type": "string" }, "state": { "type": "string", "enum": [ "active", "suspended", "revoked", "expired" ] }, "suspendedReason": { "type": [ "string", "null" ] }, "expiresAt": { "type": [ "string", "null" ] }, "lastUsedAt": { "type": [ "string", "null" ] }, "lastUsedIp": { "type": [ "string", "null" ] }, "rotatedAt": { "type": [ "string", "null" ] }, "previousExpiresAt": { "type": [ "string", "null" ] }, "createdBy": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "keyId", "api", "mode", "name", "preview", "holder", "scopes", "ipAllowlist", "version", "state", "suspendedReason", "expiresAt", "lastUsedAt", "lastUsedIp", "rotatedAt", "previousExpiresAt", "createdBy", "createdAt" ], "additionalProperties": false }, "secret": { "type": "string" } }, "required": [ "key", "secret" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Revoke a partner key; it stops working at once (/developers/account/reference/partner-keys/post-partner-keys-id-revoke) ```json { "POST /v1/account/partner-keys/{id}/revoke": { "operationId": "post_v1_account_partner_keys_id_revoke", "summary": "Revoke a partner key; it stops working at once", "tags": [ "Partner keys" ], "x-traki-scope": "partner-keys:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "keyId": { "type": "string" }, "api": { "type": "string", "enum": [ "account", "publisher", "buyer" ] }, "mode": { "type": "string", "enum": [ "live", "test" ] }, "name": { "type": "string" }, "preview": { "type": "string" }, "holder": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "scopes": { "type": "array", "items": { "type": "string" } }, "ipAllowlist": { "type": "array", "items": { "type": "string" } }, "version": { "type": "string" }, "state": { "type": "string", "enum": [ "active", "suspended", "revoked", "expired" ] }, "suspendedReason": { "type": [ "string", "null" ] }, "expiresAt": { "type": [ "string", "null" ] }, "lastUsedAt": { "type": [ "string", "null" ] }, "lastUsedIp": { "type": [ "string", "null" ] }, "rotatedAt": { "type": [ "string", "null" ] }, "previousExpiresAt": { "type": [ "string", "null" ] }, "createdBy": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "keyId", "api", "mode", "name", "preview", "holder", "scopes", "ipAllowlist", "version", "state", "suspendedReason", "expiresAt", "lastUsedAt", "lastUsedIp", "rotatedAt", "previousExpiresAt", "createdBy", "createdAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # A short-lived token for one buyer or publisher, for your own web page to use (/developers/account/reference/portal-sessions/post-portal-sessions) Needs buyers:read (or publishers:read) on the key, and :write for read_write. The token works only on that party’s Buyer or Publisher API, only from the origins named, for at most 15 minutes. ```json { "POST /v1/account/portal-sessions": { "operationId": "post_v1_account_portal_sessions", "summary": "A short-lived token for one buyer or publisher, for your own web page to use", "description": "Needs buyers:read (or publishers:read) on the key, and :write for read_write. The token works only on that party’s Buyer or Publisher API, only from the origins named, for at most 15 minutes.", "tags": [ "Portal sessions" ], "x-traki-scope": null, "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "party": { "type": "string", "pattern": "^(buyer|publisher):[0-9a-f-]{36}$" }, "origins": { "minItems": 1, "maxItems": 5, "type": "array", "items": { "type": "string", "maxLength": 200 } }, "access": { "default": "read", "type": "string", "enum": [ "read", "read_write" ] }, "ttlSeconds": { "default": 900, "type": "integer", "minimum": 60, "maximum": 900 } }, "required": [ "party", "origins" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "token": { "type": "string" }, "party": { "type": "string" }, "access": { "type": "string", "enum": [ "read", "read_write" ] }, "origins": { "type": "array", "items": { "type": "string" } }, "expiresAt": { "type": "string" } }, "required": [ "id", "token", "party", "access", "origins", "expiresAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # End a portal session at once (/developers/account/reference/portal-sessions/delete-portal-sessions-id) ```json { "DELETE /v1/account/portal-sessions/{id}": { "operationId": "delete_v1_account_portal_sessions_id", "summary": "End a portal session at once", "tags": [ "Portal sessions" ], "x-traki-scope": null, "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "ended": { "type": "boolean", "const": true } }, "required": [ "ended" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The key making this request (/developers/publisher/reference/keys/get-key) Answers the Publisher API key's own details and the account it is locked to. Needs no scope. ```json { "GET /v1/publisher/key": { "operationId": "get_v1_publisher_key", "summary": "The key making this request", "description": "Answers the Publisher API key's own details and the account it is locked to. Needs no scope.", "tags": [ "Keys" ], "x-traki-scope": null, "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "keyId": { "type": "string" }, "name": { "type": "string" }, "api": { "type": "string", "enum": [ "account", "publisher", "buyer" ] }, "mode": { "type": "string", "enum": [ "live", "test" ] }, "scopes": { "type": "array", "items": { "type": "string" } }, "version": { "type": "string" }, "expiresAt": { "type": [ "string", "null" ] }, "account": { "type": "object", "properties": { "name": { "type": "string" }, "timezone": { "type": "string" }, "currency": { "type": "string" } }, "required": [ "name", "timezone", "currency" ], "additionalProperties": false }, "holder": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "keyId", "name", "api", "mode", "scopes", "version", "expiresAt", "account", "holder" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your profile and status (/developers/publisher/reference/profile/get-profile) ```json { "GET /v1/publisher/profile": { "operationId": "get_v1_publisher_profile", "summary": "Your profile and status", "tags": [ "Profile" ], "x-traki-scope": "profile:read", "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "website": { "type": [ "string", "null" ] }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "payout": { "type": "object", "properties": { "method": { "type": [ "string", "null" ] }, "termsDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "minimum": { "type": [ "number", "null" ] } }, "required": [ "method", "termsDays", "minimum" ], "additionalProperties": false }, "sharing": { "type": "object", "properties": { "money": { "type": "boolean" }, "counterparty": { "type": "boolean" }, "contact": { "type": "boolean" }, "recordings": { "type": "boolean" } }, "required": [ "money", "counterparty", "contact", "recordings" ], "additionalProperties": false }, "version": { "type": "string" } }, "required": [ "id", "code", "name", "status", "companyName", "contactName", "contactEmail", "contactPhone", "website", "modules", "payout", "sharing", "version" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The campaigns you may send to, with your payout terms (/developers/publisher/reference/campaigns/get-campaigns) ```json { "GET /v1/publisher/campaigns": { "operationId": "get_v1_publisher_campaigns", "summary": "The campaigns you may send to, with your payout terms", "tags": [ "Campaigns" ], "x-traki-scope": "campaigns:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "kind": { "type": "string", "enum": [ "calls", "leads" ] }, "code": { "type": "string" }, "name": { "type": "string" }, "vertical": { "type": "string" }, "status": { "type": "string" }, "stage": { "type": [ "string", "null" ] }, "payout": { "type": "object", "properties": { "type": { "type": "string" }, "amount": { "type": [ "number", "null" ] }, "afterSec": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "label": { "type": [ "string", "null" ] } }, "required": [ "type", "amount", "afterSec", "label" ], "additionalProperties": false }, "caps": { "type": "object", "properties": { "day": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "month": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "day", "month" ], "additionalProperties": false }, "hours": { "type": [ "string", "null" ] }, "acceptingNow": { "type": [ "boolean", "null" ] } }, "required": [ "id", "kind", "code", "name", "vertical", "status", "stage", "payout", "caps", "hours", "acceptingNow" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your calls, masked as in your portal (/developers/publisher/reference/calls/get-calls) ```json { "GET /v1/publisher/calls": { "operationId": "get_v1_publisher_calls", "summary": "Your calls, masked as in your portal", "tags": [ "Calls" ], "x-traki-scope": "calls:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "includeTest", "in": "query", "required": false, "schema": { "default": "false", "type": "string", "enum": [ "true", "false" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "startedAt": { "type": "string" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "callerMasked": { "type": [ "string", "null" ] }, "trackingNumber": { "type": [ "string", "null" ] }, "stage": { "type": "string" }, "outcome": { "type": [ "string", "null" ] }, "outcomeLabel": { "type": "string" }, "durationSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "connectedSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billable": { "type": "boolean" }, "payout": { "type": [ "number", "null" ] }, "hasRecording": { "type": "boolean" }, "isTest": { "type": "boolean" } }, "required": [ "id", "code", "startedAt", "campaign", "callerMasked", "trackingNumber", "stage", "outcome", "outcomeLabel", "durationSec", "connectedSec", "billable", "payout", "hasRecording", "isTest" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One of your calls (/developers/publisher/reference/calls/get-calls-id) ```json { "GET /v1/publisher/calls/{id}": { "operationId": "get_v1_publisher_calls_id", "summary": "One of your calls", "tags": [ "Calls" ], "x-traki-scope": "calls:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "startedAt": { "type": "string" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "callerMasked": { "type": [ "string", "null" ] }, "trackingNumber": { "type": [ "string", "null" ] }, "stage": { "type": "string" }, "outcome": { "type": [ "string", "null" ] }, "outcomeLabel": { "type": "string" }, "durationSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "connectedSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billable": { "type": "boolean" }, "payout": { "type": [ "number", "null" ] }, "hasRecording": { "type": "boolean" }, "isTest": { "type": "boolean" }, "endedAt": { "type": [ "string", "null" ] }, "recordingUrl": { "type": [ "string", "null" ] } }, "required": [ "id", "code", "startedAt", "campaign", "callerMasked", "trackingNumber", "stage", "outcome", "outcomeLabel", "durationSec", "connectedSec", "billable", "payout", "hasRecording", "isTest", "endedAt", "recordingUrl" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The leads you sent: accepted or rejected, and why (/developers/publisher/reference/leads/get-leads) ```json { "GET /v1/publisher/leads": { "operationId": "get_v1_publisher_leads", "summary": "The leads you sent: accepted or rejected, and why", "tags": [ "Leads" ], "x-traki-scope": "leads:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "includeTest", "in": "query", "required": false, "schema": { "default": "false", "type": "string", "enum": [ "true", "false" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "receivedAt": { "type": "string" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "status": { "type": "string" }, "accepted": { "type": "boolean" }, "rejectReason": { "type": [ "string", "null" ] }, "rejectGroup": { "type": [ "string", "null" ] }, "state": { "type": [ "string", "null" ] }, "postalCode": { "type": [ "string", "null" ] }, "phoneMasked": { "type": [ "string", "null" ] }, "payout": { "type": [ "number", "null" ] }, "isTest": { "type": "boolean" } }, "required": [ "id", "code", "receivedAt", "campaign", "status", "accepted", "rejectReason", "rejectGroup", "state", "postalCode", "phoneMasked", "payout", "isTest" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The tracking numbers assigned to you, with their recent calls (/developers/publisher/reference/numbers/get-numbers) ```json { "GET /v1/publisher/numbers": { "operationId": "get_v1_publisher_numbers", "summary": "The tracking numbers assigned to you, with their recent calls", "tags": [ "Numbers" ], "x-traki-scope": "numbers:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "e164": { "type": "string" }, "type": { "type": "string" }, "status": { "type": "string" }, "campaign": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "pool": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "locality": { "type": [ "string", "null" ] }, "callsToday": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "calls30d": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastCallAt": { "type": [ "string", "null" ] }, "assignedAt": { "type": [ "string", "null" ] } }, "required": [ "id", "e164", "type", "status", "campaign", "pool", "locality", "callsToday", "calls30d", "lastCallAt", "assignedAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your earnings by day and campaign, and your balance (/developers/publisher/reference/earnings/get-earnings) ```json { "GET /v1/publisher/earnings": { "operationId": "get_v1_publisher_earnings", "summary": "Your earnings by day and campaign, and your balance", "tags": [ "Earnings" ], "x-traki-scope": "earnings:read", "parameters": [ { "name": "range", "in": "query", "required": false, "schema": { "default": "30d", "type": "string", "enum": [ "today", "yesterday", "7d", "30d", "custom" ] } }, { "name": "from", "in": "query", "required": false, "schema": { "type": "string", "format": "date" } }, { "name": "to", "in": "query", "required": false, "schema": { "type": "string", "format": "date" } }, { "name": "grain", "in": "query", "required": false, "schema": { "default": "day", "type": "string", "enum": [ "day", "week", "month" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "range": { "type": "object", "properties": { "key": { "type": "string" }, "label": { "type": "string" } }, "required": [ "key", "label" ], "additionalProperties": false }, "calls": { "anyOf": [ { "type": "object", "properties": { "totals": { "type": "object", "properties": { "calls": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billable": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "earned": { "type": [ "number", "null" ] } }, "required": [ "calls", "billable", "earned" ], "additionalProperties": false }, "balance": { "type": "object", "properties": { "unbilled": { "type": [ "number", "null" ] }, "processing": { "type": [ "number", "null" ] }, "paidLifetime": { "type": [ "number", "null" ] }, "threshold": { "type": [ "number", "null" ] }, "terms": { "type": [ "string", "null" ] }, "nextPayoutAt": { "type": [ "string", "null" ] } }, "required": [ "unbilled", "processing", "paidLifetime", "threshold", "terms", "nextPayoutAt" ], "additionalProperties": false }, "series": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "label": { "type": "string" }, "calls": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billable": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "earned": { "type": [ "number", "null" ] } }, "required": [ "key", "label", "calls", "billable", "earned" ], "additionalProperties": false } }, "byCampaign": { "type": "array", "items": { "type": "object", "properties": { "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "calls": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billable": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "earned": { "type": [ "number", "null" ] }, "share": { "type": [ "number", "null" ] } }, "required": [ "campaign", "calls", "billable", "earned", "share" ], "additionalProperties": false } } }, "required": [ "totals", "balance", "series", "byCampaign" ], "additionalProperties": false }, { "type": "null" } ] }, "leads": { "anyOf": [ { "type": "object", "properties": { "campaigns": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "accepted": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "earnings": { "type": [ "number", "null" ] } }, "required": [ "id", "name", "accepted", "earnings" ], "additionalProperties": false } }, "chargebacks": { "type": [ "number", "null" ] }, "returnedLeads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "total": { "type": [ "number", "null" ] } }, "required": [ "campaigns", "chargebacks", "returnedLeads", "total" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "range", "calls", "leads" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your payouts and the statements they pay (/developers/publisher/reference/earnings/get-earnings-payouts) ```json { "GET /v1/publisher/earnings/payouts": { "operationId": "get_v1_publisher_earnings_payouts", "summary": "Your payouts and the statements they pay", "tags": [ "Earnings" ], "x-traki-scope": "earnings:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "amount": { "type": [ "number", "null" ] }, "state": { "type": "string" }, "method": { "type": [ "string", "null" ] }, "reference": { "type": [ "string", "null" ] }, "statement": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "periodLabel": { "type": [ "string", "null" ] } }, "required": [ "id", "code", "periodLabel" ], "additionalProperties": false }, { "type": "null" } ] }, "billableCalls": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "billableLeads": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "createdAt": { "type": "string" }, "paidAt": { "type": [ "string", "null" ] } }, "required": [ "id", "code", "amount", "state", "method", "reference", "statement", "billableCalls", "billableLeads", "createdAt", "paidAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Call totals over your own traffic, grouped by day or campaign (/developers/publisher/reference/reports/get-reports-calls) A start and an end, at most a year apart. ```json { "GET /v1/publisher/reports/calls": { "operationId": "get_v1_publisher_reports_calls", "summary": "Call totals over your own traffic, grouped by day or campaign", "description": "A start and an end, at most a year apart.", "tags": [ "Reports" ], "x-traki-scope": "reports:read", "parameters": [ { "name": "start", "in": "query", "required": true, "schema": { "type": "string", "format": "date-time" } }, { "name": "end", "in": "query", "required": true, "schema": { "type": "string", "format": "date-time" } }, { "name": "groupBy", "in": "query", "required": false, "schema": { "default": "day", "type": "string", "enum": [ "day", "campaign" ] } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "start": { "type": "string" }, "end": { "type": "string" }, "groupBy": { "type": "string" }, "rows": { "type": "array", "items": { "type": "object", "properties": { "group": { "type": "string" }, "label": { "type": [ "string", "null" ] }, "calls": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "answered": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billable": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "durationSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "payout": { "type": [ "string", "null" ] } }, "required": [ "group", "label", "calls", "answered", "billable", "durationSec", "payout" ], "additionalProperties": false } } }, "required": [ "start", "end", "groupBy", "rows" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Lead totals over your own traffic, grouped by day or campaign (/developers/publisher/reference/reports/get-reports-leads) A start and an end, at most a year apart. ```json { "GET /v1/publisher/reports/leads": { "operationId": "get_v1_publisher_reports_leads", "summary": "Lead totals over your own traffic, grouped by day or campaign", "description": "A start and an end, at most a year apart.", "tags": [ "Reports" ], "x-traki-scope": "reports:read", "parameters": [ { "name": "start", "in": "query", "required": true, "schema": { "type": "string", "format": "date-time" } }, { "name": "end", "in": "query", "required": true, "schema": { "type": "string", "format": "date-time" } }, { "name": "groupBy", "in": "query", "required": false, "schema": { "default": "day", "type": "string", "enum": [ "day", "campaign" ] } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "start": { "type": "string" }, "end": { "type": "string" }, "groupBy": { "type": "string" }, "rows": { "type": "array", "items": { "type": "object", "properties": { "group": { "type": "string" }, "label": { "type": [ "string", "null" ] }, "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "sold": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "rejected": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "payout": { "type": [ "string", "null" ] } }, "required": [ "group", "label", "leads", "sold", "rejected", "payout" ], "additionalProperties": false } } }, "required": [ "start", "end", "groupBy", "rows" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your webhook endpoints (/developers/publisher/reference/postbacks/get-webhooks) ```json { "GET /v1/publisher/webhooks": { "operationId": "get_v1_publisher_webhooks", "summary": "Your webhook endpoints", "tags": [ "Postbacks" ], "x-traki-scope": "webhooks:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string" }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "code", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Subscribe one of your URLs to events about your own traffic (/developers/publisher/reference/postbacks/post-webhooks) The signing secret is answered once, here. The URL must be a public https:// address. ```json { "POST /v1/publisher/webhooks": { "operationId": "post_v1_publisher_webhooks", "summary": "Subscribe one of your URLs to events about your own traffic", "description": "The signing secret is answered once, here. The URL must be a public https:// address.", "tags": [ "Postbacks" ], "x-traki-scope": "webhooks:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "url": { "type": "string", "maxLength": 2048, "format": "uri" }, "events": { "minItems": 1, "maxItems": 26, "type": "array", "items": { "type": "string", "enum": [ "call.started", "call.ended", "call.billable", "lead.received", "lead.allocated", "lead.disclosed", "lead.returned", "lead.assigned", "order.paid", "lead.dnc_flagged", "order.filled", "tier.filled", "callback.completed", "sms.status_changed", "statement.closed", "payout.paid", "approval.decided", "alert.fired", "buyer.created", "buyer.updated", "publisher.created", "publisher.updated", "campaign.created", "campaign.updated", "number.assigned", "number.released" ] } } }, "required": [ "url", "events" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "webhook": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string" }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "code", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false }, "secret": { "type": "string" } }, "required": [ "webhook", "secret" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a webhook’s URL or events, or pause and resume it (/developers/publisher/reference/postbacks/patch-webhooks-id) ```json { "PATCH /v1/publisher/webhooks/{id}": { "operationId": "patch_v1_publisher_webhooks_id", "summary": "Change a webhook’s URL or events, or pause and resume it", "tags": [ "Postbacks" ], "x-traki-scope": "webhooks:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "url": { "type": "string", "maxLength": 2048, "format": "uri" }, "events": { "minItems": 1, "maxItems": 26, "type": "array", "items": { "type": "string", "enum": [ "call.started", "call.ended", "call.billable", "lead.received", "lead.allocated", "lead.disclosed", "lead.returned", "lead.assigned", "order.paid", "lead.dnc_flagged", "order.filled", "tier.filled", "callback.completed", "sms.status_changed", "statement.closed", "payout.paid", "approval.decided", "alert.fired", "buyer.created", "buyer.updated", "publisher.created", "publisher.updated", "campaign.created", "campaign.updated", "number.assigned", "number.released" ] } }, "state": { "type": "string", "enum": [ "active", "paused" ] } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string" }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "code", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Remove a webhook (/developers/publisher/reference/postbacks/delete-webhooks-id) ```json { "DELETE /v1/publisher/webhooks/{id}": { "operationId": "delete_v1_publisher_webhooks_id", "summary": "Remove a webhook", "tags": [ "Postbacks" ], "x-traki-scope": "webhooks:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "deleted": { "type": "boolean", "const": true } }, "required": [ "id", "deleted" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # What one of your webhooks was sent, and how each delivery went (/developers/publisher/reference/postbacks/get-webhooks-id-deliveries) ```json { "GET /v1/publisher/webhooks/{id}/deliveries": { "operationId": "get_v1_publisher_webhooks_id_deliveries", "summary": "What one of your webhooks was sent, and how each delivery went", "tags": [ "Postbacks" ], "x-traki-scope": "webhooks:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "eventId": { "type": "string" }, "eventType": { "type": "string" }, "attempts": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "state": { "type": "string" }, "nextAttemptAt": { "type": [ "string", "null" ] }, "lastAttemptAt": { "type": [ "string", "null" ] }, "lastResponseCode": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "lastError": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "eventId", "eventType", "attempts", "state", "nextAttemptAt", "lastAttemptAt", "lastResponseCode", "lastError", "createdAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The key making this request (/developers/buyer/reference/keys/get-key) Answers the Buyer API key's own details and the account it is locked to. Needs no scope. ```json { "GET /v1/buyer/key": { "operationId": "get_v1_buyer_key", "summary": "The key making this request", "description": "Answers the Buyer API key's own details and the account it is locked to. Needs no scope.", "tags": [ "Keys" ], "x-traki-scope": null, "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "keyId": { "type": "string" }, "name": { "type": "string" }, "api": { "type": "string", "enum": [ "account", "publisher", "buyer" ] }, "mode": { "type": "string", "enum": [ "live", "test" ] }, "scopes": { "type": "array", "items": { "type": "string" } }, "version": { "type": "string" }, "expiresAt": { "type": [ "string", "null" ] }, "account": { "type": "object", "properties": { "name": { "type": "string" }, "timezone": { "type": "string" }, "currency": { "type": "string" } }, "required": [ "name", "timezone", "currency" ], "additionalProperties": false }, "holder": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "keyId", "name", "api", "mode", "scopes", "version", "expiresAt", "account", "holder" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your profile, status and what the account lets you change (/developers/buyer/reference/profile/get-profile) ```json { "GET /v1/buyer/profile": { "operationId": "get_v1_buyer_profile", "summary": "Your profile, status and what the account lets you change", "tags": [ "Profile" ], "x-traki-scope": "profile:read", "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" }, "companyName": { "type": [ "string", "null" ] }, "contactName": { "type": [ "string", "null" ] }, "contactEmail": { "type": [ "string", "null" ] }, "contactPhone": { "type": [ "string", "null" ] }, "timezone": { "type": "string" }, "modules": { "type": "object", "properties": { "calls": { "type": "boolean" }, "leads": { "type": "boolean" } }, "required": [ "calls", "leads" ], "additionalProperties": false }, "available": { "type": "boolean" }, "pausedByPublisher": { "type": "boolean" }, "hoursSummary": { "type": [ "string", "null" ] }, "sharing": { "type": "object", "properties": { "money": { "type": "boolean" }, "counterparty": { "type": "boolean" }, "contact": { "type": "boolean" }, "recordings": { "type": "boolean" }, "consent": { "type": "boolean" } }, "required": [ "money", "counterparty", "contact", "recordings", "consent" ], "additionalProperties": false }, "access": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "string", "enum": [ "hidden", "view", "ask", "edit" ] } }, "changeableFields": { "type": "array", "items": { "type": "string" } }, "apiFields": { "type": "array", "items": { "type": "string" } }, "version": { "type": "string" } }, "required": [ "id", "code", "name", "status", "companyName", "contactName", "contactEmail", "contactPhone", "timezone", "modules", "available", "pausedByPublisher", "hoursSummary", "sharing", "access", "changeableFields", "apiFields", "version" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The campaigns you buy on, with your price, caps and hours (/developers/buyer/reference/campaigns/get-campaigns) ```json { "GET /v1/buyer/campaigns": { "operationId": "get_v1_buyer_campaigns", "summary": "The campaigns you buy on, with your price, caps and hours", "tags": [ "Campaigns" ], "x-traki-scope": "campaigns:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "kind": { "type": "string", "enum": [ "calls", "leads" ] }, "name": { "type": "string" }, "campaignStatus": { "type": "string" }, "status": { "type": "string" }, "pausedByPublisher": { "type": "boolean" }, "price": { "type": [ "number", "null" ] }, "bidCeiling": { "type": [ "number", "null" ] }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "concurrency": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "hours": { "type": [ "string", "null" ] }, "pendingChanges": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ "id", "kind", "name", "campaignStatus", "status", "pausedByPublisher", "price", "bidCeiling", "capDay", "concurrency", "hours", "pendingChanges" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your current bids, lead rates, budget, caps and hours (/developers/buyer/reference/bids-and-budgets/get-bids) ```json { "GET /v1/buyer/bids": { "operationId": "get_v1_buyer_bids", "summary": "Your current bids, lead rates, budget, caps and hours", "tags": [ "Bids and budgets" ], "x-traki-scope": "bids:read", "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "budget": { "type": "object", "properties": { "period": { "type": [ "string", "null" ] }, "ceiling": { "type": [ "number", "null" ] }, "usedToday": { "type": "number" }, "version": { "type": "string" } }, "required": [ "period", "ceiling", "usedToday", "version" ], "additionalProperties": false }, "availability": { "type": "object", "properties": { "available": { "type": "boolean" }, "pausedByPublisher": { "type": "boolean" }, "timezone": { "type": "string" }, "hoursSummary": { "type": [ "string", "null" ] }, "openNow": { "type": "boolean" }, "pause": { "anyOf": [ { "type": "object", "properties": { "date": { "type": "string" }, "until": { "type": [ "string", "null" ] } }, "required": [ "date", "until" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "available", "pausedByPublisher", "timezone", "hoursSummary", "openNow", "pause" ], "additionalProperties": false }, "campaigns": { "type": "array", "items": { "type": "object", "properties": { "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "campaignStatus": { "type": "string" }, "status": { "type": "string" }, "pausedByPublisher": { "type": "boolean" }, "bid": { "type": "number" }, "bidCeiling": { "type": [ "number", "null" ] }, "leadRate": { "type": [ "number", "null" ] }, "capDay": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "concurrency": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "bidSource": { "type": "string" }, "version": { "type": "string" }, "pendingChanges": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ "campaign", "campaignStatus", "status", "pausedByPublisher", "bid", "bidCeiling", "leadRate", "capDay", "concurrency", "bidSource", "version", "pendingChanges" ], "additionalProperties": false } }, "access": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": { "type": "string" } } }, "required": [ "budget", "availability", "campaigns", "access" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a bid, lead rate, budget or hours, or pause and resume (/developers/buyer/reference/bids-and-budgets/post-bids) A change inside what the account lets you change applies at once (`applied`); anything else waits for the account (`pendingApproval`). A bid above the campaign ceiling always waits. Send `ifVersion` to refuse a change based on an older value (409). ```json { "POST /v1/buyer/bids": { "operationId": "post_v1_buyer_bids", "summary": "Change a bid, lead rate, budget or hours, or pause and resume", "description": "A change inside what the account lets you change applies at once (`applied`); anything else waits for the account (`pendingApproval`). A bid above the campaign ceiling always waits. Send `ifVersion` to refuse a change based on an older value (409).", "tags": [ "Bids and budgets" ], "x-traki-scope": "bids:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "field": { "type": "string", "enum": [ "bid", "leadRate", "budget", "hours", "pause" ] }, "campaignId": { "type": "string", "format": "uuid" }, "value": { "type": "number", "minimum": 0, "maximum": 100000000 }, "hours": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "hoursSummary": { "type": "string", "maxLength": 200 }, "pause": { "type": "string", "enum": [ "hour", "day", "clear" ] }, "ifVersion": { "type": "string", "maxLength": 40 } }, "required": [ "field" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "enum": [ "applied", "pendingApproval" ] }, "field": { "type": "string" }, "campaignId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "value": { "type": [ "string", "null" ] }, "version": { "type": [ "string", "null" ] }, "message": { "type": "string" }, "changeRequestId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] } }, "required": [ "result", "field", "campaignId", "value", "version", "message", "changeRequestId" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The leads you bought, oldest first, as a feed (/developers/buyer/reference/leads/get-leads) Page with `cursor` (the `nextCursor` of the previous page) while `hasMore` is true; then poll with the last `nextCursor` to receive new leads. Contact details, answers, prices and consent proof follow what the account shares, as in your portal. ```json { "GET /v1/buyer/leads": { "operationId": "get_v1_buyer_leads", "summary": "The leads you bought, oldest first, as a feed", "description": "Page with `cursor` (the `nextCursor` of the previous page) while `hasMore` is true; then poll with the last `nextCursor` to receive new leads. Contact details, answers, prices and consent proof follow what the account shares, as in your portal.", "tags": [ "Leads" ], "x-traki-scope": "leads:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "saleId": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "soldAt": { "type": "string" }, "receivedAt": { "type": "string" }, "campaign": { "type": "object", "properties": { "code": { "type": "string" }, "name": { "type": "string" } }, "required": [ "code", "name" ], "additionalProperties": false }, "state": { "type": [ "string", "null" ] }, "postalCode": { "type": [ "string", "null" ] }, "firstName": { "type": [ "string", "null" ] }, "lastName": { "type": [ "string", "null" ] }, "phone": { "type": [ "string", "null" ] }, "email": { "type": [ "string", "null" ] }, "price": { "type": [ "number", "null" ] }, "outcome": { "type": [ "string", "null" ] }, "answers": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "consent": { "anyOf": [ { "type": "object", "properties": { "capturedAt": { "type": [ "string", "null" ] }, "certificateUrl": { "type": [ "string", "null" ] }, "ipAddress": { "type": [ "string", "null" ] } }, "required": [ "capturedAt", "certificateUrl", "ipAddress" ], "additionalProperties": false }, { "type": "null" } ] }, "test": { "type": "boolean" } }, "required": [ "id", "saleId", "code", "soldAt", "receivedAt", "campaign", "state", "postalCode", "firstName", "lastName", "phone", "email", "price", "outcome", "answers", "consent", "test" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Report your outcome on a lead you bought (/developers/buyer/reference/leads/post-leads-id-outcome) Set the outcome stage (its key) and, on a won stage, the value; `null` clears it. The same as the outcome on the lead in your portal. ```json { "POST /v1/buyer/leads/{id}/outcome": { "operationId": "post_v1_buyer_leads_id_outcome", "summary": "Report your outcome on a lead you bought", "description": "Set the outcome stage (its key) and, on a won stage, the value; `null` clears it. The same as the outcome on the lead in your portal.", "tags": [ "Leads" ], "x-traki-scope": "leads:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "outcome": { "anyOf": [ { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,39}$" }, { "type": "null" } ] }, "value": { "anyOf": [ { "type": "number", "minimum": 0, "maximum": 100000000 }, { "type": "null" } ] } }, "required": [ "outcome" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "saleId": { "type": "string", "format": "uuid" }, "outcome": { "type": [ "string", "null" ] }, "outcomeLabel": { "type": [ "string", "null" ] }, "outcomeAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "outcomeValue": { "type": [ "number", "null" ] }, "firstDialAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "replacedAt": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ] }, "replacement": { "type": "boolean" } }, "required": [ "saleId", "outcome", "outcomeLabel", "outcomeAt", "outcomeValue", "firstDialAt", "replacedAt", "replacement" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your lead orders, newest first (/developers/buyer/reference/orders/get-orders) Each order with its campaign, tier, quantity, how many are filled, price and status. Empty when the account has not opened form leads or lead orders to you. ```json { "GET /v1/buyer/orders": { "operationId": "get_v1_buyer_orders", "summary": "Your lead orders, newest first", "description": "Each order with its campaign, tier, quantity, how many are filled, price and status. Empty when the account has not opened form leads or lead orders to you.", "tags": [ "Orders" ], "x-traki-scope": "orders:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "open", "in": "query", "required": false, "schema": { "type": "string", "enum": [ "true", "false" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Order leads (/developers/buyer/reference/orders/post-orders) The same as ordering from Offers in your portal: the account must allow you to order, the tier must be listed, and when the account has order terms you accept them by sending their version id as `acceptTermsVersionId`. The order is paid from your wallet (credit, then cash, in the account’s order), by card, or both; when a card is due the answer carries the payment to complete. Send an Idempotency-Key: a retry places one order. ```json { "POST /v1/buyer/orders": { "operationId": "post_v1_buyer_orders", "summary": "Order leads", "description": "The same as ordering from Offers in your portal: the account must allow you to order, the tier must be listed, and when the account has order terms you accept them by sending their version id as `acceptTermsVersionId`. The order is paid from your wallet (credit, then cash, in the account’s order), by card, or both; when a card is due the answer carries the payment to complete. Send an Idempotency-Key: a retry places one order.", "tags": [ "Orders" ], "x-traki-scope": "orders:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "tierId": { "type": "string", "format": "uuid" }, "states": { "default": [], "maxItems": 60, "type": "array", "items": { "type": "string", "minLength": 2, "maxLength": 2 } }, "quantity": { "type": "integer", "minimum": 1, "maximum": 100000 }, "dailyCap": { "default": null, "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 100000 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": 1, "maximum": 10000 }, "deliveryDays": { "default": null, "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 365 }, { "type": "null" } ] }, "promoCode": { "type": "string", "maxLength": 40 }, "method": { "default": "wallet_then_card", "type": "string", "enum": [ "wallet", "card", "wallet_then_card" ] }, "acceptTermsVersionId": { "default": null, "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] }, "shelf": { "default": "FRESH", "type": "string", "enum": [ "FRESH", "RECENT", "AGED" ] }, "agedBucketId": { "default": null, "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] } }, "required": [ "tierId", "quantity" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "order": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version" ], "additionalProperties": false }, "payment": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "status": { "type": "string" }, "amount": { "type": "string" }, "url": { "type": [ "string", "null" ] }, "expiresAt": { "type": "string" } }, "required": [ "id", "status", "amount", "url", "expiresAt" ], "additionalProperties": false }, { "type": "null" } ] }, "split": { "type": "object", "properties": { "due": { "type": "string" }, "discount": { "type": "string" }, "credit": { "type": "string" }, "cash": { "type": "string" }, "card": { "type": "string" } }, "required": [ "due", "discount", "credit", "cash", "card" ], "additionalProperties": false } }, "required": [ "order", "payment", "split" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One of your lead orders (/developers/buyer/reference/orders/get-orders-id) ```json { "GET /v1/buyer/orders/{id}": { "operationId": "get_v1_buyer_orders_id", "summary": "One of your lead orders", "tags": [ "Orders" ], "x-traki-scope": "orders:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The leads delivered on one of your orders, newest first (/developers/buyer/reference/orders/get-orders-id-fills) The full lead records come from `GET /leads`; these name which order each filled. ```json { "GET /v1/buyer/orders/{id}/fills": { "operationId": "get_v1_buyer_orders_id_fills", "summary": "The leads delivered on one of your orders, newest first", "description": "The full lead records come from `GET /leads`; these name which order each filled.", "tags": [ "Orders" ], "x-traki-scope": "orders:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "lead": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" } }, "required": [ "id", "code" ], "additionalProperties": false }, "soldAt": { "type": "string" }, "state": { "type": [ "string", "null" ] }, "price": { "type": [ "string", "null" ] }, "outcome": { "type": [ "string", "null" ] } }, "required": [ "id", "lead", "soldAt", "state", "price", "outcome" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Pause or resume one of your orders (/developers/buyer/reference/orders/post-orders-id-actions) Only where the account lets you pause your own orders. ```json { "POST /v1/buyer/orders/{id}/actions": { "operationId": "post_v1_buyer_orders_id_actions", "summary": "Pause or resume one of your orders", "description": "Only where the account lets you pause your own orders.", "tags": [ "Orders" ], "x-traki-scope": "orders:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "pause", "resume" ] }, "reason": { "type": "string", "maxLength": 300 }, "ifVersion": { "description": "The `version` the change is based on; refused with 409 when the order moved on.", "type": "string", "pattern": "^\\d{1,16}$" } }, "required": [ "action" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change an open order’s states, daily cap or run length (/developers/buyer/reference/orders/post-orders-id-change) Applied at once, or sent to the account for approval, as your access to orders allows. The quantity does not change here: more leads is a new order. ```json { "POST /v1/buyer/orders/{id}/change": { "operationId": "post_v1_buyer_orders_id_change", "summary": "Change an open order’s states, daily cap or run length", "description": "Applied at once, or sent to the account for approval, as your access to orders allows. The quantity does not change here: more leads is a new order.", "tags": [ "Orders" ], "x-traki-scope": "orders:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "states": { "maxItems": 60, "type": "array", "items": { "type": "string", "minLength": 2, "maxLength": 2 } }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 100000 }, { "type": "null" } ] }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": 1, "maximum": 365 }, { "type": "null" } ] }, "reason": { "type": "string", "minLength": 3, "maxLength": 300 }, "ifVersion": { "description": "The `version` the change is based on; refused with 409 when the order moved on.", "type": "string", "pattern": "^\\d{1,16}$" } }, "required": [ "reason" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "enum": [ "applied", "pendingApproval" ] }, "order": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version" ], "additionalProperties": false }, "changeRequestId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] } }, "required": [ "result", "order", "changeRequestId" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Cancel an open order (/developers/buyer/reference/orders/post-orders-id-cancel) The leads still owed are refunded the way they were paid. Applied at once, or sent to the account for approval, as your access to orders allows. Send an Idempotency-Key: it moves money. ```json { "POST /v1/buyer/orders/{id}/cancel": { "operationId": "post_v1_buyer_orders_id_cancel", "summary": "Cancel an open order", "description": "The leads still owed are refunded the way they were paid. Applied at once, or sent to the account for approval, as your access to orders allows. Send an Idempotency-Key: it moves money.", "tags": [ "Orders" ], "x-traki-scope": "orders:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "reason": { "type": "string", "minLength": 3, "maxLength": 300 }, "ifVersion": { "description": "The `version` the change is based on; refused with 409 when the order moved on.", "type": "string", "pattern": "^\\d{1,16}$" } }, "required": [ "reason" ], "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "enum": [ "applied", "pendingApproval" ] }, "order": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "status": { "type": "string" }, "test": { "type": "boolean" }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "tier": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "shelf": { "type": "string" }, "states": { "type": "array", "items": { "type": "string" } }, "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "filled": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "owed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "replacements": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pacePerHour": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "deliveryDays": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "currency": { "type": "string" }, "price": { "type": "string" }, "total": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "discount": { "type": "string" }, "paymentMethod": { "type": [ "string", "null" ] }, "paidAt": { "type": [ "string", "null" ] }, "pausedAt": { "type": [ "string", "null" ] }, "pauseReason": { "type": [ "string", "null" ] }, "holdReason": { "type": [ "string", "null" ] }, "cancelReason": { "type": [ "string", "null" ] }, "completedAt": { "type": [ "string", "null" ] }, "expectedCompletionAt": { "type": [ "string", "null" ] }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "refunded": { "type": "object", "properties": { "leads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "cash": { "type": "string" }, "credit": { "type": "string" }, "at": { "type": [ "string", "null" ] } }, "required": [ "leads", "cash", "credit", "at" ], "additionalProperties": false }, "origin": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "version": { "type": "string" } }, "required": [ "id", "code", "status", "test", "campaign", "tier", "shelf", "states", "quantity", "filled", "owed", "replacements", "dailyCap", "pacePerHour", "deliveryDays", "currency", "price", "total", "cash", "credit", "discount", "paymentMethod", "paidAt", "pausedAt", "pauseReason", "holdReason", "cancelReason", "completedAt", "expectedCompletionAt", "lastDeliveryAt", "refunded", "origin", "createdAt", "updatedAt", "version" ], "additionalProperties": false }, "changeRequestId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] } }, "required": [ "result", "order", "changeRequestId" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your wallet for lead orders: cash and credit (/developers/buyer/reference/orders/get-wallet) ```json { "GET /v1/buyer/wallet": { "operationId": "get_v1_buyer_wallet", "summary": "Your wallet for lead orders: cash and credit", "tags": [ "Orders" ], "x-traki-scope": "orders:read", "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "currency": { "type": "string" }, "cashBalance": { "type": "string" }, "creditBalance": { "type": "string" }, "lastEntryAt": { "type": [ "string", "null" ] }, "openPayments": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ "currency", "cashBalance", "creditBalance", "lastEntryAt", "openPayments" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your wallet’s ledger, newest first (/developers/buyer/reference/orders/get-wallet-entries) ```json { "GET /v1/buyer/wallet/entries": { "operationId": "get_v1_buyer_wallet_entries", "summary": "Your wallet’s ledger, newest first", "tags": [ "Orders" ], "x-traki-scope": "orders:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "at": { "type": "string" }, "type": { "type": "string" }, "cash": { "type": "string" }, "credit": { "type": "string" }, "cashAfter": { "type": "string" }, "creditAfter": { "type": "string" }, "order": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" } }, "required": [ "id", "code" ], "additionalProperties": false }, { "type": "null" } ] }, "note": { "type": [ "string", "null" ] } }, "required": [ "id", "at", "type", "cash", "credit", "cashAfter", "creditAfter", "order", "note" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # The calls you bought (/developers/buyer/reference/calls/get-calls) ```json { "GET /v1/buyer/calls": { "operationId": "get_v1_buyer_calls", "summary": "The calls you bought", "tags": [ "Calls" ], "x-traki-scope": "calls:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "campaignId", "in": "query", "required": false, "schema": { "type": "string", "format": "uuid" } }, { "name": "includeTest", "in": "query", "required": false, "schema": { "default": "false", "type": "string", "enum": [ "true", "false" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "startedAt": { "type": "string" }, "endedAt": { "type": [ "string", "null" ] }, "callerMasked": { "type": [ "string", "null" ] }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "source": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "stage": { "type": "string" }, "outcome": { "type": [ "string", "null" ] }, "outcomeLabel": { "type": "string" }, "durationSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "connectedSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billable": { "type": "boolean" }, "charge": { "type": [ "number", "null" ] }, "hasRecording": { "type": "boolean" }, "isTest": { "type": "boolean" } }, "required": [ "id", "code", "startedAt", "endedAt", "callerMasked", "campaign", "source", "stage", "outcome", "outcomeLabel", "durationSec", "connectedSec", "billable", "charge", "hasRecording", "isTest" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # One of your calls (/developers/buyer/reference/calls/get-calls-id) ```json { "GET /v1/buyer/calls/{id}": { "operationId": "get_v1_buyer_calls_id", "summary": "One of your calls", "tags": [ "Calls" ], "x-traki-scope": "calls:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "startedAt": { "type": "string" }, "endedAt": { "type": [ "string", "null" ] }, "callerMasked": { "type": [ "string", "null" ] }, "campaign": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, "source": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "stage": { "type": "string" }, "outcome": { "type": [ "string", "null" ] }, "outcomeLabel": { "type": "string" }, "durationSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "connectedSec": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billable": { "type": "boolean" }, "charge": { "type": [ "number", "null" ] }, "hasRecording": { "type": "boolean" }, "isTest": { "type": "boolean" }, "answeredAt": { "type": [ "string", "null" ] }, "ringSec": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "bid": { "type": [ "number", "null" ] }, "recordingUrl": { "type": [ "string", "null" ] }, "disputes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "state": { "type": "string" }, "amount": { "type": "number" } }, "required": [ "id", "code", "state", "amount" ], "additionalProperties": false } }, "canDispute": { "type": "boolean" } }, "required": [ "id", "code", "startedAt", "endedAt", "callerMasked", "campaign", "source", "stage", "outcome", "outcomeLabel", "durationSec", "connectedSec", "billable", "charge", "hasRecording", "isTest", "answeredAt", "ringSec", "bid", "recordingUrl", "disputes", "canDispute" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your lead returns or call disputes, and where each stands (/developers/buyer/reference/returns-and-disputes/get-returns) ```json { "GET /v1/buyer/returns": { "operationId": "get_v1_buyer_returns", "summary": "Your lead returns or call disputes, and where each stands", "tags": [ "Returns and disputes" ], "x-traki-scope": "returns:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } }, { "name": "updatedSince", "in": "query", "required": false, "schema": { "type": "string", "format": "date-time" } }, { "name": "kind", "in": "query", "required": false, "schema": { "default": "lead", "type": "string", "enum": [ "lead", "call" ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "kind": { "type": "string", "enum": [ "lead", "call" ] }, "code": { "type": "string" }, "state": { "type": "string" }, "reason": { "type": "string" }, "reasonKey": { "type": [ "string", "null" ] }, "note": { "type": [ "string", "null" ] }, "lead": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" } }, "required": [ "id", "code" ], "additionalProperties": false }, { "type": "null" } ] }, "call": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" } }, "required": [ "id", "code" ], "additionalProperties": false }, { "type": "null" } ] }, "campaign": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "source": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "amount": { "type": [ "number", "null" ] }, "credited": { "type": [ "number", "null" ] }, "resolution": { "type": [ "string", "null" ] }, "requestedAt": { "type": "string" }, "decidedAt": { "type": [ "string", "null" ] }, "windowClosesAt": { "type": [ "string", "null" ] } }, "required": [ "id", "kind", "code", "state", "reason", "reasonKey", "note", "lead", "call", "campaign", "source", "amount", "credited", "resolution", "requestedAt", "decidedAt", "windowClosesAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Ask for a lead return, or raise a dispute on a call (/developers/buyer/reference/returns-and-disputes/post-returns) A lead return must fall inside the campaign’s return window; one request per lead and per call is open at a time. The account decides in its inbox. ```json { "POST /v1/buyer/returns": { "operationId": "post_v1_buyer_returns", "summary": "Ask for a lead return, or raise a dispute on a call", "description": "A lead return must fall inside the campaign’s return window; one request per lead and per call is open at a time. The account decides in its inbox.", "tags": [ "Returns and disputes" ], "x-traki-scope": "returns:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "kind": { "type": "string", "enum": [ "lead", "call" ] }, "leadId": { "type": "string", "format": "uuid" }, "callId": { "type": "string", "format": "uuid" }, "reasonKey": { "type": "string", "enum": [ "bad_phone", "fake", "duplicate", "out_of_area", "never_applied", "no_consent", "other" ] }, "reason": { "type": "string", "minLength": 5, "maxLength": 500 }, "evidenceUrl": { "type": "string", "maxLength": 1000, "format": "uri" } }, "required": [ "kind" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "kind": { "type": "string", "enum": [ "lead", "call" ] }, "code": { "type": "string" }, "state": { "type": "string" }, "reason": { "type": "string" }, "reasonKey": { "type": [ "string", "null" ] }, "note": { "type": [ "string", "null" ] }, "lead": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" } }, "required": [ "id", "code" ], "additionalProperties": false }, { "type": "null" } ] }, "call": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" } }, "required": [ "id", "code" ], "additionalProperties": false }, { "type": "null" } ] }, "campaign": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "source": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false }, { "type": "null" } ] }, "amount": { "type": [ "number", "null" ] }, "credited": { "type": [ "number", "null" ] }, "resolution": { "type": [ "string", "null" ] }, "requestedAt": { "type": "string" }, "decidedAt": { "type": [ "string", "null" ] }, "windowClosesAt": { "type": [ "string", "null" ] } }, "required": [ "id", "kind", "code", "state", "reason", "reasonKey", "note", "lead", "call", "campaign", "source", "amount", "credited", "resolution", "requestedAt", "decidedAt", "windowClosesAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your balance and what is open on your statements (/developers/buyer/reference/billing/get-billing) ```json { "GET /v1/buyer/billing": { "operationId": "get_v1_buyer_billing", "summary": "Your balance and what is open on your statements", "tags": [ "Billing" ], "x-traki-scope": "billing:read", "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "currency": { "type": "string" }, "funding": { "type": "object", "properties": { "mode": { "type": "string" }, "balance": { "type": [ "number", "null" ] }, "minimum": { "type": [ "number", "null" ] }, "rechargeTo": { "type": [ "number", "null" ] } }, "required": [ "mode", "balance", "minimum", "rechargeTo" ], "additionalProperties": false }, "openStatements": { "type": "object", "properties": { "count": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "amount": { "type": "number" } }, "required": [ "count", "amount" ], "additionalProperties": false } }, "required": [ "currency", "funding", "openStatements" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Every movement of your balance, newest first (/developers/buyer/reference/billing/get-billing-ledger) ```json { "GET /v1/buyer/billing/ledger": { "operationId": "get_v1_buyer_billing_ledger", "summary": "Every movement of your balance, newest first", "tags": [ "Billing" ], "x-traki-scope": "billing:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "at": { "type": "string" }, "kind": { "type": "string" }, "amount": { "type": "number" }, "balanceAfter": { "type": [ "number", "null" ] }, "note": { "type": [ "string", "null" ] } }, "required": [ "id", "at", "kind", "amount", "balanceAfter", "note" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your statements (invoices), newest first (/developers/buyer/reference/billing/get-billing-statements) ```json { "GET /v1/buyer/billing/statements": { "operationId": "get_v1_buyer_billing_statements", "summary": "Your statements (invoices), newest first", "tags": [ "Billing" ], "x-traki-scope": "billing:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "periodStart": { "type": "string" }, "periodEnd": { "type": "string" }, "periodLabel": { "type": [ "string", "null" ] }, "billableCalls": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "billableLeads": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "amount": { "type": "number" }, "creditTotal": { "type": "number" }, "disputesCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "state": { "type": "string" }, "settledAt": { "type": [ "string", "null" ] } }, "required": [ "id", "code", "periodStart", "periodEnd", "periodLabel", "billableCalls", "billableLeads", "amount", "creditTotal", "disputesCount", "state", "settledAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Where your calls ring, in ring order (/developers/buyer/reference/destinations/get-destinations) ```json { "GET /v1/buyer/destinations": { "operationId": "get_v1_buyer_destinations", "summary": "Where your calls ring, in ring order", "tags": [ "Destinations" ], "x-traki-scope": "destinations:read", "parameters": [], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "destinations": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "type": { "type": "string" }, "value": { "type": "string" }, "label": { "type": [ "string", "null" ] }, "state": { "type": "string", "enum": [ "active", "standby", "not_ready" ] }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "hoursOverride": { "type": [ "string", "null" ] }, "verifiedAt": { "type": [ "string", "null" ] }, "locked": { "type": "boolean" } }, "required": [ "id", "type", "value", "label", "state", "priority", "concurrencyCap", "dailyCap", "hoursOverride", "verifiedAt", "locked" ], "additionalProperties": false } } }, "required": [ "destinations" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a destination’s number, or switch it between active and standby (/developers/buyer/reference/destinations/patch-destinations-id) Applies at once when the account lets you edit destinations (`applied`), or becomes a request it approves (`pendingApproval`). A destination the account locked cannot be changed. ```json { "PATCH /v1/buyer/destinations/{id}": { "operationId": "patch_v1_buyer_destinations_id", "summary": "Change a destination’s number, or switch it between active and standby", "description": "Applies at once when the account lets you edit destinations (`applied`), or becomes a request it approves (`pendingApproval`). A destination the account locked cannot be changed.", "tags": [ "Destinations" ], "x-traki-scope": "destinations:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "value": { "type": "string", "minLength": 1, "maxLength": 300 }, "label": { "anyOf": [ { "type": "string", "maxLength": 80 }, { "type": "null" } ] }, "state": { "type": "string", "enum": [ "active", "standby" ] }, "ifVersion": { "type": "string", "maxLength": 40 } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "result": { "type": "string", "enum": [ "applied", "pendingApproval" ] }, "destination": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "type": { "type": "string" }, "value": { "type": "string" }, "label": { "type": [ "string", "null" ] }, "state": { "type": "string", "enum": [ "active", "standby", "not_ready" ] }, "priority": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "concurrencyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "dailyCap": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "hoursOverride": { "type": [ "string", "null" ] }, "verifiedAt": { "type": [ "string", "null" ] }, "locked": { "type": "boolean" } }, "required": [ "id", "type", "value", "label", "state", "priority", "concurrencyCap", "dailyCap", "hoursOverride", "verifiedAt", "locked" ], "additionalProperties": false }, { "type": "null" } ] }, "changeRequestId": { "anyOf": [ { "type": "string", "format": "uuid" }, { "type": "null" } ] } }, "required": [ "result", "destination", "changeRequestId" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Your webhook endpoints (/developers/buyer/reference/webhooks/get-webhooks) ```json { "GET /v1/buyer/webhooks": { "operationId": "get_v1_buyer_webhooks", "summary": "Your webhook endpoints", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:read", "parameters": [ { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string" }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "code", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Subscribe one of your URLs to events about your own traffic (/developers/buyer/reference/webhooks/post-webhooks) The signing secret is answered once, here. The URL must be a public https:// address. ```json { "POST /v1/buyer/webhooks": { "operationId": "post_v1_buyer_webhooks", "summary": "Subscribe one of your URLs to events about your own traffic", "description": "The signing secret is answered once, here. The URL must be a public https:// address.", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:write", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "url": { "type": "string", "maxLength": 2048, "format": "uri" }, "events": { "minItems": 1, "maxItems": 26, "type": "array", "items": { "type": "string", "enum": [ "call.started", "call.ended", "call.billable", "lead.received", "lead.allocated", "lead.disclosed", "lead.returned", "lead.assigned", "order.paid", "lead.dnc_flagged", "order.filled", "tier.filled", "callback.completed", "sms.status_changed", "statement.closed", "payout.paid", "approval.decided", "alert.fired", "buyer.created", "buyer.updated", "publisher.created", "publisher.updated", "campaign.created", "campaign.updated", "number.assigned", "number.released" ] } } }, "required": [ "url", "events" ], "additionalProperties": false } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "webhook": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string" }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "code", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false }, "secret": { "type": "string" } }, "required": [ "webhook", "secret" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Change a webhook’s URL or events, or pause and resume it (/developers/buyer/reference/webhooks/patch-webhooks-id) ```json { "PATCH /v1/buyer/webhooks/{id}": { "operationId": "patch_v1_buyer_webhooks_id", "summary": "Change a webhook’s URL or events, or pause and resume it", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "url": { "type": "string", "maxLength": 2048, "format": "uri" }, "events": { "minItems": 1, "maxItems": 26, "type": "array", "items": { "type": "string", "enum": [ "call.started", "call.ended", "call.billable", "lead.received", "lead.allocated", "lead.disclosed", "lead.returned", "lead.assigned", "order.paid", "lead.dnc_flagged", "order.filled", "tier.filled", "callback.completed", "sms.status_changed", "statement.closed", "payout.paid", "approval.decided", "alert.fired", "buyer.created", "buyer.updated", "publisher.created", "publisher.updated", "campaign.created", "campaign.updated", "number.assigned", "number.released" ] } }, "state": { "type": "string", "enum": [ "active", "paused" ] } }, "additionalProperties": false } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "code": { "type": "string" }, "url": { "type": "string" }, "events": { "type": "array", "items": { "type": "string" } }, "state": { "type": "string" }, "failureCount": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "lastDeliveryAt": { "type": [ "string", "null" ] }, "lastFailureNote": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "code", "url", "events", "state", "failureCount", "lastDeliveryAt", "lastFailureNote", "createdAt" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # Remove a webhook (/developers/buyer/reference/webhooks/delete-webhooks-id) ```json { "DELETE /v1/buyer/webhooks/{id}": { "operationId": "delete_v1_buyer_webhooks_id", "summary": "Remove a webhook", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:write", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "deleted": { "type": "boolean", "const": true } }, "required": [ "id", "deleted" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ``` # What one of your webhooks was sent, and how each delivery went (/developers/buyer/reference/webhooks/get-webhooks-id-deliveries) ```json { "GET /v1/buyer/webhooks/{id}/deliveries": { "operationId": "get_v1_buyer_webhooks_id_deliveries", "summary": "What one of your webhooks was sent, and how each delivery went", "tags": [ "Webhooks" ], "x-traki-scope": "webhooks:read", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "name": "limit", "in": "query", "required": false, "schema": { "default": 25, "type": "integer", "minimum": 1, "maximum": 100 } }, { "name": "cursor", "in": "query", "required": false, "schema": { "type": "string", "maxLength": 200 } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid" }, "eventId": { "type": "string" }, "eventType": { "type": "string" }, "attempts": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "state": { "type": "string" }, "nextAttemptAt": { "type": [ "string", "null" ] }, "lastAttemptAt": { "type": [ "string", "null" ] }, "lastResponseCode": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "lastError": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" } }, "required": [ "id", "eventId", "eventType", "attempts", "state", "nextAttemptAt", "lastAttemptAt", "lastResponseCode", "lastError", "createdAt" ], "additionalProperties": false } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": [ "string", "null" ] } }, "required": [ "data", "hasMore", "nextCursor" ], "additionalProperties": false } } } }, "400": { "description": "The request is malformed", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "401": { "description": "No key, or the key is unknown, revoked or expired", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "403": { "description": "The key lacks the scope or the plan, or opens another part of the API", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "404": { "description": "No such record in this account", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } }, "429": { "description": "Too many requests; see Retry-After", "content": { "application/problem+json": { "schema": { "$ref": "#/components/schemas/Problem" } } } } } } } ```