Skip to Content
Developers

Export a month of calls

Read every call in a month, page by page, into a file or your own database.

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

Set startedAfter and startedBefore to the month's bounds, in the account's time zone, and ask for 100 calls a page:

curl 'https://api.traki.io/v1/account/calls?startedAfter=2026-11-01T00:00:00-05:00&startedBefore=2026-12-01T00:00:00-05:00&limit=100' \
  -H "Authorization: Bearer $TRAKI_KEY"

2. Follow the cursor

Pass each page's nextCursor as cursor until hasMore is false.

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

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.