{
    "openapi": "3.0.3",
    "info": {
        "title": "Operator Data API",
        "version": "current",
        "description": "The operator data API gives your own systems the reports your operators see in the operator area, over every partner of the program.\n\n## Rules every request follows\n\n- The API has one address and no version: it only grows, and a field never changes its meaning.\n- Answers are JSON, with snake_case keys. Times are ISO 8601; answers give them in UTC with `Z`, and requests may use any UTC offset.\n- A parameter a report doesn't define is refused with `422`, so a misspelt filter never widens a report.\n\n## Tokens and addresses\n\nEvery request carries one of the program's data tokens:\n\n```\nAuthorization: Bearer afq_data_live_…\n```\n\n- An operator with the Manage Data Tokens permission creates a token in the operator area under **Settings → Data Tokens**. It is shown once: keep it in your system's secret store.\n- A token has scopes, chosen when it is created and never changed: **reports** gives the endpoints under `/operator/reports/`, **partners** `/operator/partners`, **campaigns** `/operator/campaigns`, **bills** `/operator/bills` and `/operator/adjustments`, and **players** `/operator/players` and players by the casino's ids in reports. A request outside the token's scopes is refused with `403` and `scope_missing`. An operator gives a token only scopes their own permissions cover, and only while they see every partner.\n- Each token lists the IP addresses it may be used from. Requests come only from those: a request from any other address is refused, by the firewall before it reaches Affiliqo, or by Affiliqo with `403` and `address_not_allowed`. A new token's addresses reach the API about a minute after they are saved, and a revoked token's stop within about a minute.\n- The program has at most 10 working tokens. A token stops working when an operator revokes it.\n- The API answers `402` while the operator data API is off for the program.\n\n## Limits\n\nEach token may send 120 requests a minute. Past that, the answer is `429` with `Retry-After`, the seconds to wait. An address that sends 30 requests with a wrong token in a minute gets `429` too, until the minute ends.\n\nWhen reports are briefly busy or a report takes too long, the answer is `503` with `Retry-After`; ask again after it, or for a shorter span.\n\n## What the reports hold\n\n- Money is in minor units of the answer's `currency`: cents for USD. A currency with many decimal places, such as USDT, gives integers past JavaScript's safe integers, so parse amounts as big integers.\n- Every amount is in one currency: the program's unless you ask for another with `currency`, converted at the rates of `rates_on`.\n- A report counts days, weeks and months in `timezone`, the program's unless you ask for another.\n- Reports cover every partner. The statistics report also groups and filters by partner, partner tag and manager, and the traffic report by partner.\n- Players show by their masked id, country and sign-up date, or by the casino's id instead of the mask when the token has the players scope; `player_ids` then filters by the casino's ids. Never their personal details, and never visitors' IP addresses.\n- Frozen activity, players' activity while they are disabled, self-excluded or frozen, counts unless you leave it out with `frozen`.\n\n`GET /operator/reports/attributes` lists exactly what the token may ask of each report.\n\n## Pages\n\nLists give 100 records a page unless you ask for up to 1,000 with `limit`, in the order of their ids; send `next_cursor` as `cursor` for the next page, until it is null.\n\nA report gives 100 rows a page unless you ask for up to 1,000 with `limit`. When there are more, `next_cursor` is set: send it as `cursor` with exactly the same parameters for the next page, until it is null. Each page reads the report as it is when you ask for it, so rows can move between pages while the casino sends new activity. When the pages must add up, ask one page of up to 1,000 rows, or a span that has ended.\n\n## Errors\n\nEvery error is a problem document with a stable `code`, such as `invalid_token` or `address_not_allowed`, and a `trace_id` to quote when you ask Affiliqo about a request. An error from the firewall, before the request reached Affiliqo, has the same fields as `application/json`, without a trace id.\n"
    },
    "servers": [
        {
            "url": "https://api.affiliqo.com",
            "description": "Production"
        }
    ],
    "security": [
        {
            "Token": []
        }
    ],
    "paths": {
        "/operator/reports/statistics": {
            "get": {
                "operationId": "getOperatorStatisticsReport",
                "summary": "Read the statistics report",
                "description": "What every partner's links and players brought: visits, registrations, first deposits, deposits, cashouts, GGR, NGR, real NGR, the admin fee, and what bills paid: payable NGR, partner income and each reward kind, counted on the first day of their period, with the current period's estimate until its bill is issued. Group and filter by partner, partner tag and manager as well. Frozen activity counts unless `frozen` leaves it out.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/From"
                    },
                    {
                        "$ref": "#/components/parameters/To"
                    },
                    {
                        "$ref": "#/components/parameters/Timezone"
                    },
                    {
                        "$ref": "#/components/parameters/GroupBy"
                    },
                    {
                        "$ref": "#/components/parameters/DateGrain"
                    },
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/Columns"
                    },
                    {
                        "$ref": "#/components/parameters/Currency"
                    },
                    {
                        "$ref": "#/components/parameters/RatesOn"
                    },
                    {
                        "$ref": "#/components/parameters/Bots"
                    },
                    {
                        "$ref": "#/components/parameters/Sort"
                    },
                    {
                        "$ref": "#/components/parameters/Direction"
                    },
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "$ref": "#/components/parameters/BrandIds"
                    },
                    {
                        "$ref": "#/components/parameters/DealIds"
                    },
                    {
                        "$ref": "#/components/parameters/Strategies"
                    },
                    {
                        "$ref": "#/components/parameters/CampaignIds"
                    },
                    {
                        "$ref": "#/components/parameters/PromoIds"
                    },
                    {
                        "$ref": "#/components/parameters/PlayerIds"
                    },
                    {
                        "$ref": "#/components/parameters/PlayerCountries"
                    },
                    {
                        "$ref": "#/components/parameters/TagValues"
                    },
                    {
                        "$ref": "#/components/parameters/BillId"
                    },
                    {
                        "$ref": "#/components/parameters/Frozen"
                    },
                    {
                        "$ref": "#/components/parameters/PartnerIds"
                    },
                    {
                        "$ref": "#/components/parameters/PartnerTags"
                    },
                    {
                        "$ref": "#/components/parameters/ManagerIds"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The report, or one page of it.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ReportAnswer"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/InvalidReportCursor"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "$ref": "#/components/responses/CapabilityOff"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/RateMissing"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidReport"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "500": {
                        "$ref": "#/components/responses/ServerError"
                    },
                    "503": {
                        "$ref": "#/components/responses/ReportsUnavailable"
                    }
                },
                "x-codeSamples": [
                    {
                        "lang": "PHP",
                        "label": "PHP",
                        "source": "<?php\n\ndeclare(strict_types=1);\n\n// Reads September's statistics by partner. The token comes from your secret store.\n$query = http_build_query(['from' => '2026-09-01T00:00:00Z', 'to' => '2026-10-01T00:00:00Z', 'group_by' => 'partner', 'columns' => 'registrations,first_deposits_count,deposits_amount,partner_income_amount']);\n$curl = curl_init('https://api.affiliqo.com/operator/reports/statistics'.($query === '' ? '' : '?'.$query));\ncurl_setopt_array($curl, [\n    CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AFFILIQO_DATA_TOKEN')],\n    CURLOPT_USERAGENT => 'your-warehouse/1.0',\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_TIMEOUT => 30,\n]);\n// Amounts can pass PHP's integers in a currency with many decimals, so they are read as strings.\n$answer = json_decode((string) curl_exec($curl), true, flags: JSON_BIGINT_AS_STRING);\n\nif (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) < 300) {\n    echo json_encode($answer['rows']), PHP_EOL;\n} else {\n    // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    fwrite(STDERR, ($answer['code'] ?? 'no answer').' '.($answer['trace_id'] ?? '').PHP_EOL);\n}\n"
                    },
                    {
                        "lang": "JavaScript",
                        "label": "Node.js",
                        "source": "// Reads September's statistics by partner. The token comes from your secret store. Amounts can pass\n// JavaScript's safe integers, so integers are parsed as BigInt.\nconst query = new URLSearchParams({ from: '2026-09-01T00:00:00Z', to: '2026-10-01T00:00:00Z', group_by: 'partner', columns: 'registrations,first_deposits_count,deposits_amount,partner_income_amount' }).toString();\nconst url = 'https://api.affiliqo.com/operator/reports/statistics' + (query === '' ? '' : '?' + query);\nconst response = await fetch(url, {\n  headers: { Authorization: 'Bearer ' + process.env.AFFILIQO_DATA_TOKEN },\n});\nconst text = await response.text();\nconst answer = JSON.parse(text, (key, value, context) =>\n  Number.isInteger(value) && !Number.isSafeInteger(value) ? BigInt(context.source) : value,\n);\n\nif (response.status < 300) {\n  console.log(answer.rows);\n} else {\n  // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n  console.error(answer.code, answer.trace_id);\n}\n"
                    },
                    {
                        "lang": "Python",
                        "label": "Python",
                        "source": "# Reads September's statistics by partner. The token comes from your secret store.\nimport json\nimport os\nimport urllib.error\nimport urllib.parse\nimport urllib.request\n\nquery = urllib.parse.urlencode({\"from\": \"2026-09-01T00:00:00Z\", \"to\": \"2026-10-01T00:00:00Z\", \"group_by\": \"partner\", \"columns\": \"registrations,first_deposits_count,deposits_amount,partner_income_amount\"})\nurl = \"https://api.affiliqo.com/operator/reports/statistics\" + (\"?\" + query if query else \"\")\nrequest = urllib.request.Request(\n    url,\n    data=None,\n    method=\"GET\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"AFFILIQO_DATA_TOKEN\"]},\n)\n\ntry:\n    with urllib.request.urlopen(request, timeout=30) as response:\n        answer = json.load(response)\n        print(answer[\"rows\"])\nexcept urllib.error.HTTPError as error:\n    # A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    problem = json.load(error)\n    print(problem.get(\"code\"), problem.get(\"trace_id\"))\n"
                    },
                    {
                        "lang": "Go",
                        "label": "Go",
                        "source": "// Reads September's statistics by partner. The token comes from your secret store.\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc main() {\n\tquery := url.Values{}\n\tquery.Set(\"from\", \"2026-09-01T00:00:00Z\")\n\tquery.Set(\"to\", \"2026-10-01T00:00:00Z\")\n\tquery.Set(\"group_by\", \"partner\")\n\tquery.Set(\"columns\", \"registrations,first_deposits_count,deposits_amount,partner_income_amount\")\n\ttarget := \"https://api.affiliqo.com/operator/reports/statistics\"\n\tif encoded := query.Encode(); encoded != \"\" {\n\t\ttarget += \"?\" + encoded\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", target, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"AFFILIQO_DATA_TOKEN\"))\n\n\tclient := &http.Client{Timeout: 30 * time.Second}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Amounts can pass the integers JSON numbers decode to, so they are kept as json.Number.\n\tdecoder := json.NewDecoder(response.Body)\n\tdecoder.UseNumber()\n\tvar answer map[string]any\n\tif err := decoder.Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif response.StatusCode < 300 {\n\t\tfmt.Println(answer[\"rows\"])\n\t} else {\n\t\t// A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n\t\tfmt.Fprintln(os.Stderr, answer[\"code\"], answer[\"trace_id\"])\n\t}\n}\n"
                    }
                ]
            }
        },
        "/operator/reports/traffic": {
            "get": {
                "operationId": "getOperatorTrafficReport",
                "summary": "Read the traffic report",
                "description": "Every partner's visits, unique and bot visits, and the players they brought, by partner, landing page, device, browser, operating system, visit country, referring site, traffic source, campaign, promo, date or a dynamic tag, with the conversion rates between them. Never by visitors' IP addresses.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/From"
                    },
                    {
                        "$ref": "#/components/parameters/To"
                    },
                    {
                        "$ref": "#/components/parameters/Timezone"
                    },
                    {
                        "$ref": "#/components/parameters/GroupBy"
                    },
                    {
                        "$ref": "#/components/parameters/DateGrain"
                    },
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/Columns"
                    },
                    {
                        "$ref": "#/components/parameters/Currency"
                    },
                    {
                        "$ref": "#/components/parameters/RatesOn"
                    },
                    {
                        "$ref": "#/components/parameters/Bots"
                    },
                    {
                        "$ref": "#/components/parameters/Sort"
                    },
                    {
                        "$ref": "#/components/parameters/Direction"
                    },
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "$ref": "#/components/parameters/Stag"
                    },
                    {
                        "$ref": "#/components/parameters/BrandIds"
                    },
                    {
                        "$ref": "#/components/parameters/CampaignIds"
                    },
                    {
                        "$ref": "#/components/parameters/PromoIds"
                    },
                    {
                        "$ref": "#/components/parameters/PlayerIds"
                    },
                    {
                        "$ref": "#/components/parameters/LandingIds"
                    },
                    {
                        "$ref": "#/components/parameters/Devices"
                    },
                    {
                        "$ref": "#/components/parameters/BrowserFamilies"
                    },
                    {
                        "$ref": "#/components/parameters/OsFamilies"
                    },
                    {
                        "$ref": "#/components/parameters/VisitCountries"
                    },
                    {
                        "$ref": "#/components/parameters/Referrers"
                    },
                    {
                        "$ref": "#/components/parameters/TrafficSourceIds"
                    },
                    {
                        "$ref": "#/components/parameters/TagValues"
                    },
                    {
                        "$ref": "#/components/parameters/Frozen"
                    },
                    {
                        "$ref": "#/components/parameters/PartnerIds"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The report, or one page of it.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ReportAnswer"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/InvalidReportCursor"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "$ref": "#/components/responses/CapabilityOff"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "409": {
                        "$ref": "#/components/responses/RateMissing"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidReport"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "500": {
                        "$ref": "#/components/responses/ServerError"
                    },
                    "503": {
                        "$ref": "#/components/responses/ReportsUnavailable"
                    }
                },
                "x-codeSamples": [
                    {
                        "lang": "PHP",
                        "label": "PHP",
                        "source": "<?php\n\ndeclare(strict_types=1);\n\n// Reads September's traffic by partner and day. The token comes from your secret store.\n$query = http_build_query(['from' => '2026-09-01T00:00:00Z', 'to' => '2026-10-01T00:00:00Z', 'group_by' => 'partner,date']);\n$curl = curl_init('https://api.affiliqo.com/operator/reports/traffic'.($query === '' ? '' : '?'.$query));\ncurl_setopt_array($curl, [\n    CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AFFILIQO_DATA_TOKEN')],\n    CURLOPT_USERAGENT => 'your-warehouse/1.0',\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_TIMEOUT => 30,\n]);\n// Amounts can pass PHP's integers in a currency with many decimals, so they are read as strings.\n$answer = json_decode((string) curl_exec($curl), true, flags: JSON_BIGINT_AS_STRING);\n\nif (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) < 300) {\n    echo json_encode($answer['rows']), PHP_EOL;\n} else {\n    // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    fwrite(STDERR, ($answer['code'] ?? 'no answer').' '.($answer['trace_id'] ?? '').PHP_EOL);\n}\n"
                    },
                    {
                        "lang": "JavaScript",
                        "label": "Node.js",
                        "source": "// Reads September's traffic by partner and day. The token comes from your secret store. Amounts can pass\n// JavaScript's safe integers, so integers are parsed as BigInt.\nconst query = new URLSearchParams({ from: '2026-09-01T00:00:00Z', to: '2026-10-01T00:00:00Z', group_by: 'partner,date' }).toString();\nconst url = 'https://api.affiliqo.com/operator/reports/traffic' + (query === '' ? '' : '?' + query);\nconst response = await fetch(url, {\n  headers: { Authorization: 'Bearer ' + process.env.AFFILIQO_DATA_TOKEN },\n});\nconst text = await response.text();\nconst answer = JSON.parse(text, (key, value, context) =>\n  Number.isInteger(value) && !Number.isSafeInteger(value) ? BigInt(context.source) : value,\n);\n\nif (response.status < 300) {\n  console.log(answer.rows);\n} else {\n  // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n  console.error(answer.code, answer.trace_id);\n}\n"
                    },
                    {
                        "lang": "Python",
                        "label": "Python",
                        "source": "# Reads September's traffic by partner and day. The token comes from your secret store.\nimport json\nimport os\nimport urllib.error\nimport urllib.parse\nimport urllib.request\n\nquery = urllib.parse.urlencode({\"from\": \"2026-09-01T00:00:00Z\", \"to\": \"2026-10-01T00:00:00Z\", \"group_by\": \"partner,date\"})\nurl = \"https://api.affiliqo.com/operator/reports/traffic\" + (\"?\" + query if query else \"\")\nrequest = urllib.request.Request(\n    url,\n    data=None,\n    method=\"GET\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"AFFILIQO_DATA_TOKEN\"]},\n)\n\ntry:\n    with urllib.request.urlopen(request, timeout=30) as response:\n        answer = json.load(response)\n        print(answer[\"rows\"])\nexcept urllib.error.HTTPError as error:\n    # A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    problem = json.load(error)\n    print(problem.get(\"code\"), problem.get(\"trace_id\"))\n"
                    },
                    {
                        "lang": "Go",
                        "label": "Go",
                        "source": "// Reads September's traffic by partner and day. The token comes from your secret store.\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc main() {\n\tquery := url.Values{}\n\tquery.Set(\"from\", \"2026-09-01T00:00:00Z\")\n\tquery.Set(\"to\", \"2026-10-01T00:00:00Z\")\n\tquery.Set(\"group_by\", \"partner,date\")\n\ttarget := \"https://api.affiliqo.com/operator/reports/traffic\"\n\tif encoded := query.Encode(); encoded != \"\" {\n\t\ttarget += \"?\" + encoded\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", target, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"AFFILIQO_DATA_TOKEN\"))\n\n\tclient := &http.Client{Timeout: 30 * time.Second}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Amounts can pass the integers JSON numbers decode to, so they are kept as json.Number.\n\tdecoder := json.NewDecoder(response.Body)\n\tdecoder.UseNumber()\n\tvar answer map[string]any\n\tif err := decoder.Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif response.StatusCode < 300 {\n\t\tfmt.Println(answer[\"rows\"])\n\t} else {\n\t\t// A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n\t\tfmt.Fprintln(os.Stderr, answer[\"code\"], answer[\"trace_id\"])\n\t}\n}\n"
                    }
                ]
            }
        },
        "/operator/reports/cohorts": {
            "get": {
                "operationId": "getOperatorCohortReport",
                "summary": "Read the cohort report",
                "description": "Every partner's players grouped by the day, week or month they signed up, first deposited or deposited, and one figure of theirs in each period from the cohort's own.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/From"
                    },
                    {
                        "$ref": "#/components/parameters/To"
                    },
                    {
                        "$ref": "#/components/parameters/Timezone"
                    },
                    {
                        "$ref": "#/components/parameters/Currency"
                    },
                    {
                        "$ref": "#/components/parameters/RatesOn"
                    },
                    {
                        "$ref": "#/components/parameters/CohortType"
                    },
                    {
                        "$ref": "#/components/parameters/CohortGrain"
                    },
                    {
                        "$ref": "#/components/parameters/Figure"
                    },
                    {
                        "$ref": "#/components/parameters/Periods"
                    },
                    {
                        "$ref": "#/components/parameters/BrandIds"
                    },
                    {
                        "$ref": "#/components/parameters/CampaignIds"
                    },
                    {
                        "$ref": "#/components/parameters/PlayerCountries"
                    },
                    {
                        "$ref": "#/components/parameters/Frozen"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The report, or one page of it.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CohortAnswer"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "$ref": "#/components/responses/CapabilityOff"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "409": {
                        "$ref": "#/components/responses/RateMissing"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidReport"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "500": {
                        "$ref": "#/components/responses/ServerError"
                    },
                    "503": {
                        "$ref": "#/components/responses/ReportsUnavailable"
                    }
                },
                "x-codeSamples": [
                    {
                        "lang": "PHP",
                        "label": "PHP",
                        "source": "<?php\n\ndeclare(strict_types=1);\n\n// Reads the monthly sign-up cohorts' deposits this year. The token comes from your secret store.\n$query = http_build_query(['from' => '2026-01-01T00:00:00Z', 'to' => '2026-10-01T00:00:00Z', 'figure' => 'deposits_amount']);\n$curl = curl_init('https://api.affiliqo.com/operator/reports/cohorts'.($query === '' ? '' : '?'.$query));\ncurl_setopt_array($curl, [\n    CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AFFILIQO_DATA_TOKEN')],\n    CURLOPT_USERAGENT => 'your-warehouse/1.0',\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_TIMEOUT => 30,\n]);\n// Amounts can pass PHP's integers in a currency with many decimals, so they are read as strings.\n$answer = json_decode((string) curl_exec($curl), true, flags: JSON_BIGINT_AS_STRING);\n\nif (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) < 300) {\n    echo json_encode($answer['rows']), PHP_EOL;\n} else {\n    // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    fwrite(STDERR, ($answer['code'] ?? 'no answer').' '.($answer['trace_id'] ?? '').PHP_EOL);\n}\n"
                    },
                    {
                        "lang": "JavaScript",
                        "label": "Node.js",
                        "source": "// Reads the monthly sign-up cohorts' deposits this year. The token comes from your secret store. Amounts can pass\n// JavaScript's safe integers, so integers are parsed as BigInt.\nconst query = new URLSearchParams({ from: '2026-01-01T00:00:00Z', to: '2026-10-01T00:00:00Z', figure: 'deposits_amount' }).toString();\nconst url = 'https://api.affiliqo.com/operator/reports/cohorts' + (query === '' ? '' : '?' + query);\nconst response = await fetch(url, {\n  headers: { Authorization: 'Bearer ' + process.env.AFFILIQO_DATA_TOKEN },\n});\nconst text = await response.text();\nconst answer = JSON.parse(text, (key, value, context) =>\n  Number.isInteger(value) && !Number.isSafeInteger(value) ? BigInt(context.source) : value,\n);\n\nif (response.status < 300) {\n  console.log(answer.rows);\n} else {\n  // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n  console.error(answer.code, answer.trace_id);\n}\n"
                    },
                    {
                        "lang": "Python",
                        "label": "Python",
                        "source": "# Reads the monthly sign-up cohorts' deposits this year. The token comes from your secret store.\nimport json\nimport os\nimport urllib.error\nimport urllib.parse\nimport urllib.request\n\nquery = urllib.parse.urlencode({\"from\": \"2026-01-01T00:00:00Z\", \"to\": \"2026-10-01T00:00:00Z\", \"figure\": \"deposits_amount\"})\nurl = \"https://api.affiliqo.com/operator/reports/cohorts\" + (\"?\" + query if query else \"\")\nrequest = urllib.request.Request(\n    url,\n    data=None,\n    method=\"GET\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"AFFILIQO_DATA_TOKEN\"]},\n)\n\ntry:\n    with urllib.request.urlopen(request, timeout=30) as response:\n        answer = json.load(response)\n        print(answer[\"rows\"])\nexcept urllib.error.HTTPError as error:\n    # A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    problem = json.load(error)\n    print(problem.get(\"code\"), problem.get(\"trace_id\"))\n"
                    },
                    {
                        "lang": "Go",
                        "label": "Go",
                        "source": "// Reads the monthly sign-up cohorts' deposits this year. The token comes from your secret store.\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc main() {\n\tquery := url.Values{}\n\tquery.Set(\"from\", \"2026-01-01T00:00:00Z\")\n\tquery.Set(\"to\", \"2026-10-01T00:00:00Z\")\n\tquery.Set(\"figure\", \"deposits_amount\")\n\ttarget := \"https://api.affiliqo.com/operator/reports/cohorts\"\n\tif encoded := query.Encode(); encoded != \"\" {\n\t\ttarget += \"?\" + encoded\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", target, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"AFFILIQO_DATA_TOKEN\"))\n\n\tclient := &http.Client{Timeout: 30 * time.Second}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Amounts can pass the integers JSON numbers decode to, so they are kept as json.Number.\n\tdecoder := json.NewDecoder(response.Body)\n\tdecoder.UseNumber()\n\tvar answer map[string]any\n\tif err := decoder.Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif response.StatusCode < 300 {\n\t\tfmt.Println(answer[\"rows\"])\n\t} else {\n\t\t// A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n\t\tfmt.Fprintln(os.Stderr, answer[\"code\"], answer[\"trace_id\"])\n\t}\n}\n"
                    }
                ]
            }
        },
        "/operator/reports/sub-affiliates": {
            "get": {
                "operationId": "getOperatorSubAffiliateReport",
                "summary": "Read the sub-affiliate report",
                "description": "What sub-affiliates' players brought, by parent, sub-affiliate, level, campaign, promo, deal, brand and date, while the program runs a sub-affiliate program.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/From"
                    },
                    {
                        "$ref": "#/components/parameters/To"
                    },
                    {
                        "$ref": "#/components/parameters/Timezone"
                    },
                    {
                        "$ref": "#/components/parameters/GroupBy"
                    },
                    {
                        "$ref": "#/components/parameters/DateGrain"
                    },
                    {
                        "$ref": "#/components/parameters/Tag"
                    },
                    {
                        "$ref": "#/components/parameters/Columns"
                    },
                    {
                        "$ref": "#/components/parameters/Currency"
                    },
                    {
                        "$ref": "#/components/parameters/RatesOn"
                    },
                    {
                        "$ref": "#/components/parameters/Sort"
                    },
                    {
                        "$ref": "#/components/parameters/Direction"
                    },
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "$ref": "#/components/parameters/BrandIds"
                    },
                    {
                        "$ref": "#/components/parameters/SubAffiliateIds"
                    },
                    {
                        "$ref": "#/components/parameters/Frozen"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "The report, or one page of it.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ReportAnswer"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/InvalidReportCursor"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "$ref": "#/components/responses/CapabilityOff"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "409": {
                        "$ref": "#/components/responses/RateMissing"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidReport"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "500": {
                        "$ref": "#/components/responses/ServerError"
                    },
                    "503": {
                        "$ref": "#/components/responses/ReportsUnavailable"
                    }
                },
                "x-codeSamples": [
                    {
                        "lang": "PHP",
                        "label": "PHP",
                        "source": "<?php\n\ndeclare(strict_types=1);\n\n// Reads September's sub-affiliate report by parent. The token comes from your secret store.\n$query = http_build_query(['from' => '2026-09-01T00:00:00Z', 'to' => '2026-10-01T00:00:00Z', 'group_by' => 'parent']);\n$curl = curl_init('https://api.affiliqo.com/operator/reports/sub-affiliates'.($query === '' ? '' : '?'.$query));\ncurl_setopt_array($curl, [\n    CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AFFILIQO_DATA_TOKEN')],\n    CURLOPT_USERAGENT => 'your-warehouse/1.0',\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_TIMEOUT => 30,\n]);\n// Amounts can pass PHP's integers in a currency with many decimals, so they are read as strings.\n$answer = json_decode((string) curl_exec($curl), true, flags: JSON_BIGINT_AS_STRING);\n\nif (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) < 300) {\n    echo json_encode($answer['rows']), PHP_EOL;\n} else {\n    // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    fwrite(STDERR, ($answer['code'] ?? 'no answer').' '.($answer['trace_id'] ?? '').PHP_EOL);\n}\n"
                    },
                    {
                        "lang": "JavaScript",
                        "label": "Node.js",
                        "source": "// Reads September's sub-affiliate report by parent. The token comes from your secret store. Amounts can pass\n// JavaScript's safe integers, so integers are parsed as BigInt.\nconst query = new URLSearchParams({ from: '2026-09-01T00:00:00Z', to: '2026-10-01T00:00:00Z', group_by: 'parent' }).toString();\nconst url = 'https://api.affiliqo.com/operator/reports/sub-affiliates' + (query === '' ? '' : '?' + query);\nconst response = await fetch(url, {\n  headers: { Authorization: 'Bearer ' + process.env.AFFILIQO_DATA_TOKEN },\n});\nconst text = await response.text();\nconst answer = JSON.parse(text, (key, value, context) =>\n  Number.isInteger(value) && !Number.isSafeInteger(value) ? BigInt(context.source) : value,\n);\n\nif (response.status < 300) {\n  console.log(answer.rows);\n} else {\n  // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n  console.error(answer.code, answer.trace_id);\n}\n"
                    },
                    {
                        "lang": "Python",
                        "label": "Python",
                        "source": "# Reads September's sub-affiliate report by parent. The token comes from your secret store.\nimport json\nimport os\nimport urllib.error\nimport urllib.parse\nimport urllib.request\n\nquery = urllib.parse.urlencode({\"from\": \"2026-09-01T00:00:00Z\", \"to\": \"2026-10-01T00:00:00Z\", \"group_by\": \"parent\"})\nurl = \"https://api.affiliqo.com/operator/reports/sub-affiliates\" + (\"?\" + query if query else \"\")\nrequest = urllib.request.Request(\n    url,\n    data=None,\n    method=\"GET\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"AFFILIQO_DATA_TOKEN\"]},\n)\n\ntry:\n    with urllib.request.urlopen(request, timeout=30) as response:\n        answer = json.load(response)\n        print(answer[\"rows\"])\nexcept urllib.error.HTTPError as error:\n    # A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    problem = json.load(error)\n    print(problem.get(\"code\"), problem.get(\"trace_id\"))\n"
                    },
                    {
                        "lang": "Go",
                        "label": "Go",
                        "source": "// Reads September's sub-affiliate report by parent. The token comes from your secret store.\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc main() {\n\tquery := url.Values{}\n\tquery.Set(\"from\", \"2026-09-01T00:00:00Z\")\n\tquery.Set(\"to\", \"2026-10-01T00:00:00Z\")\n\tquery.Set(\"group_by\", \"parent\")\n\ttarget := \"https://api.affiliqo.com/operator/reports/sub-affiliates\"\n\tif encoded := query.Encode(); encoded != \"\" {\n\t\ttarget += \"?\" + encoded\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", target, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"AFFILIQO_DATA_TOKEN\"))\n\n\tclient := &http.Client{Timeout: 30 * time.Second}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Amounts can pass the integers JSON numbers decode to, so they are kept as json.Number.\n\tdecoder := json.NewDecoder(response.Body)\n\tdecoder.UseNumber()\n\tvar answer map[string]any\n\tif err := decoder.Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif response.StatusCode < 300 {\n\t\tfmt.Println(answer[\"rows\"])\n\t} else {\n\t\t// A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n\t\tfmt.Fprintln(os.Stderr, answer[\"code\"], answer[\"trace_id\"])\n\t}\n}\n"
                    }
                ]
            }
        },
        "/operator/reports/attributes": {
            "get": {
                "operationId": "getOperatorReportAttributes",
                "summary": "List what the token may ask of each report",
                "description": "Each report, with exactly the columns, groupings and filter parameters the token may use, how many groupings at once and the longest span.",
                "responses": {
                    "200": {
                        "description": "Your reports.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ReportAttributes"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "$ref": "#/components/responses/CapabilityOff"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "500": {
                        "$ref": "#/components/responses/ServerError"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                },
                "x-codeSamples": [
                    {
                        "lang": "PHP",
                        "label": "PHP",
                        "source": "<?php\n\ndeclare(strict_types=1);\n\n// Lists what the token may ask of each report. The token comes from your secret store.\n$query = http_build_query([]);\n$curl = curl_init('https://api.affiliqo.com/operator/reports/attributes'.($query === '' ? '' : '?'.$query));\ncurl_setopt_array($curl, [\n    CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AFFILIQO_DATA_TOKEN')],\n    CURLOPT_USERAGENT => 'your-warehouse/1.0',\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_TIMEOUT => 30,\n]);\n// Amounts can pass PHP's integers in a currency with many decimals, so they are read as strings.\n$answer = json_decode((string) curl_exec($curl), true, flags: JSON_BIGINT_AS_STRING);\n\nif (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) < 300) {\n    echo json_encode($answer['reports']), PHP_EOL;\n} else {\n    // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    fwrite(STDERR, ($answer['code'] ?? 'no answer').' '.($answer['trace_id'] ?? '').PHP_EOL);\n}\n"
                    },
                    {
                        "lang": "JavaScript",
                        "label": "Node.js",
                        "source": "// Lists what the token may ask of each report. The token comes from your secret store. Amounts can pass\n// JavaScript's safe integers, so integers are parsed as BigInt.\nconst query = new URLSearchParams({  }).toString();\nconst url = 'https://api.affiliqo.com/operator/reports/attributes' + (query === '' ? '' : '?' + query);\nconst response = await fetch(url, {\n  headers: { Authorization: 'Bearer ' + process.env.AFFILIQO_DATA_TOKEN },\n});\nconst text = await response.text();\nconst answer = JSON.parse(text, (key, value, context) =>\n  Number.isInteger(value) && !Number.isSafeInteger(value) ? BigInt(context.source) : value,\n);\n\nif (response.status < 300) {\n  console.log(answer.reports);\n} else {\n  // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n  console.error(answer.code, answer.trace_id);\n}\n"
                    },
                    {
                        "lang": "Python",
                        "label": "Python",
                        "source": "# Lists what the token may ask of each report. The token comes from your secret store.\nimport json\nimport os\nimport urllib.error\nimport urllib.parse\nimport urllib.request\n\nquery = urllib.parse.urlencode({})\nurl = \"https://api.affiliqo.com/operator/reports/attributes\" + (\"?\" + query if query else \"\")\nrequest = urllib.request.Request(\n    url,\n    data=None,\n    method=\"GET\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"AFFILIQO_DATA_TOKEN\"]},\n)\n\ntry:\n    with urllib.request.urlopen(request, timeout=30) as response:\n        answer = json.load(response)\n        print(answer[\"reports\"])\nexcept urllib.error.HTTPError as error:\n    # A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    problem = json.load(error)\n    print(problem.get(\"code\"), problem.get(\"trace_id\"))\n"
                    },
                    {
                        "lang": "Go",
                        "label": "Go",
                        "source": "// Lists what the token may ask of each report. The token comes from your secret store.\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc main() {\n\tquery := url.Values{}\n\ttarget := \"https://api.affiliqo.com/operator/reports/attributes\"\n\tif encoded := query.Encode(); encoded != \"\" {\n\t\ttarget += \"?\" + encoded\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", target, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"AFFILIQO_DATA_TOKEN\"))\n\n\tclient := &http.Client{Timeout: 30 * time.Second}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Amounts can pass the integers JSON numbers decode to, so they are kept as json.Number.\n\tdecoder := json.NewDecoder(response.Body)\n\tdecoder.UseNumber()\n\tvar answer map[string]any\n\tif err := decoder.Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif response.StatusCode < 300 {\n\t\tfmt.Println(answer[\"reports\"])\n\t} else {\n\t\t// A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n\t\tfmt.Fprintln(os.Stderr, answer[\"code\"], answer[\"trace_id\"])\n\t}\n}\n"
                    }
                ]
            }
        },
        "/operator/partners": {
            "get": {
                "operationId": "listOperatorPartners",
                "summary": "List the partners",
                "description": "Every partner of the program, with the partners scope. 100 a page unless you ask for up to 1,000, in the order of their ids. Follow `next_cursor` until it is null.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PartnerPage"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/InvalidListCursor"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "$ref": "#/components/responses/CapabilityOff"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidListQuery"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "500": {
                        "$ref": "#/components/responses/ServerError"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                },
                "x-codeSamples": [
                    {
                        "lang": "PHP",
                        "label": "PHP",
                        "source": "<?php\n\ndeclare(strict_types=1);\n\n// Lists the program's partners, 1,000 a page; send next_cursor as cursor for the next. The token comes from your secret store.\n$query = http_build_query(['limit' => '1000']);\n$curl = curl_init('https://api.affiliqo.com/operator/partners'.($query === '' ? '' : '?'.$query));\ncurl_setopt_array($curl, [\n    CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AFFILIQO_DATA_TOKEN')],\n    CURLOPT_USERAGENT => 'your-warehouse/1.0',\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_TIMEOUT => 30,\n]);\n// Amounts can pass PHP's integers in a currency with many decimals, so they are read as strings.\n$answer = json_decode((string) curl_exec($curl), true, flags: JSON_BIGINT_AS_STRING);\n\nif (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) < 300) {\n    echo json_encode($answer['partners']), PHP_EOL;\n} else {\n    // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    fwrite(STDERR, ($answer['code'] ?? 'no answer').' '.($answer['trace_id'] ?? '').PHP_EOL);\n}\n"
                    },
                    {
                        "lang": "JavaScript",
                        "label": "Node.js",
                        "source": "// Lists the program's partners, 1,000 a page; send next_cursor as cursor for the next. The token comes from your secret store. Amounts can pass\n// JavaScript's safe integers, so integers are parsed as BigInt.\nconst query = new URLSearchParams({ limit: '1000' }).toString();\nconst url = 'https://api.affiliqo.com/operator/partners' + (query === '' ? '' : '?' + query);\nconst response = await fetch(url, {\n  headers: { Authorization: 'Bearer ' + process.env.AFFILIQO_DATA_TOKEN },\n});\nconst text = await response.text();\nconst answer = JSON.parse(text, (key, value, context) =>\n  Number.isInteger(value) && !Number.isSafeInteger(value) ? BigInt(context.source) : value,\n);\n\nif (response.status < 300) {\n  console.log(answer.partners);\n} else {\n  // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n  console.error(answer.code, answer.trace_id);\n}\n"
                    },
                    {
                        "lang": "Python",
                        "label": "Python",
                        "source": "# Lists the program's partners, 1,000 a page; send next_cursor as cursor for the next. The token comes from your secret store.\nimport json\nimport os\nimport urllib.error\nimport urllib.parse\nimport urllib.request\n\nquery = urllib.parse.urlencode({\"limit\": \"1000\"})\nurl = \"https://api.affiliqo.com/operator/partners\" + (\"?\" + query if query else \"\")\nrequest = urllib.request.Request(\n    url,\n    data=None,\n    method=\"GET\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"AFFILIQO_DATA_TOKEN\"]},\n)\n\ntry:\n    with urllib.request.urlopen(request, timeout=30) as response:\n        answer = json.load(response)\n        print(answer[\"partners\"])\nexcept urllib.error.HTTPError as error:\n    # A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    problem = json.load(error)\n    print(problem.get(\"code\"), problem.get(\"trace_id\"))\n"
                    },
                    {
                        "lang": "Go",
                        "label": "Go",
                        "source": "// Lists the program's partners, 1,000 a page; send next_cursor as cursor for the next. The token comes from your secret store.\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc main() {\n\tquery := url.Values{}\n\tquery.Set(\"limit\", \"1000\")\n\ttarget := \"https://api.affiliqo.com/operator/partners\"\n\tif encoded := query.Encode(); encoded != \"\" {\n\t\ttarget += \"?\" + encoded\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", target, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"AFFILIQO_DATA_TOKEN\"))\n\n\tclient := &http.Client{Timeout: 30 * time.Second}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Amounts can pass the integers JSON numbers decode to, so they are kept as json.Number.\n\tdecoder := json.NewDecoder(response.Body)\n\tdecoder.UseNumber()\n\tvar answer map[string]any\n\tif err := decoder.Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif response.StatusCode < 300 {\n\t\tfmt.Println(answer[\"partners\"])\n\t} else {\n\t\t// A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n\t\tfmt.Fprintln(os.Stderr, answer[\"code\"], answer[\"trace_id\"])\n\t}\n}\n"
                    }
                ]
            }
        },
        "/operator/campaigns": {
            "get": {
                "operationId": "listOperatorCampaigns",
                "summary": "List the campaigns",
                "description": "Every partner's campaigns that aren't archived, or the archived ones or all of them when you ask, each with its promos, with the campaigns scope. 100 a page unless you ask for up to 1,000, in the order of their ids. Follow `next_cursor` until it is null.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    },
                    {
                        "$ref": "#/components/parameters/State"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CampaignPage"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/InvalidListCursor"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "$ref": "#/components/responses/CapabilityOff"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidListQuery"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "500": {
                        "$ref": "#/components/responses/ServerError"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                },
                "x-codeSamples": [
                    {
                        "lang": "PHP",
                        "label": "PHP",
                        "source": "<?php\n\ndeclare(strict_types=1);\n\n// Lists every partner's campaigns with their promos, 1,000 a page. The token comes from your secret store.\n$query = http_build_query(['limit' => '1000']);\n$curl = curl_init('https://api.affiliqo.com/operator/campaigns'.($query === '' ? '' : '?'.$query));\ncurl_setopt_array($curl, [\n    CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AFFILIQO_DATA_TOKEN')],\n    CURLOPT_USERAGENT => 'your-warehouse/1.0',\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_TIMEOUT => 30,\n]);\n// Amounts can pass PHP's integers in a currency with many decimals, so they are read as strings.\n$answer = json_decode((string) curl_exec($curl), true, flags: JSON_BIGINT_AS_STRING);\n\nif (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) < 300) {\n    echo json_encode($answer['campaigns']), PHP_EOL;\n} else {\n    // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    fwrite(STDERR, ($answer['code'] ?? 'no answer').' '.($answer['trace_id'] ?? '').PHP_EOL);\n}\n"
                    },
                    {
                        "lang": "JavaScript",
                        "label": "Node.js",
                        "source": "// Lists every partner's campaigns with their promos, 1,000 a page. The token comes from your secret store. Amounts can pass\n// JavaScript's safe integers, so integers are parsed as BigInt.\nconst query = new URLSearchParams({ limit: '1000' }).toString();\nconst url = 'https://api.affiliqo.com/operator/campaigns' + (query === '' ? '' : '?' + query);\nconst response = await fetch(url, {\n  headers: { Authorization: 'Bearer ' + process.env.AFFILIQO_DATA_TOKEN },\n});\nconst text = await response.text();\nconst answer = JSON.parse(text, (key, value, context) =>\n  Number.isInteger(value) && !Number.isSafeInteger(value) ? BigInt(context.source) : value,\n);\n\nif (response.status < 300) {\n  console.log(answer.campaigns);\n} else {\n  // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n  console.error(answer.code, answer.trace_id);\n}\n"
                    },
                    {
                        "lang": "Python",
                        "label": "Python",
                        "source": "# Lists every partner's campaigns with their promos, 1,000 a page. The token comes from your secret store.\nimport json\nimport os\nimport urllib.error\nimport urllib.parse\nimport urllib.request\n\nquery = urllib.parse.urlencode({\"limit\": \"1000\"})\nurl = \"https://api.affiliqo.com/operator/campaigns\" + (\"?\" + query if query else \"\")\nrequest = urllib.request.Request(\n    url,\n    data=None,\n    method=\"GET\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"AFFILIQO_DATA_TOKEN\"]},\n)\n\ntry:\n    with urllib.request.urlopen(request, timeout=30) as response:\n        answer = json.load(response)\n        print(answer[\"campaigns\"])\nexcept urllib.error.HTTPError as error:\n    # A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    problem = json.load(error)\n    print(problem.get(\"code\"), problem.get(\"trace_id\"))\n"
                    },
                    {
                        "lang": "Go",
                        "label": "Go",
                        "source": "// Lists every partner's campaigns with their promos, 1,000 a page. The token comes from your secret store.\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc main() {\n\tquery := url.Values{}\n\tquery.Set(\"limit\", \"1000\")\n\ttarget := \"https://api.affiliqo.com/operator/campaigns\"\n\tif encoded := query.Encode(); encoded != \"\" {\n\t\ttarget += \"?\" + encoded\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", target, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"AFFILIQO_DATA_TOKEN\"))\n\n\tclient := &http.Client{Timeout: 30 * time.Second}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Amounts can pass the integers JSON numbers decode to, so they are kept as json.Number.\n\tdecoder := json.NewDecoder(response.Body)\n\tdecoder.UseNumber()\n\tvar answer map[string]any\n\tif err := decoder.Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif response.StatusCode < 300 {\n\t\tfmt.Println(answer[\"campaigns\"])\n\t} else {\n\t\t// A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n\t\tfmt.Fprintln(os.Stderr, answer[\"code\"], answer[\"trace_id\"])\n\t}\n}\n"
                    }
                ]
            }
        },
        "/operator/bills": {
            "get": {
                "operationId": "listOperatorBills",
                "summary": "List the bills",
                "description": "Every partner's bills, with the bills scope. 100 a page unless you ask for up to 1,000, in the order of their ids. Follow `next_cursor` until it is null.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BillPage"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/InvalidListCursor"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "$ref": "#/components/responses/CapabilityOff"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidListQuery"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "500": {
                        "$ref": "#/components/responses/ServerError"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                },
                "x-codeSamples": [
                    {
                        "lang": "PHP",
                        "label": "PHP",
                        "source": "<?php\n\ndeclare(strict_types=1);\n\n// Lists every partner's bills, 1,000 a page. The token comes from your secret store.\n$query = http_build_query(['limit' => '1000']);\n$curl = curl_init('https://api.affiliqo.com/operator/bills'.($query === '' ? '' : '?'.$query));\ncurl_setopt_array($curl, [\n    CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AFFILIQO_DATA_TOKEN')],\n    CURLOPT_USERAGENT => 'your-warehouse/1.0',\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_TIMEOUT => 30,\n]);\n// Amounts can pass PHP's integers in a currency with many decimals, so they are read as strings.\n$answer = json_decode((string) curl_exec($curl), true, flags: JSON_BIGINT_AS_STRING);\n\nif (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) < 300) {\n    echo json_encode($answer['bills']), PHP_EOL;\n} else {\n    // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    fwrite(STDERR, ($answer['code'] ?? 'no answer').' '.($answer['trace_id'] ?? '').PHP_EOL);\n}\n"
                    },
                    {
                        "lang": "JavaScript",
                        "label": "Node.js",
                        "source": "// Lists every partner's bills, 1,000 a page. The token comes from your secret store. Amounts can pass\n// JavaScript's safe integers, so integers are parsed as BigInt.\nconst query = new URLSearchParams({ limit: '1000' }).toString();\nconst url = 'https://api.affiliqo.com/operator/bills' + (query === '' ? '' : '?' + query);\nconst response = await fetch(url, {\n  headers: { Authorization: 'Bearer ' + process.env.AFFILIQO_DATA_TOKEN },\n});\nconst text = await response.text();\nconst answer = JSON.parse(text, (key, value, context) =>\n  Number.isInteger(value) && !Number.isSafeInteger(value) ? BigInt(context.source) : value,\n);\n\nif (response.status < 300) {\n  console.log(answer.bills);\n} else {\n  // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n  console.error(answer.code, answer.trace_id);\n}\n"
                    },
                    {
                        "lang": "Python",
                        "label": "Python",
                        "source": "# Lists every partner's bills, 1,000 a page. The token comes from your secret store.\nimport json\nimport os\nimport urllib.error\nimport urllib.parse\nimport urllib.request\n\nquery = urllib.parse.urlencode({\"limit\": \"1000\"})\nurl = \"https://api.affiliqo.com/operator/bills\" + (\"?\" + query if query else \"\")\nrequest = urllib.request.Request(\n    url,\n    data=None,\n    method=\"GET\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"AFFILIQO_DATA_TOKEN\"]},\n)\n\ntry:\n    with urllib.request.urlopen(request, timeout=30) as response:\n        answer = json.load(response)\n        print(answer[\"bills\"])\nexcept urllib.error.HTTPError as error:\n    # A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    problem = json.load(error)\n    print(problem.get(\"code\"), problem.get(\"trace_id\"))\n"
                    },
                    {
                        "lang": "Go",
                        "label": "Go",
                        "source": "// Lists every partner's bills, 1,000 a page. The token comes from your secret store.\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc main() {\n\tquery := url.Values{}\n\tquery.Set(\"limit\", \"1000\")\n\ttarget := \"https://api.affiliqo.com/operator/bills\"\n\tif encoded := query.Encode(); encoded != \"\" {\n\t\ttarget += \"?\" + encoded\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", target, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"AFFILIQO_DATA_TOKEN\"))\n\n\tclient := &http.Client{Timeout: 30 * time.Second}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Amounts can pass the integers JSON numbers decode to, so they are kept as json.Number.\n\tdecoder := json.NewDecoder(response.Body)\n\tdecoder.UseNumber()\n\tvar answer map[string]any\n\tif err := decoder.Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif response.StatusCode < 300 {\n\t\tfmt.Println(answer[\"bills\"])\n\t} else {\n\t\t// A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n\t\tfmt.Fprintln(os.Stderr, answer[\"code\"], answer[\"trace_id\"])\n\t}\n}\n"
                    }
                ]
            }
        },
        "/operator/adjustments": {
            "get": {
                "operationId": "listOperatorAdjustments",
                "summary": "List the adjustments",
                "description": "Every adjustment to partners' bills, with the bills scope. 100 a page unless you ask for up to 1,000, in the order of their ids. Follow `next_cursor` until it is null.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/AdjustmentPage"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/InvalidListCursor"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "$ref": "#/components/responses/CapabilityOff"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidListQuery"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "500": {
                        "$ref": "#/components/responses/ServerError"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                },
                "x-codeSamples": [
                    {
                        "lang": "PHP",
                        "label": "PHP",
                        "source": "<?php\n\ndeclare(strict_types=1);\n\n// Lists the adjustments to partners' bills, 1,000 a page. The token comes from your secret store.\n$query = http_build_query(['limit' => '1000']);\n$curl = curl_init('https://api.affiliqo.com/operator/adjustments'.($query === '' ? '' : '?'.$query));\ncurl_setopt_array($curl, [\n    CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AFFILIQO_DATA_TOKEN')],\n    CURLOPT_USERAGENT => 'your-warehouse/1.0',\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_TIMEOUT => 30,\n]);\n// Amounts can pass PHP's integers in a currency with many decimals, so they are read as strings.\n$answer = json_decode((string) curl_exec($curl), true, flags: JSON_BIGINT_AS_STRING);\n\nif (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) < 300) {\n    echo json_encode($answer['adjustments']), PHP_EOL;\n} else {\n    // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    fwrite(STDERR, ($answer['code'] ?? 'no answer').' '.($answer['trace_id'] ?? '').PHP_EOL);\n}\n"
                    },
                    {
                        "lang": "JavaScript",
                        "label": "Node.js",
                        "source": "// Lists the adjustments to partners' bills, 1,000 a page. The token comes from your secret store. Amounts can pass\n// JavaScript's safe integers, so integers are parsed as BigInt.\nconst query = new URLSearchParams({ limit: '1000' }).toString();\nconst url = 'https://api.affiliqo.com/operator/adjustments' + (query === '' ? '' : '?' + query);\nconst response = await fetch(url, {\n  headers: { Authorization: 'Bearer ' + process.env.AFFILIQO_DATA_TOKEN },\n});\nconst text = await response.text();\nconst answer = JSON.parse(text, (key, value, context) =>\n  Number.isInteger(value) && !Number.isSafeInteger(value) ? BigInt(context.source) : value,\n);\n\nif (response.status < 300) {\n  console.log(answer.adjustments);\n} else {\n  // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n  console.error(answer.code, answer.trace_id);\n}\n"
                    },
                    {
                        "lang": "Python",
                        "label": "Python",
                        "source": "# Lists the adjustments to partners' bills, 1,000 a page. The token comes from your secret store.\nimport json\nimport os\nimport urllib.error\nimport urllib.parse\nimport urllib.request\n\nquery = urllib.parse.urlencode({\"limit\": \"1000\"})\nurl = \"https://api.affiliqo.com/operator/adjustments\" + (\"?\" + query if query else \"\")\nrequest = urllib.request.Request(\n    url,\n    data=None,\n    method=\"GET\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"AFFILIQO_DATA_TOKEN\"]},\n)\n\ntry:\n    with urllib.request.urlopen(request, timeout=30) as response:\n        answer = json.load(response)\n        print(answer[\"adjustments\"])\nexcept urllib.error.HTTPError as error:\n    # A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    problem = json.load(error)\n    print(problem.get(\"code\"), problem.get(\"trace_id\"))\n"
                    },
                    {
                        "lang": "Go",
                        "label": "Go",
                        "source": "// Lists the adjustments to partners' bills, 1,000 a page. The token comes from your secret store.\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc main() {\n\tquery := url.Values{}\n\tquery.Set(\"limit\", \"1000\")\n\ttarget := \"https://api.affiliqo.com/operator/adjustments\"\n\tif encoded := query.Encode(); encoded != \"\" {\n\t\ttarget += \"?\" + encoded\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", target, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"AFFILIQO_DATA_TOKEN\"))\n\n\tclient := &http.Client{Timeout: 30 * time.Second}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Amounts can pass the integers JSON numbers decode to, so they are kept as json.Number.\n\tdecoder := json.NewDecoder(response.Body)\n\tdecoder.UseNumber()\n\tvar answer map[string]any\n\tif err := decoder.Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif response.StatusCode < 300 {\n\t\tfmt.Println(answer[\"adjustments\"])\n\t} else {\n\t\t// A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n\t\tfmt.Fprintln(os.Stderr, answer[\"code\"], answer[\"trace_id\"])\n\t}\n}\n"
                    }
                ]
            }
        },
        "/operator/players": {
            "get": {
                "operationId": "listOperatorPlayers",
                "summary": "List the players",
                "description": "Every player partners brought or the casino sent, by the casino's id, with the players scope. 100 a page unless you ask for up to 1,000, in the order of their ids. Follow `next_cursor` until it is null.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/PageCursor"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A page.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlayerPage"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/InvalidListCursor"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "$ref": "#/components/responses/CapabilityOff"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/InvalidListQuery"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    },
                    "500": {
                        "$ref": "#/components/responses/ServerError"
                    },
                    "503": {
                        "$ref": "#/components/responses/Unavailable"
                    }
                },
                "x-codeSamples": [
                    {
                        "lang": "PHP",
                        "label": "PHP",
                        "source": "<?php\n\ndeclare(strict_types=1);\n\n// Lists the players by the casino's ids, 1,000 a page. The token comes from your secret store.\n$query = http_build_query(['limit' => '1000']);\n$curl = curl_init('https://api.affiliqo.com/operator/players'.($query === '' ? '' : '?'.$query));\ncurl_setopt_array($curl, [\n    CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('AFFILIQO_DATA_TOKEN')],\n    CURLOPT_USERAGENT => 'your-warehouse/1.0',\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_TIMEOUT => 30,\n]);\n// Amounts can pass PHP's integers in a currency with many decimals, so they are read as strings.\n$answer = json_decode((string) curl_exec($curl), true, flags: JSON_BIGINT_AS_STRING);\n\nif (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) < 300) {\n    echo json_encode($answer['players']), PHP_EOL;\n} else {\n    // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    fwrite(STDERR, ($answer['code'] ?? 'no answer').' '.($answer['trace_id'] ?? '').PHP_EOL);\n}\n"
                    },
                    {
                        "lang": "JavaScript",
                        "label": "Node.js",
                        "source": "// Lists the players by the casino's ids, 1,000 a page. The token comes from your secret store. Amounts can pass\n// JavaScript's safe integers, so integers are parsed as BigInt.\nconst query = new URLSearchParams({ limit: '1000' }).toString();\nconst url = 'https://api.affiliqo.com/operator/players' + (query === '' ? '' : '?' + query);\nconst response = await fetch(url, {\n  headers: { Authorization: 'Bearer ' + process.env.AFFILIQO_DATA_TOKEN },\n});\nconst text = await response.text();\nconst answer = JSON.parse(text, (key, value, context) =>\n  Number.isInteger(value) && !Number.isSafeInteger(value) ? BigInt(context.source) : value,\n);\n\nif (response.status < 300) {\n  console.log(answer.players);\n} else {\n  // A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n  console.error(answer.code, answer.trace_id);\n}\n"
                    },
                    {
                        "lang": "Python",
                        "label": "Python",
                        "source": "# Lists the players by the casino's ids, 1,000 a page. The token comes from your secret store.\nimport json\nimport os\nimport urllib.error\nimport urllib.parse\nimport urllib.request\n\nquery = urllib.parse.urlencode({\"limit\": \"1000\"})\nurl = \"https://api.affiliqo.com/operator/players\" + (\"?\" + query if query else \"\")\nrequest = urllib.request.Request(\n    url,\n    data=None,\n    method=\"GET\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"AFFILIQO_DATA_TOKEN\"]},\n)\n\ntry:\n    with urllib.request.urlopen(request, timeout=30) as response:\n        answer = json.load(response)\n        print(answer[\"players\"])\nexcept urllib.error.HTTPError as error:\n    # A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n    problem = json.load(error)\n    print(problem.get(\"code\"), problem.get(\"trace_id\"))\n"
                    },
                    {
                        "lang": "Go",
                        "label": "Go",
                        "source": "// Lists the players by the casino's ids, 1,000 a page. The token comes from your secret store.\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc main() {\n\tquery := url.Values{}\n\tquery.Set(\"limit\", \"1000\")\n\ttarget := \"https://api.affiliqo.com/operator/players\"\n\tif encoded := query.Encode(); encoded != \"\" {\n\t\ttarget += \"?\" + encoded\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", target, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"AFFILIQO_DATA_TOKEN\"))\n\n\tclient := &http.Client{Timeout: 30 * time.Second}\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer response.Body.Close()\n\n\t// Amounts can pass the integers JSON numbers decode to, so they are kept as json.Number.\n\tdecoder := json.NewDecoder(response.Body)\n\tdecoder.UseNumber()\n\tvar answer map[string]any\n\tif err := decoder.Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\n\tif response.StatusCode < 300 {\n\t\tfmt.Println(answer[\"players\"])\n\t} else {\n\t\t// A problem document: act on its code, and quote its trace_id when you ask Affiliqo about it.\n\t\tfmt.Fprintln(os.Stderr, answer[\"code\"], answer[\"trace_id\"])\n\t}\n}\n"
                    }
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "Token": {
                "type": "http",
                "scheme": "bearer",
                "description": "Every request carries one of the program's data tokens: `Authorization: Bearer afq_data_live_…`."
            }
        },
        "parameters": {
            "From": {
                "name": "from",
                "in": "query",
                "required": false,
                "description": "The span's start, as ISO 8601 with its UTC offset, such as `2026-08-31T22:00:00Z`. Required, except with `bill_id`, whose period the report then counts.",
                "schema": {
                    "type": "string",
                    "format": "date-time"
                }
            },
            "To": {
                "name": "to",
                "in": "query",
                "required": false,
                "description": "The span's end, not included, after `from`, as ISO 8601 with its UTC offset. Required, except with `bill_id`.",
                "schema": {
                    "type": "string",
                    "format": "date-time"
                }
            },
            "Timezone": {
                "name": "timezone",
                "in": "query",
                "required": false,
                "description": "The IANA timezone the report counts its days, weeks and months in, such as `Europe/Malta`. The program's timezone unless given.",
                "schema": {
                    "type": "string"
                }
            },
            "GroupBy": {
                "name": "group_by",
                "in": "query",
                "required": false,
                "description": "Up to three groupings, comma separated, such as `campaign,date`. `/operator/reports/attributes` lists those the token may use.",
                "schema": {
                    "type": "string"
                }
            },
            "DateGrain": {
                "name": "date_grain",
                "in": "query",
                "required": false,
                "description": "How a date grouping buckets its days.",
                "schema": {
                    "type": "string",
                    "enum": [
                        "day",
                        "week",
                        "month",
                        "year"
                    ]
                }
            },
            "Tag": {
                "name": "tag",
                "in": "query",
                "required": false,
                "description": "The name of the dynamic tag the `dynamic_tag` grouping and `tag_values` filter read, such as `subid`.",
                "schema": {
                    "type": "string"
                }
            },
            "Columns": {
                "name": "columns",
                "in": "query",
                "required": false,
                "description": "The columns, comma separated. Every column unless given.",
                "schema": {
                    "type": "string"
                }
            },
            "Currency": {
                "name": "currency",
                "in": "query",
                "required": false,
                "description": "The currency of every amount: the program's unless given. A currency Affiliqo keeps no rates for is refused.",
                "schema": {
                    "type": "string"
                }
            },
            "RatesOn": {
                "name": "rates_on",
                "in": "query",
                "required": false,
                "description": "The date of the exchange rates other currencies convert at: the span's last day, or today, unless given.",
                "schema": {
                    "type": "string",
                    "format": "date"
                }
            },
            "Bots": {
                "name": "bots",
                "in": "query",
                "required": false,
                "description": "Whether bot visits count: left out unless given.",
                "schema": {
                    "type": "string",
                    "enum": [
                        "include",
                        "exclude",
                        "only"
                    ]
                }
            },
            "Sort": {
                "name": "sort",
                "in": "query",
                "required": false,
                "description": "A column to sort by; the groupings otherwise.",
                "schema": {
                    "type": "string"
                }
            },
            "Direction": {
                "name": "direction",
                "in": "query",
                "required": false,
                "description": "The sort's direction, descending unless given.",
                "schema": {
                    "type": "string",
                    "enum": [
                        "asc",
                        "desc"
                    ]
                }
            },
            "Limit": {
                "name": "limit",
                "in": "query",
                "required": false,
                "description": "Rows a page, 100 unless given, at most 1,000.",
                "schema": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                }
            },
            "Cursor": {
                "name": "cursor",
                "in": "query",
                "required": false,
                "description": "The `next_cursor` of the page before, with the same parameters. Leave it out for the first page.",
                "schema": {
                    "type": "string"
                }
            },
            "BrandIds": {
                "name": "brand_ids",
                "in": "query",
                "required": false,
                "description": "Only these brands, comma separated ids.",
                "schema": {
                    "type": "string"
                }
            },
            "DealIds": {
                "name": "deal_ids",
                "in": "query",
                "required": false,
                "description": "Only these deals, comma separated ids.",
                "schema": {
                    "type": "string"
                }
            },
            "Strategies": {
                "name": "strategies",
                "in": "query",
                "required": false,
                "description": "Only deals of these strategies, comma separated.",
                "schema": {
                    "type": "string"
                }
            },
            "CampaignIds": {
                "name": "campaign_ids",
                "in": "query",
                "required": false,
                "description": "Only these campaigns, comma separated ids.",
                "schema": {
                    "type": "string"
                }
            },
            "PromoIds": {
                "name": "promo_ids",
                "in": "query",
                "required": false,
                "description": "Only these promos, comma separated ids.",
                "schema": {
                    "type": "string"
                }
            },
            "PlayerIds": {
                "name": "player_ids",
                "in": "query",
                "required": false,
                "description": "Only these players, by the casino's player ids, comma separated, at most 100. Needs the players scope; refused with `422` otherwise.",
                "schema": {
                    "type": "string"
                }
            },
            "PlayerCountries": {
                "name": "player_countries",
                "in": "query",
                "required": false,
                "description": "Only players of these countries, comma separated ISO 3166-1 alpha-2 codes.",
                "schema": {
                    "type": "string"
                }
            },
            "TagValues": {
                "name": "tag_values",
                "in": "query",
                "required": false,
                "description": "Only these values of the dynamic tag `tag` names, comma separated.",
                "schema": {
                    "type": "string"
                }
            },
            "BillId": {
                "name": "bill_id",
                "in": "query",
                "required": false,
                "description": "The report of one of the program's bills: its period, currency, rates and players, as it counted them.",
                "schema": {
                    "type": "string",
                    "format": "uuid"
                }
            },
            "Frozen": {
                "name": "frozen",
                "in": "query",
                "required": false,
                "description": "Whether frozen activity counts, the activity of players while the casino holds them disabled or self-excluded or anyone holds them frozen: `include` unless given, `exclude` to leave it out as bills do, or `only`.",
                "schema": {
                    "type": "string",
                    "enum": [
                        "include",
                        "exclude",
                        "only"
                    ]
                }
            },
            "PartnerIds": {
                "name": "partner_ids",
                "in": "query",
                "required": false,
                "description": "Only these partners, comma separated ids.",
                "schema": {
                    "type": "string"
                }
            },
            "PartnerTags": {
                "name": "partner_tags",
                "in": "query",
                "required": false,
                "description": "Only partners with these tags, comma separated, as the operator area names them.",
                "schema": {
                    "type": "string"
                }
            },
            "ManagerIds": {
                "name": "manager_ids",
                "in": "query",
                "required": false,
                "description": "Only partners these managers look after, comma separated operator ids.",
                "schema": {
                    "type": "string"
                }
            },
            "Stag": {
                "name": "stag",
                "in": "query",
                "required": false,
                "description": "Only the visit, promo or bonus code of this stag, such as `1042_5531877`.",
                "schema": {
                    "type": "string"
                }
            },
            "LandingIds": {
                "name": "landing_ids",
                "in": "query",
                "required": false,
                "description": "Only these landing pages, comma separated ids.",
                "schema": {
                    "type": "string"
                }
            },
            "Devices": {
                "name": "devices",
                "in": "query",
                "required": false,
                "description": "Only these devices, comma separated: `desktop`, `mobile`, `tablet`, `other`.",
                "schema": {
                    "type": "string"
                }
            },
            "BrowserFamilies": {
                "name": "browser_families",
                "in": "query",
                "required": false,
                "description": "Only these browsers, comma separated.",
                "schema": {
                    "type": "string"
                }
            },
            "OsFamilies": {
                "name": "os_families",
                "in": "query",
                "required": false,
                "description": "Only these operating systems, comma separated.",
                "schema": {
                    "type": "string"
                }
            },
            "VisitCountries": {
                "name": "visit_countries",
                "in": "query",
                "required": false,
                "description": "Only visits from these countries, comma separated ISO 3166-1 alpha-2 codes.",
                "schema": {
                    "type": "string"
                }
            },
            "Referrers": {
                "name": "referrers",
                "in": "query",
                "required": false,
                "description": "Only visits from these referring sites, comma separated.",
                "schema": {
                    "type": "string"
                }
            },
            "TrafficSourceIds": {
                "name": "traffic_source_ids",
                "in": "query",
                "required": false,
                "description": "Only these traffic sources, comma separated ids.",
                "schema": {
                    "type": "string"
                }
            },
            "CohortType": {
                "name": "cohort_type",
                "in": "query",
                "required": false,
                "description": "What puts players in a cohort: their sign-up unless given.",
                "schema": {
                    "type": "string",
                    "enum": [
                        "sign_up",
                        "first_deposit",
                        "deposit"
                    ]
                }
            },
            "CohortGrain": {
                "name": "cohort_grain",
                "in": "query",
                "required": false,
                "description": "A cohort's length: a month unless given.",
                "schema": {
                    "type": "string",
                    "enum": [
                        "day",
                        "week",
                        "month"
                    ]
                }
            },
            "Figure": {
                "name": "figure",
                "in": "query",
                "required": true,
                "description": "The one figure the cells show, such as `deposits_amount`.",
                "schema": {
                    "type": "string"
                }
            },
            "Periods": {
                "name": "periods",
                "in": "query",
                "required": false,
                "description": "How many periods each cohort is followed for, 12 unless given.",
                "schema": {
                    "type": "integer",
                    "minimum": 1
                }
            },
            "SubAffiliateIds": {
                "name": "sub_affiliate_ids",
                "in": "query",
                "required": false,
                "description": "Only these sub-affiliates, comma separated ids.",
                "schema": {
                    "type": "string"
                }
            },
            "PageCursor": {
                "name": "cursor",
                "in": "query",
                "required": false,
                "description": "The `next_cursor` of the page before, as Affiliqo gave it. Leave it out for the first page.",
                "schema": {
                    "type": "string"
                }
            },
            "State": {
                "name": "state",
                "in": "query",
                "required": false,
                "description": "Which campaigns to list: `active`, those in the link builder, unless given; `archived`, those archived, whose links and codes keep working; or `all`.",
                "schema": {
                    "type": "string",
                    "enum": [
                        "active",
                        "archived",
                        "all"
                    ],
                    "default": "active"
                }
            }
        },
        "schemas": {
            "ReportGroupValue": {
                "type": "object",
                "description": "A grouping's value, such as a brand or a campaign.",
                "required": [
                    "id",
                    "name"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "nullable": true,
                        "description": "Its id, or null for \"none\", such as a partner without a tag or a player no visit brought."
                    },
                    "name": {
                        "type": "string",
                        "description": "Its name as the portal shows it."
                    }
                }
            },
            "ReportPlayer": {
                "type": "object",
                "description": "A player as a partner sees it: never the casino's id. The key tells two players with the same masked id apart and stays the same from month to month, until the program's keys are rotated.",
                "required": [
                    "masked_id",
                    "key",
                    "country",
                    "signed_up_on"
                ],
                "properties": {
                    "masked_id": {
                        "type": "string",
                        "description": "The casino's id of the player, masked, such as \"77***\"; empty for a player no longer in the program."
                    },
                    "key": {
                        "type": "string",
                        "nullable": true,
                        "description": "The player key, such as \"k1:3f9a01c2b7d4e816\"."
                    },
                    "country": {
                        "type": "string",
                        "nullable": true,
                        "description": "The player's country, as ISO 3166-1 alpha-2."
                    },
                    "signed_up_on": {
                        "type": "string",
                        "format": "date",
                        "nullable": true,
                        "description": "The day the player signed up, in UTC; null for a player no longer in the program."
                    }
                }
            },
            "DataTokenPlayer": {
                "description": "A player as a data token sees it in the operator data API: masked, or by the casino's id instead once the token has the players scope; never with a player key or the personal details of its profile.",
                "oneOf": [
                    {
                        "type": "object",
                        "description": "Without the players scope.",
                        "required": [
                            "masked_id",
                            "country",
                            "signed_up_on"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "masked_id": {
                                "type": "string",
                                "description": "The casino's id of the player, masked, such as \"77***\"; empty for a player no longer in the program."
                            },
                            "country": {
                                "type": "string",
                                "nullable": true,
                                "description": "The player's country, as ISO 3166-1 alpha-2."
                            },
                            "signed_up_on": {
                                "type": "string",
                                "format": "date",
                                "nullable": true,
                                "description": "The day the player signed up, in UTC; null for a player no longer in the program."
                            }
                        }
                    },
                    {
                        "type": "object",
                        "description": "With the players scope.",
                        "required": [
                            "casino_player_id",
                            "country",
                            "signed_up_on"
                        ],
                        "additionalProperties": false,
                        "properties": {
                            "casino_player_id": {
                                "type": "string",
                                "nullable": true,
                                "description": "The casino's id of the player; null for a player no longer in the program."
                            },
                            "country": {
                                "type": "string",
                                "nullable": true,
                                "description": "The player's country, as ISO 3166-1 alpha-2."
                            },
                            "signed_up_on": {
                                "type": "string",
                                "format": "date",
                                "nullable": true,
                                "description": "The day the player signed up, in UTC; null for a player no longer in the program."
                            }
                        }
                    }
                ]
            },
            "ReportFigures": {
                "type": "object",
                "description": "Each figure, by its column. Money is an integer in minor units, a count an integer, a rate a percentage as a decimal string; visits are null under a grouping by player, which visits have none of.",
                "additionalProperties": {
                    "anyOf": [
                        {
                            "type": "integer",
                            "nullable": true
                        },
                        {
                            "type": "string"
                        }
                    ]
                }
            },
            "ReportRow": {
                "type": "object",
                "description": "One row of a report.",
                "required": [
                    "group",
                    "figures",
                    "includes_estimate"
                ],
                "properties": {
                    "group": {
                        "type": "object",
                        "description": "Each grouping's value, by its name. A date grouping's value is its first day, or null for players without that date; a player is its masked id, country and sign-up date, with its player key for a partner, or the casino's id instead of the mask for a data token with the players scope; anything else is its id and name.",
                        "additionalProperties": {
                            "anyOf": [
                                {
                                    "type": "string",
                                    "format": "date",
                                    "nullable": true
                                },
                                {
                                    "$ref": "#/components/schemas/ReportGroupValue"
                                },
                                {
                                    "$ref": "#/components/schemas/ReportPlayer"
                                },
                                {
                                    "$ref": "#/components/schemas/DataTokenPlayer"
                                }
                            ]
                        }
                    },
                    "figures": {
                        "$ref": "#/components/schemas/ReportFigures"
                    },
                    "includes_estimate": {
                        "type": "boolean",
                        "description": "Whether the current period's estimate went into the row's bill figures."
                    }
                }
            },
            "ReportAnswer": {
                "type": "object",
                "description": "One page of a report. Money is in minor units of `currency`; a currency with many decimals gives integers past JavaScript's safe integers, so parse them as big integers. Rates are percentages as decimal strings, such as \"12.50\".",
                "required": [
                    "report",
                    "from",
                    "to",
                    "timezone",
                    "currency",
                    "rates_on",
                    "group_by",
                    "date_grain",
                    "rows",
                    "totals",
                    "next_cursor"
                ],
                "properties": {
                    "report": {
                        "type": "string",
                        "description": "The report, as its path names it.",
                        "enum": [
                            "statistics",
                            "traffic",
                            "sub-affiliates"
                        ]
                    },
                    "from": {
                        "type": "string",
                        "format": "date-time",
                        "description": "The span's start, in UTC."
                    },
                    "to": {
                        "type": "string",
                        "format": "date-time",
                        "description": "The span's end, not included, in UTC."
                    },
                    "timezone": {
                        "type": "string",
                        "description": "The timezone the report's days, weeks and months are counted in."
                    },
                    "currency": {
                        "type": "string",
                        "description": "The one currency of every amount."
                    },
                    "rates_on": {
                        "type": "string",
                        "format": "date",
                        "description": "The date of the exchange rates other currencies were converted at."
                    },
                    "group_by": {
                        "type": "array",
                        "description": "The groupings, in their order.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "date_grain": {
                        "type": "string",
                        "description": "How a date grouping buckets its days.",
                        "enum": [
                            "day",
                            "week",
                            "month",
                            "year"
                        ]
                    },
                    "rows": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ReportRow"
                        }
                    },
                    "totals": {
                        "$ref": "#/components/schemas/ReportFigures"
                    },
                    "next_cursor": {
                        "type": "string",
                        "nullable": true,
                        "description": "Send it as `cursor` with the same parameters for the next page; null on the last page."
                    }
                }
            },
            "FieldError": {
                "type": "object",
                "description": "One failing field of a request.",
                "required": [
                    "pointer",
                    "code",
                    "detail"
                ],
                "properties": {
                    "pointer": {
                        "type": "string",
                        "description": "The field, as an RFC 6901 JSON pointer, such as `/items/3/casino/bets`."
                    },
                    "code": {
                        "type": "string",
                        "description": "What is wrong with the field, as a stable code, such as `must_be_integer`."
                    },
                    "detail": {
                        "type": "string",
                        "description": "The same, for people. It never quotes the value sent."
                    }
                }
            },
            "Problem": {
                "type": "object",
                "description": "An RFC 9457 problem document from Affiliqo, as `application/problem+json`. Its `code` is stable and never changes its meaning; `title` and `detail` are for people.",
                "required": [
                    "title",
                    "status",
                    "detail",
                    "code",
                    "trace_id"
                ],
                "properties": {
                    "title": {
                        "type": "string",
                        "description": "A short summary of the kind of problem, such as \"Not Found\"."
                    },
                    "status": {
                        "type": "integer",
                        "description": "The HTTP status of the answer."
                    },
                    "detail": {
                        "type": "string",
                        "description": "What went wrong with this request."
                    },
                    "code": {
                        "type": "string",
                        "description": "The problem's stable code, such as `not_found`."
                    },
                    "trace_id": {
                        "type": "string",
                        "description": "The request's trace id, also sent in the `X-Trace-Id` header. Quote it when you ask about a request."
                    },
                    "errors": {
                        "type": "array",
                        "description": "For invalid input, a pointer to each failing field.",
                        "items": {
                            "$ref": "#/components/schemas/FieldError"
                        }
                    }
                }
            },
            "FirewallRefusal": {
                "type": "object",
                "description": "A refusal from the firewall in front of the API, before the request reached Affiliqo. It has the same fields as Affiliqo's problem documents, as `application/json`, without a trace id.",
                "required": [
                    "title",
                    "status",
                    "code",
                    "detail"
                ],
                "properties": {
                    "title": {
                        "type": "string",
                        "description": "A short summary of the kind of refusal, such as \"Forbidden\"."
                    },
                    "status": {
                        "type": "integer",
                        "description": "The HTTP status of the answer."
                    },
                    "code": {
                        "type": "string",
                        "description": "The refusal's stable code."
                    },
                    "detail": {
                        "type": "string",
                        "description": "What to do about it."
                    }
                }
            },
            "CohortRow": {
                "type": "object",
                "required": [
                    "cohort",
                    "players",
                    "cells",
                    "total"
                ],
                "properties": {
                    "cohort": {
                        "type": "string",
                        "format": "date",
                        "description": "The cohort's first day."
                    },
                    "players": {
                        "type": "integer",
                        "description": "The players in the cohort."
                    },
                    "cells": {
                        "type": "array",
                        "description": "The figure in each period from the cohort's own, or null for a period still to come.",
                        "items": {
                            "type": "integer",
                            "nullable": true
                        }
                    },
                    "total": {
                        "type": "integer"
                    }
                }
            },
            "CohortAnswer": {
                "type": "object",
                "description": "A cohort report: a row per cohort, each with its players and one cell per period from its own. Money is in minor units of `currency`.",
                "required": [
                    "report",
                    "from",
                    "to",
                    "timezone",
                    "currency",
                    "rates_on",
                    "cohort_type",
                    "cohort_grain",
                    "figure",
                    "periods",
                    "cohorts",
                    "period_totals",
                    "total"
                ],
                "properties": {
                    "report": {
                        "type": "string",
                        "enum": [
                            "cohorts"
                        ]
                    },
                    "from": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "to": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "timezone": {
                        "type": "string"
                    },
                    "currency": {
                        "type": "string"
                    },
                    "rates_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "cohort_type": {
                        "type": "string",
                        "description": "What puts players in a cohort.",
                        "enum": [
                            "sign_up",
                            "first_deposit",
                            "deposit"
                        ]
                    },
                    "cohort_grain": {
                        "type": "string",
                        "enum": [
                            "day",
                            "week",
                            "month"
                        ]
                    },
                    "figure": {
                        "type": "string",
                        "description": "The one figure the cells show."
                    },
                    "periods": {
                        "type": "integer",
                        "description": "How many periods each cohort is followed for, its own included."
                    },
                    "cohorts": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/CohortRow"
                        }
                    },
                    "period_totals": {
                        "type": "array",
                        "description": "Each period's total, or null for a period still to come; empty for deposit cohorts, whose players sit in several cohorts.",
                        "items": {
                            "type": "integer",
                            "nullable": true
                        }
                    },
                    "total": {
                        "type": "integer",
                        "nullable": true,
                        "description": "The report's total."
                    }
                }
            },
            "ReportAttributes": {
                "type": "object",
                "required": [
                    "reports"
                ],
                "properties": {
                    "reports": {
                        "type": "array",
                        "description": "Each report you get.",
                        "items": {
                            "type": "object",
                            "required": [
                                "report",
                                "columns",
                                "group_by",
                                "filters",
                                "max_group_by",
                                "max_span_days",
                                "max_periods"
                            ],
                            "properties": {
                                "report": {
                                    "type": "string",
                                    "description": "The report, as its path names it.",
                                    "enum": [
                                        "statistics",
                                        "traffic",
                                        "cohorts",
                                        "sub-affiliates"
                                    ]
                                },
                                "columns": {
                                    "type": "array",
                                    "description": "The columns you may ask for and sort by; for the cohort report, the figures.",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "group_by": {
                                    "type": "array",
                                    "description": "The groupings you may use.",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "filters": {
                                    "type": "array",
                                    "description": "The filter parameters you may use.",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "max_group_by": {
                                    "type": "integer",
                                    "description": "How many groupings at once."
                                },
                                "max_span_days": {
                                    "type": "integer",
                                    "description": "The longest span, in days."
                                },
                                "max_periods": {
                                    "type": "integer",
                                    "nullable": true,
                                    "description": "For the cohort report, the most periods; null for the others."
                                }
                            }
                        }
                    }
                }
            },
            "Partner": {
                "type": "object",
                "description": "One of the program's partners, by what tells it apart and how the program runs it; never a person's details.",
                "required": [
                    "id",
                    "number",
                    "company_name",
                    "state",
                    "parent_id",
                    "manager_id",
                    "tags",
                    "approved_at",
                    "created_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "number": {
                        "type": "integer",
                        "description": "The partner's number, which its links' stags carry."
                    },
                    "company_name": {
                        "type": "string"
                    },
                    "state": {
                        "type": "string",
                        "enum": [
                            "unconfirmed",
                            "unverified",
                            "verified",
                            "rejected",
                            "blocked"
                        ]
                    },
                    "parent_id": {
                        "type": "string",
                        "format": "uuid",
                        "nullable": true,
                        "description": "The partner that brought it, for a sub-affiliate."
                    },
                    "manager_id": {
                        "type": "string",
                        "format": "uuid",
                        "nullable": true,
                        "description": "The operator who looks after it."
                    },
                    "tags": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "approved_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "PartnerPage": {
                "type": "object",
                "required": [
                    "partners",
                    "next_cursor"
                ],
                "properties": {
                    "partners": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Partner"
                        }
                    },
                    "next_cursor": {
                        "type": "string",
                        "nullable": true,
                        "description": "Send it as `cursor` for the next page; null on the last page."
                    }
                }
            },
            "Campaign": {
                "type": "object",
                "description": "A campaign, with its promos that aren't archived, its traffic source, the deal that covers it now, its pinned domain and its state.",
                "required": [
                    "id",
                    "partner_id",
                    "brand_id",
                    "name",
                    "created_at",
                    "promos",
                    "traffic_source",
                    "deal",
                    "pinned_domain",
                    "state"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "partner_id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "brand_id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "name": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "promos": {
                        "type": "array",
                        "description": "Its promos that aren't archived; none for a campaign just created.",
                        "items": {
                            "type": "object",
                            "required": [
                                "id",
                                "landing_id",
                                "name",
                                "code"
                            ],
                            "properties": {
                                "id": {
                                    "type": "string",
                                    "format": "uuid"
                                },
                                "landing_id": {
                                    "type": "string",
                                    "format": "uuid"
                                },
                                "name": {
                                    "type": "string"
                                },
                                "code": {
                                    "type": "string",
                                    "description": "The promo's code, which its links carry."
                                }
                            }
                        }
                    },
                    "traffic_source": {
                        "type": "object",
                        "nullable": true,
                        "description": "Where its visitors come from, one of the program's traffic sources; null for none. Its new promos start with it.",
                        "required": [
                            "id",
                            "name"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "format": "uuid"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "deal": {
                        "type": "object",
                        "nullable": true,
                        "description": "The deal that covers its players now, by name: its own, else the partner's for the brand; null for none.",
                        "required": [
                            "id",
                            "name"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "format": "uuid"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "pinned_domain": {
                        "type": "string",
                        "nullable": true,
                        "description": "The brand's tracking domain its links are shown on first; null for the brand's default."
                    },
                    "state": {
                        "type": "string",
                        "enum": [
                            "active",
                            "archived"
                        ],
                        "description": "`active` while it is in the link builder; `archived` once it left it, while its links and codes keep working."
                    }
                }
            },
            "CampaignPage": {
                "type": "object",
                "required": [
                    "campaigns",
                    "next_cursor"
                ],
                "properties": {
                    "campaigns": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Campaign"
                        }
                    },
                    "next_cursor": {
                        "type": "string",
                        "nullable": true
                    }
                }
            },
            "Reference": {
                "type": "object",
                "description": "Another record this one refers to.",
                "required": [
                    "id",
                    "name"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "name": {
                        "type": "string"
                    }
                }
            },
            "Bill": {
                "type": "object",
                "description": "A bill. Amounts are in minor units of `currency`.",
                "required": [
                    "id",
                    "partner_id",
                    "brand",
                    "deal",
                    "period_start_date",
                    "period_end_date",
                    "currency",
                    "total_amount",
                    "status",
                    "is_carried",
                    "issued_at",
                    "expected_payment_on",
                    "payment"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "partner_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "The partner the bill pays."
                    },
                    "brand": {
                        "$ref": "#/components/schemas/Reference"
                    },
                    "deal": {
                        "$ref": "#/components/schemas/Reference"
                    },
                    "period_start_date": {
                        "type": "string",
                        "format": "date",
                        "description": "The period's first day, in the program's timezone."
                    },
                    "period_end_date": {
                        "type": "string",
                        "format": "date",
                        "description": "The period's last day."
                    },
                    "currency": {
                        "type": "string"
                    },
                    "total_amount": {
                        "type": "integer",
                        "description": "What the bill pays."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "issued",
                            "on_hold",
                            "paid",
                            "canceled"
                        ]
                    },
                    "is_carried": {
                        "type": "boolean",
                        "description": "Whether the total moves to the partner's next bill instead of being paid on its own."
                    },
                    "issued_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "expected_payment_on": {
                        "type": "string",
                        "format": "date",
                        "nullable": true,
                        "description": "The day the program expects to pay it."
                    },
                    "payment": {
                        "type": "object",
                        "nullable": true,
                        "description": "What was paid, once the program has paid the bill.",
                        "required": [
                            "paid_on",
                            "reference",
                            "amount",
                            "currency",
                            "rate"
                        ],
                        "properties": {
                            "paid_on": {
                                "type": "string",
                                "format": "date"
                            },
                            "reference": {
                                "type": "string",
                                "nullable": true,
                                "description": "A bank reference or a transaction hash."
                            },
                            "amount": {
                                "type": "integer",
                                "nullable": true,
                                "description": "The amount paid, in minor units of its currency."
                            },
                            "currency": {
                                "type": "string",
                                "nullable": true
                            },
                            "rate": {
                                "type": "string",
                                "nullable": true,
                                "description": "The exchange rate, when the program paid in another currency."
                            }
                        }
                    }
                }
            },
            "BillPage": {
                "type": "object",
                "required": [
                    "bills",
                    "next_cursor"
                ],
                "properties": {
                    "bills": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Bill"
                        }
                    },
                    "next_cursor": {
                        "type": "string",
                        "nullable": true,
                        "description": "Send it as `cursor` for the next page; null on the last page."
                    }
                }
            },
            "Adjustment": {
                "type": "object",
                "description": "An amount added to or taken off a partner's next bill on a brand. Amounts are in minor units of `currency`.",
                "required": [
                    "id",
                    "partner_id",
                    "brand_id",
                    "kind",
                    "amount",
                    "currency",
                    "reason",
                    "created_at"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "partner_id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "brand_id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "marketing",
                            "promo",
                            "advance_payment",
                            "fraud",
                            "other"
                        ]
                    },
                    "amount": {
                        "type": "integer",
                        "description": "Positive when it adds to the bill, negative when it takes off."
                    },
                    "currency": {
                        "type": "string"
                    },
                    "reason": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            },
            "AdjustmentPage": {
                "type": "object",
                "required": [
                    "adjustments",
                    "next_cursor"
                ],
                "properties": {
                    "adjustments": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Adjustment"
                        }
                    },
                    "next_cursor": {
                        "type": "string",
                        "nullable": true,
                        "description": "Send it as `cursor` for the next page; null on the last page."
                    }
                }
            },
            "Player": {
                "type": "object",
                "description": "A player, by the casino's id, with its attribution, country, dates and flags; never the personal details of its profile.",
                "required": [
                    "id",
                    "casino_player_id",
                    "brand_id",
                    "partner_id",
                    "campaign_id",
                    "promo_id",
                    "country",
                    "signed_up_at",
                    "first_deposit_at",
                    "is_frozen",
                    "is_duplicate",
                    "is_self_excluded",
                    "is_disabled"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Affiliqo's id of the player."
                    },
                    "casino_player_id": {
                        "type": "string"
                    },
                    "brand_id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "partner_id": {
                        "type": "string",
                        "format": "uuid",
                        "nullable": true,
                        "description": "The partner who brought the player, or null for a player nobody brought."
                    },
                    "campaign_id": {
                        "type": "string",
                        "format": "uuid",
                        "nullable": true
                    },
                    "promo_id": {
                        "type": "string",
                        "format": "uuid",
                        "nullable": true
                    },
                    "country": {
                        "type": "string",
                        "nullable": true,
                        "description": "ISO 3166-1 alpha-2."
                    },
                    "signed_up_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "first_deposit_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "is_frozen": {
                        "type": "boolean"
                    },
                    "is_duplicate": {
                        "type": "boolean"
                    },
                    "is_self_excluded": {
                        "type": "boolean"
                    },
                    "is_disabled": {
                        "type": "boolean"
                    }
                }
            },
            "PlayerPage": {
                "type": "object",
                "required": [
                    "players",
                    "next_cursor"
                ],
                "properties": {
                    "players": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Player"
                        }
                    },
                    "next_cursor": {
                        "type": "string",
                        "nullable": true,
                        "description": "Send it as `cursor` for the next page; null on the last page."
                    }
                }
            }
        },
        "responses": {
            "InvalidReportCursor": {
                "description": "`invalid_cursor`: the cursor isn't one Affiliqo gave for this request. Send the `next_cursor` of the page before exactly as it came, with the same parameters, or no cursor for the first page.",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "invalid_cursor"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "Unauthorized": {
                "description": "The request carries no working data token, as `invalid_token`: the `Authorization` header is missing or isn't `Bearer <token>`, or the token is unknown or revoked, or the program has left Affiliqo.",
                "headers": {
                    "WWW-Authenticate": {
                        "description": "The scheme to send tokens with.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "Bearer"
                            ]
                        }
                    }
                },
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "invalid_token"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "CapabilityOff": {
                "description": "The part of the merchant's subscription this operation belongs to is switched off, as `capability_off`. Ask the Affiliqo team about the subscription.",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "capability_off"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "Forbidden": {
                "description": "The credential may not do this. Affiliqo answers with `scope_missing` when the credential lacks the scope the operation needs, and with `address_not_allowed` when the request came from an address the credential doesn't list. The firewall answers an address that no active credential lists itself, as `application/json`, and so it answers an address registered only on statistic or data tokens anywhere but under `/stats/` and `/operator/`.",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "scope_missing",
                                                "address_not_allowed"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    },
                    "application/json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/FirewallRefusal"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "address_not_allowed"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "NotFound": {
                "description": "Nothing exists at this address for your credential, as `not_found`.",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "not_found"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "RateMissing": {
                "description": "The report needs an exchange rate Affiliqo doesn't have for the rates date, as `exchange_rate_missing`: ask in the program's currency, or for an earlier `rates_on`.",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "exchange_rate_missing"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "InvalidReport": {
                "description": "The request asks for something the report doesn't take or you may not use, as `invalid_input`: a parameter the report doesn't define, an unknown timezone or currency, a name the report doesn't know, or a grouping, column, filter or sort you don't get. Each error points at the parameter. `figure_too_large`: a figure passed what an amount can hold; ask for a shorter span.",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "invalid_input",
                                                "figure_too_large"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "TooManyRequests": {
                "description": "Too many requests. Affiliqo's answer says in `Retry-After` how many seconds to wait. The firewall's answer, for too many requests from one address, is `application/json` and has no `Retry-After`: wait a few minutes, then retry.",
                "headers": {
                    "Retry-After": {
                        "description": "The seconds to wait before retrying. Only Affiliqo's own answer has it.",
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        }
                    }
                },
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "too_many_requests"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    },
                    "application/json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/FirewallRefusal"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "too_many_requests"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "ServerError": {
                "description": "Something went wrong on Affiliqo's side, as `server_error`. Retry later; quote the `trace_id` if it lasts.",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "server_error"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "ReportsUnavailable": {
                "description": "Reports are briefly unavailable or busy, or the report took too long, as `unavailable`. Retry after the seconds in `Retry-After`; for a report that took too long, ask for a shorter span.",
                "headers": {
                    "Retry-After": {
                        "description": "The seconds to wait before retrying.",
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        }
                    }
                },
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "unavailable"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "Unavailable": {
                "description": "Affiliqo is briefly unavailable, as during a deploy, as `unavailable`. Retry in a minute.",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "unavailable"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "InvalidListCursor": {
                "description": "`invalid_cursor`: the cursor isn't one Affiliqo gave. Send the `next_cursor` of the page before exactly as it came, or no cursor for the first page.",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "invalid_cursor"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            "InvalidListQuery": {
                "description": "The request asks for something the list doesn't take, as `invalid_input`: a parameter it doesn't define, or a `limit` outside 1 to 1,000. Each error points at the parameter.",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/components/schemas/Problem"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "code": {
                                            "type": "string",
                                            "enum": [
                                                "invalid_input"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        }
    }
}
