{
    "openapi": "3.0.3",
    "info": {
        "title": "ALOSKY Partner API",
        "version": "1.2.0",
        "description": "Stats, links, smartlinks, offers, landings, conversions, postbacks and payouts for ALOSKY partners. All responses are JSON: {\"ok\":true,\"data\":…,\"meta\":…} or {\"ok\":false,\"error\":{\"code\",\"message\",\"fields\"}}."
    },
    "servers": [
        {
            "url": "https://alosky.com/api/v1"
        }
    ],
    "security": [
        {
            "bearer": []
        }
    ],
    "tags": [
        {
            "name": "account"
        },
        {
            "name": "stats"
        },
        {
            "name": "links"
        },
        {
            "name": "catalog"
        },
        {
            "name": "conversions"
        },
        {
            "name": "postbacks"
        },
        {
            "name": "finance"
        }
    ],
    "paths": {
        "/me": {
            "get": {
                "operationId": "me",
                "tags": [
                    "account"
                ],
                "summary": "Account and key information",
                "description": "Scope: `read`",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "partner_id": 4100,
                                        "name": "NexAds",
                                        "company": "NexAds MMC",
                                        "email": "team@nexads.az",
                                        "status": "active",
                                        "currency": "USD",
                                        "key": {
                                            "name": "Server",
                                            "scopes": [
                                                "read",
                                                "links"
                                            ],
                                            "expires_at": null
                                        },
                                        "server_time": "2026-12-03T17:40:00+04:00"
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/balance": {
            "get": {
                "operationId": "balance",
                "tags": [
                    "account"
                ],
                "summary": "Balance, hold and payouts",
                "description": "Scope: `read`",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "currency": "USD",
                                        "balance": 1240.55,
                                        "available": 1100.0,
                                        "on_hold": 140.55,
                                        "reserve": 0.0,
                                        "pending_withdrawals": 0.0,
                                        "paid_total": 18450.0,
                                        "min_payout": 50.0
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/notifications": {
            "get": {
                "operationId": "notifications",
                "tags": [
                    "account"
                ],
                "summary": "Notifications in the requested language",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "unread",
                        "in": "query",
                        "required": false,
                        "description": "Only unread (1).",
                        "schema": {
                            "type": "boolean"
                        },
                        "example": 1
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Items per page (1–500, default 100).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 100
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number (default 1).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "id": 981,
                                            "type": "success",
                                            "title": "Offer approved: Smart Downloader — Video",
                                            "body": "You can now use it with your partnerID and clickID.",
                                            "link": "/partner/?p=offer&id=5",
                                            "read": false,
                                            "created_at": "2026-12-03 12:00:00"
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/stats": {
            "get": {
                "operationId": "stats",
                "tags": [
                    "stats"
                ],
                "summary": "Daily / monthly statistics and earnings",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Start date (YYYY-MM-DD). Default: 6 days before \"to\".",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-11-01"
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "End date (YYYY-MM-DD). Default: today.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-11-30"
                    },
                    {
                        "name": "group",
                        "in": "query",
                        "required": false,
                        "description": "day | month | total (default day).",
                        "schema": {
                            "type": "string"
                        },
                        "example": "day"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "period": "2026-12-02",
                                            "clicks": 18420,
                                            "bots": 312,
                                            "sub_requests": 960,
                                            "subscriptions": 402,
                                            "active": 377,
                                            "unsubscribes": 25,
                                            "rebills": 1210,
                                            "cr": 2.18,
                                            "earnings": 312.4,
                                            "earnings_closed": true
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/stats/hourly": {
            "get": {
                "operationId": "stats_hourly",
                "tags": [
                    "stats"
                ],
                "summary": "Hourly statistics for one day",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "date",
                        "in": "query",
                        "required": false,
                        "description": "Day (YYYY-MM-DD). Default: today.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-12-03"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "hour": 14,
                                            "clicks": 1210,
                                            "bots": 18,
                                            "sub_requests": 64,
                                            "subscriptions": 27,
                                            "rebills": 80,
                                            "cr": 2.23
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/links/stats": {
            "get": {
                "operationId": "link_stats",
                "tags": [
                    "stats"
                ],
                "summary": "Click statistics per link",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Start date (YYYY-MM-DD). Default: 6 days before \"to\".",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-11-01"
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "End date (YYYY-MM-DD). Default: today.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-11-30"
                    },
                    {
                        "name": "link_id",
                        "in": "query",
                        "required": false,
                        "description": "Only this link.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "link_id": 42,
                                            "code": "k3Fq9xA2",
                                            "name": "Push AZ — main",
                                            "clicks": 15230,
                                            "landed": 14800,
                                            "fallback": 120,
                                            "trafficback": 310,
                                            "bots": 210,
                                            "blocked": 0,
                                            "mobile": 14950,
                                            "wifi": 280
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/links": {
            "get": {
                "operationId": "links",
                "tags": [
                    "links"
                ],
                "summary": "List your tracking links",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "live (default) | archived | all.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "live"
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "description": "landing | offer | smartlink.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "smartlink"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "id": 42,
                                            "code": "k3Fq9xA2",
                                            "name": "Push AZ — main",
                                            "type": "smartlink",
                                            "status": "active",
                                            "url": "https://endir.download/go/k3Fq9xA2",
                                            "tracking_url": "https://endir.download/go/k3Fq9xA2?clickID={click_id}&sub1={sub1}",
                                            "target": {
                                                "landing_id": null,
                                                "offer_id": null
                                            },
                                            "trafficback_url": "",
                                            "clicks_total": 15230,
                                            "last_click_at": "2026-12-03 17:20:11",
                                            "created_at": "2026-11-20 10:00:00"
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "link_create",
                "tags": [
                    "links"
                ],
                "summary": "Create a landing / offer / smartlink link",
                "description": "Scope: `links`",
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Repeat-safe POST: the same key within 24h returns the first result.",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 42,
                                        "code": "k3Fq9xA2",
                                        "name": "Push AZ — main",
                                        "type": "smartlink",
                                        "status": "active",
                                        "url": "https://endir.download/go/k3Fq9xA2",
                                        "tracking_url": "https://endir.download/go/k3Fq9xA2?clickID={click_id}&sub1={sub1}",
                                        "target": {
                                            "landing_id": null,
                                            "offer_id": null
                                        },
                                        "trafficback_url": "",
                                        "clicks_total": 15230,
                                        "last_click_at": "2026-12-03 17:20:11",
                                        "created_at": "2026-11-20 10:00:00"
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "Link name (max 120).",
                                        "example": "Push AZ — main"
                                    },
                                    "type": {
                                        "type": "string",
                                        "description": "landing | offer | smartlink.",
                                        "example": "landing"
                                    },
                                    "landing_id": {
                                        "type": "integer",
                                        "description": "Required for type=landing (see GET /landings, \"usable\": true).",
                                        "example": 1
                                    },
                                    "offer_id": {
                                        "type": "integer",
                                        "description": "Required for type=offer (see GET /offers, \"usable\": true).",
                                        "example": 5
                                    },
                                    "rules": {
                                        "type": "object",
                                        "description": "Smartlink rules (same JSON as the panel editor). Required for type=smartlink.",
                                        "example": {
                                            "rules": [
                                                {
                                                    "name": "AZ mobile",
                                                    "if": {
                                                        "countries": [
                                                            "AZ"
                                                        ],
                                                        "conn": "mobile"
                                                    },
                                                    "targets": [
                                                        {
                                                            "t": "landing",
                                                            "id": 1,
                                                            "w": 70
                                                        },
                                                        {
                                                            "t": "landing",
                                                            "id": 3,
                                                            "w": 30
                                                        }
                                                    ]
                                                }
                                            ],
                                            "default": [
                                                {
                                                    "t": "landing",
                                                    "id": 1,
                                                    "w": 100
                                                }
                                            ]
                                        }
                                    },
                                    "trafficback_url": {
                                        "type": "string",
                                        "description": "Where unmatched traffic goes (https, macros allowed).",
                                        "example": "https://example.com/tb?c={click_id}"
                                    },
                                    "auto_optimize": {
                                        "type": "boolean",
                                        "description": "Smartlink: let the system shift weights to the best-earning targets (if enabled for you).",
                                        "example": false
                                    }
                                },
                                "required": [
                                    "name",
                                    "type"
                                ]
                            }
                        },
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "Link name (max 120).",
                                        "example": "Push AZ — main"
                                    },
                                    "type": {
                                        "type": "string",
                                        "description": "landing | offer | smartlink.",
                                        "example": "landing"
                                    },
                                    "landing_id": {
                                        "type": "integer",
                                        "description": "Required for type=landing (see GET /landings, \"usable\": true).",
                                        "example": 1
                                    },
                                    "offer_id": {
                                        "type": "integer",
                                        "description": "Required for type=offer (see GET /offers, \"usable\": true).",
                                        "example": 5
                                    },
                                    "rules": {
                                        "type": "object",
                                        "description": "Smartlink rules (same JSON as the panel editor). Required for type=smartlink.",
                                        "example": {
                                            "rules": [
                                                {
                                                    "name": "AZ mobile",
                                                    "if": {
                                                        "countries": [
                                                            "AZ"
                                                        ],
                                                        "conn": "mobile"
                                                    },
                                                    "targets": [
                                                        {
                                                            "t": "landing",
                                                            "id": 1,
                                                            "w": 70
                                                        },
                                                        {
                                                            "t": "landing",
                                                            "id": 3,
                                                            "w": 30
                                                        }
                                                    ]
                                                }
                                            ],
                                            "default": [
                                                {
                                                    "t": "landing",
                                                    "id": 1,
                                                    "w": 100
                                                }
                                            ]
                                        }
                                    },
                                    "trafficback_url": {
                                        "type": "string",
                                        "description": "Where unmatched traffic goes (https, macros allowed).",
                                        "example": "https://example.com/tb?c={click_id}"
                                    },
                                    "auto_optimize": {
                                        "type": "boolean",
                                        "description": "Smartlink: let the system shift weights to the best-earning targets (if enabled for you).",
                                        "example": false
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/links/{id}": {
            "get": {
                "operationId": "link_get",
                "tags": [
                    "links"
                ],
                "summary": "One link with smartlink rules",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Resource ID.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 42,
                                        "code": "k3Fq9xA2",
                                        "name": "Push AZ — main",
                                        "type": "smartlink",
                                        "status": "active",
                                        "url": "https://endir.download/go/k3Fq9xA2",
                                        "tracking_url": "https://endir.download/go/k3Fq9xA2?clickID={click_id}&sub1={sub1}",
                                        "target": {
                                            "landing_id": null,
                                            "offer_id": null
                                        },
                                        "trafficback_url": "",
                                        "clicks_total": 15230,
                                        "last_click_at": "2026-12-03 17:20:11",
                                        "created_at": "2026-11-20 10:00:00",
                                        "auto_optimize": false,
                                        "rules": {
                                            "rules": [
                                                {
                                                    "name": "AZ mobile",
                                                    "if": {
                                                        "countries": [
                                                            "AZ"
                                                        ],
                                                        "conn": "mobile"
                                                    },
                                                    "targets": [
                                                        {
                                                            "t": "landing",
                                                            "id": 1,
                                                            "w": 70
                                                        },
                                                        {
                                                            "t": "landing",
                                                            "id": 3,
                                                            "w": 30
                                                        }
                                                    ]
                                                }
                                            ],
                                            "default": [
                                                {
                                                    "t": "landing",
                                                    "id": 1,
                                                    "w": 100
                                                }
                                            ]
                                        }
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "patch": {
                "operationId": "link_update",
                "tags": [
                    "links"
                ],
                "summary": "Rename, retarget, pause or resume a link",
                "description": "Scope: `links`",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Resource ID.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 42,
                                        "code": "k3Fq9xA2",
                                        "name": "Push AZ — main",
                                        "type": "smartlink",
                                        "status": "active",
                                        "url": "https://endir.download/go/k3Fq9xA2",
                                        "tracking_url": "https://endir.download/go/k3Fq9xA2?clickID={click_id}&sub1={sub1}",
                                        "target": {
                                            "landing_id": null,
                                            "offer_id": null
                                        },
                                        "trafficback_url": "",
                                        "clicks_total": 15230,
                                        "last_click_at": "2026-12-03 17:20:11",
                                        "created_at": "2026-11-20 10:00:00"
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "New name.",
                                        "example": "Push AZ — v2"
                                    },
                                    "status": {
                                        "type": "string",
                                        "description": "active | paused.",
                                        "example": "paused"
                                    },
                                    "landing_id": {
                                        "type": "integer",
                                        "description": "New landing (type=landing).",
                                        "example": 2
                                    },
                                    "offer_id": {
                                        "type": "integer",
                                        "description": "New offer (type=offer).",
                                        "example": 6
                                    },
                                    "rules": {
                                        "type": "object",
                                        "description": "New smartlink rules."
                                    },
                                    "trafficback_url": {
                                        "type": "string",
                                        "description": "New TrafficBack URL (\"\" to clear).",
                                        "example": ""
                                    },
                                    "auto_optimize": {
                                        "type": "boolean",
                                        "description": "Smartlink auto-optimisation on / off.",
                                        "example": true
                                    }
                                }
                            }
                        },
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "New name.",
                                        "example": "Push AZ — v2"
                                    },
                                    "status": {
                                        "type": "string",
                                        "description": "active | paused.",
                                        "example": "paused"
                                    },
                                    "landing_id": {
                                        "type": "integer",
                                        "description": "New landing (type=landing).",
                                        "example": 2
                                    },
                                    "offer_id": {
                                        "type": "integer",
                                        "description": "New offer (type=offer).",
                                        "example": 6
                                    },
                                    "rules": {
                                        "type": "object",
                                        "description": "New smartlink rules."
                                    },
                                    "trafficback_url": {
                                        "type": "string",
                                        "description": "New TrafficBack URL (\"\" to clear).",
                                        "example": ""
                                    },
                                    "auto_optimize": {
                                        "type": "boolean",
                                        "description": "Smartlink auto-optimisation on / off.",
                                        "example": true
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "link_delete",
                "tags": [
                    "links"
                ],
                "summary": "Archive a link (traffic goes to TrafficBack)",
                "description": "Scope: `links`",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Resource ID.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 42,
                                        "status": "archived"
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/offers": {
            "get": {
                "operationId": "offers",
                "tags": [
                    "catalog"
                ],
                "summary": "Offers you can see, with access status and CPA price",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "country",
                        "in": "query",
                        "required": false,
                        "description": "ISO country (AZ, TR…).",
                        "schema": {
                            "type": "string"
                        },
                        "example": "AZ"
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "required": false,
                        "description": "Category code.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "video"
                    },
                    {
                        "name": "usable",
                        "in": "query",
                        "required": false,
                        "description": "Only offers you can run now (1).",
                        "schema": {
                            "type": "boolean"
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "id": 5,
                                            "code": "az-azercell-video",
                                            "title": "Smart Downloader — Video",
                                            "description": "Video streaming for Azercell subscribers.",
                                            "category": "video",
                                            "country": "AZ",
                                            "flow": "oneclick",
                                            "operators": [
                                                {
                                                    "id": 1,
                                                    "name": "Azercell"
                                                }
                                            ],
                                            "traffic": [
                                                "push",
                                                "popunder",
                                                "inapp"
                                            ],
                                            "image": null,
                                            "access": "approved",
                                            "usable": true,
                                            "featured": true,
                                            "payout": {
                                                "model": "cpa",
                                                "range": "$0.40 – $2.80",
                                                "by_operator": {
                                                    "1": "$0.40 – $2.80"
                                                }
                                            },
                                            "rules": "Misleading ads and brand bidding are not allowed."
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/offers/{id}": {
            "get": {
                "operationId": "offer_get",
                "tags": [
                    "catalog"
                ],
                "summary": "One offer with its landings",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Resource ID.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 5,
                                        "title": "Smart Downloader — Video",
                                        "access": "approved",
                                        "usable": true,
                                        "landings": [
                                            {
                                                "id": 3,
                                                "title": "Video Pro"
                                            }
                                        ]
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/offers/{id}/request": {
            "post": {
                "operationId": "offer_request",
                "tags": [
                    "catalog"
                ],
                "summary": "Request access to an offer",
                "description": "Scope: `offers`",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Resource ID.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Repeat-safe POST: the same key within 24h returns the first result.",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 5,
                                        "access": "pending"
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "source": {
                                        "type": "string",
                                        "description": "Your traffic source (may be required).",
                                        "example": "Push + popunder, AZ mobile"
                                    },
                                    "message": {
                                        "type": "string",
                                        "description": "Message to the manager.",
                                        "example": ""
                                    }
                                }
                            }
                        },
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "source": {
                                        "type": "string",
                                        "description": "Your traffic source (may be required).",
                                        "example": "Push + popunder, AZ mobile"
                                    },
                                    "message": {
                                        "type": "string",
                                        "description": "Message to the manager.",
                                        "example": ""
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/landings": {
            "get": {
                "operationId": "landings",
                "tags": [
                    "catalog"
                ],
                "summary": "Landing pages with preview and access status",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "country",
                        "in": "query",
                        "required": false,
                        "description": "ISO country.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "AZ"
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "required": false,
                        "description": "download | video | music | game | tools…",
                        "schema": {
                            "type": "string"
                        },
                        "example": "download"
                    },
                    {
                        "name": "offer_id",
                        "in": "query",
                        "required": false,
                        "description": "Only landings of this offer.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 5
                    },
                    {
                        "name": "usable",
                        "in": "query",
                        "required": false,
                        "description": "Only usable now (1).",
                        "schema": {
                            "type": "boolean"
                        },
                        "example": 1
                    },
                    {
                        "name": "click_macro",
                        "in": "query",
                        "required": false,
                        "description": "Your tracker click macro to put into direct_url instead of {click_id}.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "{clickid}"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "id": 1,
                                            "code": "download",
                                            "title": "Smart Downloader — File download",
                                            "category": "download",
                                            "country": "AZ",
                                            "flow": "pin",
                                            "operators": [
                                                {
                                                    "id": 1,
                                                    "name": "Azercell"
                                                }
                                            ],
                                            "thumb": "https://alosky.com/assets/img/landings/download.webp",
                                            "preview_url": "https://alosky.com/partner/?p=landing&id=1",
                                            "direct_url": "https://endir.download/landing/download/?partnerID=4100&clickID={click_id}",
                                            "own": false,
                                            "access": "open",
                                            "usable": true,
                                            "featured": true
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/landings/{id}/request": {
            "post": {
                "operationId": "landing_request",
                "tags": [
                    "catalog"
                ],
                "summary": "Request access to a landing page",
                "description": "Scope: `offers`",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Resource ID.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Repeat-safe POST: the same key within 24h returns the first result.",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 7,
                                        "access": "pending"
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "source": {
                                        "type": "string",
                                        "description": "Your traffic source.",
                                        "example": "Push AZ"
                                    },
                                    "message": {
                                        "type": "string",
                                        "description": "Message.",
                                        "example": ""
                                    }
                                }
                            }
                        },
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "source": {
                                        "type": "string",
                                        "description": "Your traffic source.",
                                        "example": "Push AZ"
                                    },
                                    "message": {
                                        "type": "string",
                                        "description": "Message.",
                                        "example": ""
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/operators": {
            "get": {
                "operationId": "operators",
                "tags": [
                    "catalog"
                ],
                "summary": "Countries and operators (for smartlink rules)",
                "description": "Scope: `read`",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "countries": [
                                            {
                                                "code": "AZ",
                                                "name": "Azerbaijan"
                                            }
                                        ],
                                        "operators": [
                                            {
                                                "id": 1,
                                                "code": "azercell",
                                                "name": "Azercell",
                                                "country": "AZ",
                                                "kind": "mobile"
                                            }
                                        ]
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/conversions": {
            "get": {
                "operationId": "conversions",
                "tags": [
                    "conversions"
                ],
                "summary": "Subscriptions of one day with your click IDs and live status",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "date",
                        "in": "query",
                        "required": false,
                        "description": "Day (YYYY-MM-DD). Default: today.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-12-03"
                    },
                    {
                        "name": "click_id",
                        "in": "query",
                        "required": false,
                        "description": "Filter by your click ID.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "c7b36020-1931-4734-86c3-268e2fa9a791"
                    },
                    {
                        "name": "after_id",
                        "in": "query",
                        "required": false,
                        "description": "Cursor: return items with id greater than this (from meta.next_after_id).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 0
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Items per call (1–1000, default 500).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 500
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "id": 8812345,
                                            "click_id": "c7b36020-1931-4734-86c3-268e2fa9a791",
                                            "pubid": "zone-77",
                                            "zoneid": "",
                                            "subscribed_at": "2026-12-03 14:21:09",
                                            "operator": "azercell",
                                            "country": "AZ",
                                            "landing": "download",
                                            "tariff_id": 12,
                                            "msisdn": "99450***4567",
                                            "status": "active",
                                            "unsubscribed_at": null,
                                            "model": "revshare",
                                            "charges": 3
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/cpa/conversions": {
            "get": {
                "operationId": "cpa_conversions",
                "tags": [
                    "conversions"
                ],
                "summary": "CPA conversions with hold / approval status and price",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Start date (YYYY-MM-DD). Default: 6 days before \"to\".",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-11-01"
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "End date (YYYY-MM-DD). Default: today.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-11-30"
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "pending | approved | rejected | reversed.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "approved"
                    },
                    {
                        "name": "click_id",
                        "in": "query",
                        "required": false,
                        "description": "Filter by your click ID.",
                        "schema": {
                            "type": "string"
                        },
                        "example": ""
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Items per page (1–500, default 100).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 100
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number (default 1).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "id": 301,
                                            "click_id": "c7b36020-1931-4734-86c3-268e2fa9a791",
                                            "pubid": "zone-77",
                                            "operator": "azercell",
                                            "day": "2026-12-02",
                                            "landing": "download",
                                            "msisdn": "99450***4567",
                                            "subscribed_at": "2026-12-02 13:40:00",
                                            "converted_at": "2026-12-02 13:41:12",
                                            "status": "approved",
                                            "amount": 1.2,
                                            "currency": "USD",
                                            "hold_until": null,
                                            "decided_at": "2026-12-02 16:05:00"
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/postbacks": {
            "get": {
                "operationId": "postbacks",
                "tags": [
                    "postbacks"
                ],
                "summary": "Your postback (S2S) settings",
                "description": "Scope: `read`",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "id": 7,
                                            "name": "Keitaro — subscribe",
                                            "event": "subscribe",
                                            "method": "GET",
                                            "url_template": "https://tracker.example.com/postback?subid={click_id}&status=sale&payout={payout}",
                                            "body_format": "none",
                                            "body_template": "",
                                            "currency": "USD",
                                            "success_match": "",
                                            "sign": false,
                                            "secret": null,
                                            "target": {
                                                "offers": [],
                                                "landings": [],
                                                "tariffs": [],
                                                "operators": []
                                            },
                                            "active": true,
                                            "last_sent_at": "2026-12-03 17:01:44",
                                            "created_at": "2026-11-21 09:12:00",
                                            "updated_at": "2026-11-21 09:12:00"
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "postback_create",
                "tags": [
                    "postbacks"
                ],
                "summary": "Create a postback",
                "description": "Scope: `postbacks`",
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Repeat-safe POST: the same key within 24h returns the first result.",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 7,
                                        "name": "Keitaro — subscribe",
                                        "event": "subscribe",
                                        "method": "GET",
                                        "url_template": "https://tracker.example.com/postback?subid={click_id}&status=sale&payout={payout}",
                                        "body_format": "none",
                                        "body_template": "",
                                        "currency": "USD",
                                        "success_match": "",
                                        "sign": false,
                                        "secret": null,
                                        "target": {
                                            "offers": [],
                                            "landings": [],
                                            "tariffs": [],
                                            "operators": []
                                        },
                                        "active": true,
                                        "last_sent_at": "2026-12-03 17:01:44",
                                        "created_at": "2026-11-21 09:12:00",
                                        "updated_at": "2026-11-21 09:12:00"
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "event": {
                                        "type": "string",
                                        "description": "subscribe | rebill | unsubscribe | cpa (see GET /postbacks/events).",
                                        "example": "subscribe"
                                    },
                                    "url_template": {
                                        "type": "string",
                                        "description": "URL with macros: {click_id} {payout} {currency} {sub1}…{sub5} {operator} {country} {date}…",
                                        "example": "https://tracker.example.com/pb?subid={click_id}&payout={payout}"
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Name.",
                                        "example": "Keitaro"
                                    },
                                    "method": {
                                        "type": "string",
                                        "description": "GET (default) | POST.",
                                        "example": "GET"
                                    },
                                    "body_format": {
                                        "type": "string",
                                        "description": "POST only: none | form | json.",
                                        "example": "none"
                                    },
                                    "body_template": {
                                        "type": "string",
                                        "description": "POST body with macros.",
                                        "example": ""
                                    },
                                    "currency": {
                                        "type": "string",
                                        "description": "Payout currency (USD, AZN, EUR, TRY…).",
                                        "example": "USD"
                                    },
                                    "success_match": {
                                        "type": "string",
                                        "description": "Text that must appear in a successful response.",
                                        "example": "OK"
                                    },
                                    "sign": {
                                        "type": "boolean",
                                        "description": "Add an HMAC signature header.",
                                        "example": false
                                    },
                                    "target": {
                                        "type": "string",
                                        "description": "all (default) | specific.",
                                        "example": "all"
                                    },
                                    "f_offers": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "specific: offer IDs.",
                                        "example": []
                                    },
                                    "f_landings": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "specific: landing codes.",
                                        "example": []
                                    },
                                    "f_operators": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "specific: operator IDs (see /operators).",
                                        "example": []
                                    }
                                },
                                "required": [
                                    "event",
                                    "url_template"
                                ]
                            }
                        },
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "event": {
                                        "type": "string",
                                        "description": "subscribe | rebill | unsubscribe | cpa (see GET /postbacks/events).",
                                        "example": "subscribe"
                                    },
                                    "url_template": {
                                        "type": "string",
                                        "description": "URL with macros: {click_id} {payout} {currency} {sub1}…{sub5} {operator} {country} {date}…",
                                        "example": "https://tracker.example.com/pb?subid={click_id}&payout={payout}"
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Name.",
                                        "example": "Keitaro"
                                    },
                                    "method": {
                                        "type": "string",
                                        "description": "GET (default) | POST.",
                                        "example": "GET"
                                    },
                                    "body_format": {
                                        "type": "string",
                                        "description": "POST only: none | form | json.",
                                        "example": "none"
                                    },
                                    "body_template": {
                                        "type": "string",
                                        "description": "POST body with macros.",
                                        "example": ""
                                    },
                                    "currency": {
                                        "type": "string",
                                        "description": "Payout currency (USD, AZN, EUR, TRY…).",
                                        "example": "USD"
                                    },
                                    "success_match": {
                                        "type": "string",
                                        "description": "Text that must appear in a successful response.",
                                        "example": "OK"
                                    },
                                    "sign": {
                                        "type": "boolean",
                                        "description": "Add an HMAC signature header.",
                                        "example": false
                                    },
                                    "target": {
                                        "type": "string",
                                        "description": "all (default) | specific.",
                                        "example": "all"
                                    },
                                    "f_offers": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "specific: offer IDs.",
                                        "example": []
                                    },
                                    "f_landings": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "specific: landing codes.",
                                        "example": []
                                    },
                                    "f_operators": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "specific: operator IDs (see /operators).",
                                        "example": []
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/postbacks/{id}": {
            "get": {
                "operationId": "postback_get",
                "tags": [
                    "postbacks"
                ],
                "summary": "One postback setting (with signing secret)",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Resource ID.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 7,
                                        "name": "Keitaro — subscribe",
                                        "event": "subscribe",
                                        "method": "GET",
                                        "url_template": "https://tracker.example.com/postback?subid={click_id}&status=sale&payout={payout}",
                                        "body_format": "none",
                                        "body_template": "",
                                        "currency": "USD",
                                        "success_match": "",
                                        "sign": false,
                                        "secret": null,
                                        "target": {
                                            "offers": [],
                                            "landings": [],
                                            "tariffs": [],
                                            "operators": []
                                        },
                                        "active": true,
                                        "last_sent_at": "2026-12-03 17:01:44",
                                        "created_at": "2026-11-21 09:12:00",
                                        "updated_at": "2026-11-21 09:12:00"
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "patch": {
                "operationId": "postback_update",
                "tags": [
                    "postbacks"
                ],
                "summary": "Change a postback (send only the fields to change)",
                "description": "Scope: `postbacks`",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Resource ID.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 7,
                                        "name": "Keitaro — subscribe",
                                        "event": "subscribe",
                                        "method": "GET",
                                        "url_template": "https://tracker.example.com/postback?subid={click_id}&status=sale&payout={payout}",
                                        "body_format": "none",
                                        "body_template": "",
                                        "currency": "USD",
                                        "success_match": "",
                                        "sign": false,
                                        "secret": null,
                                        "target": {
                                            "offers": [],
                                            "landings": [],
                                            "tariffs": [],
                                            "operators": []
                                        },
                                        "active": true,
                                        "last_sent_at": "2026-12-03 17:01:44",
                                        "created_at": "2026-11-21 09:12:00",
                                        "updated_at": "2026-11-21 09:12:00"
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url_template": {
                                        "type": "string",
                                        "description": "New URL.",
                                        "example": "https://tracker.example.com/v2?subid={click_id}"
                                    },
                                    "active": {
                                        "type": "boolean",
                                        "description": "Turn on / off.",
                                        "example": true
                                    },
                                    "regen_secret": {
                                        "type": "boolean",
                                        "description": "Generate a new signing secret.",
                                        "example": false
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Name.",
                                        "example": "Keitaro v2"
                                    },
                                    "currency": {
                                        "type": "string",
                                        "description": "Payout currency.",
                                        "example": "USD"
                                    }
                                }
                            }
                        },
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url_template": {
                                        "type": "string",
                                        "description": "New URL.",
                                        "example": "https://tracker.example.com/v2?subid={click_id}"
                                    },
                                    "active": {
                                        "type": "boolean",
                                        "description": "Turn on / off.",
                                        "example": true
                                    },
                                    "regen_secret": {
                                        "type": "boolean",
                                        "description": "Generate a new signing secret.",
                                        "example": false
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Name.",
                                        "example": "Keitaro v2"
                                    },
                                    "currency": {
                                        "type": "string",
                                        "description": "Payout currency.",
                                        "example": "USD"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "postback_delete",
                "tags": [
                    "postbacks"
                ],
                "summary": "Delete a postback",
                "description": "Scope: `postbacks`",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Resource ID.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 7,
                                        "deleted": true
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/postbacks/test": {
            "post": {
                "operationId": "postback_test",
                "tags": [
                    "postbacks"
                ],
                "summary": "Send a real test request to your URL",
                "description": "Scope: `postbacks`",
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Repeat-safe POST: the same key within 24h returns the first result.",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "success": true,
                                        "http_code": 200,
                                        "ms": 143,
                                        "error": "",
                                        "request": {
                                            "method": "GET",
                                            "url": "https://tracker.example.com/pb?subid=TEST-123",
                                            "body": "",
                                            "headers": []
                                        },
                                        "response": {
                                            "headers": {
                                                "content-type": "text/plain"
                                            },
                                            "body": "OK"
                                        },
                                        "unknown_macros": []
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url_template": {
                                        "type": "string",
                                        "description": "URL with macros (sample values are filled in). Required unless postback_id is sent.",
                                        "example": "https://tracker.example.com/pb?subid={click_id}"
                                    },
                                    "postback_id": {
                                        "type": "integer",
                                        "description": "Test a saved postback instead.",
                                        "example": 0
                                    },
                                    "event": {
                                        "type": "string",
                                        "description": "Event for sample values.",
                                        "example": "subscribe"
                                    },
                                    "method": {
                                        "type": "string",
                                        "description": "GET | POST.",
                                        "example": "GET"
                                    },
                                    "click_id": {
                                        "type": "string",
                                        "description": "Click ID to put into {click_id}.",
                                        "example": "TEST-123"
                                    },
                                    "payout": {
                                        "type": "number",
                                        "description": "Sample payout (AZN).",
                                        "example": 0.5
                                    }
                                }
                            }
                        },
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url_template": {
                                        "type": "string",
                                        "description": "URL with macros (sample values are filled in). Required unless postback_id is sent.",
                                        "example": "https://tracker.example.com/pb?subid={click_id}"
                                    },
                                    "postback_id": {
                                        "type": "integer",
                                        "description": "Test a saved postback instead.",
                                        "example": 0
                                    },
                                    "event": {
                                        "type": "string",
                                        "description": "Event for sample values.",
                                        "example": "subscribe"
                                    },
                                    "method": {
                                        "type": "string",
                                        "description": "GET | POST.",
                                        "example": "GET"
                                    },
                                    "click_id": {
                                        "type": "string",
                                        "description": "Click ID to put into {click_id}.",
                                        "example": "TEST-123"
                                    },
                                    "payout": {
                                        "type": "number",
                                        "description": "Sample payout (AZN).",
                                        "example": 0.5
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/postbacks/logs": {
            "get": {
                "operationId": "postback_logs",
                "tags": [
                    "postbacks"
                ],
                "summary": "Delivery log of your postbacks",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Start date (YYYY-MM-DD). Default: 6 days before \"to\".",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-11-01"
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "End date (YYYY-MM-DD). Default: today.",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        },
                        "example": "2026-11-30"
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "sent | failed | retry | queued.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "failed"
                    },
                    {
                        "name": "click_id",
                        "in": "query",
                        "required": false,
                        "description": "Filter by click ID (within the date range).",
                        "schema": {
                            "type": "string"
                        },
                        "example": ""
                    },
                    {
                        "name": "postback_id",
                        "in": "query",
                        "required": false,
                        "description": "Only this postback.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 7
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Items per page (1–500, default 100).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 100
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number (default 1).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "id": 55012,
                                            "postback_id": 7,
                                            "event": "subscribe",
                                            "click_id": "c7b36020-1931-4734-86c3-268e2fa9a791",
                                            "url": "https://tracker.example.com/pb?subid=c7b3…",
                                            "status": "sent",
                                            "attempts": 1,
                                            "http_code": 200,
                                            "error": "",
                                            "ms": 120,
                                            "payout": 0.85,
                                            "created_at": "2026-12-03 14:21:30",
                                            "sent_at": "2026-12-03 14:21:31"
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/postbacks/events": {
            "get": {
                "operationId": "postback_events",
                "tags": [
                    "postbacks"
                ],
                "summary": "Events and macros available to you",
                "description": "Scope: `read`",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "events": [
                                            "subscribe",
                                            "rebill",
                                            "unsubscribe"
                                        ],
                                        "macros": [
                                            "{click_id}",
                                            "{payout}",
                                            "{currency}",
                                            "{sub1}",
                                            "{operator}",
                                            "{country}",
                                            "{date}",
                                            "{timestamp}"
                                        ],
                                        "currencies": [
                                            "USD",
                                            "AZN",
                                            "EUR"
                                        ],
                                        "signature": {
                                            "header": "X-Alo-Signature"
                                        }
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/withdrawals": {
            "get": {
                "operationId": "withdrawals",
                "tags": [
                    "finance"
                ],
                "summary": "Withdrawal history",
                "description": "Scope: `read`",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "pending | approved | paid | rejected | cancelled.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "paid"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Items per page (1–200, default 50).",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 50
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 1
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "id": 120,
                                            "method": "bank",
                                            "account": "AZ21 •••• 5512",
                                            "amount": 500.0,
                                            "fee": 0.0,
                                            "net": 500.0,
                                            "currency": "USD",
                                            "status": "paid",
                                            "reference": "TRX-88120",
                                            "created_at": "2026-11-30 10:00:00",
                                            "paid_at": "2026-12-01 12:00:00"
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "withdrawal_create",
                "tags": [
                    "finance"
                ],
                "summary": "Request a payout (IP-restricted keys only)",
                "description": "Scope: `payouts`",
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": false,
                        "description": "Repeat-safe POST: the same key within 24h returns the first result.",
                        "schema": {
                            "type": "string",
                            "maxLength": 64
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 121,
                                        "method": "bank",
                                        "account": "AZ21 •••• 5512",
                                        "amount": 250.0,
                                        "fee": 0.0,
                                        "net": 250.0,
                                        "currency": "USD",
                                        "status": "pending",
                                        "reference": "",
                                        "created_at": "2026-12-03 18:00:00",
                                        "paid_at": null
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "amount": {
                                        "type": "number",
                                        "description": "Amount in your account currency.",
                                        "example": 250.0
                                    },
                                    "method_id": {
                                        "type": "integer",
                                        "description": "From GET /payout-methods.",
                                        "example": 3
                                    },
                                    "note": {
                                        "type": "string",
                                        "description": "Note.",
                                        "example": ""
                                    },
                                    "code": {
                                        "type": "string",
                                        "description": "2FA code if your account requires it.",
                                        "example": "123456"
                                    }
                                },
                                "required": [
                                    "amount",
                                    "method_id"
                                ]
                            }
                        },
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "amount": {
                                        "type": "number",
                                        "description": "Amount in your account currency.",
                                        "example": 250.0
                                    },
                                    "method_id": {
                                        "type": "integer",
                                        "description": "From GET /payout-methods.",
                                        "example": 3
                                    },
                                    "note": {
                                        "type": "string",
                                        "description": "Note.",
                                        "example": ""
                                    },
                                    "code": {
                                        "type": "string",
                                        "description": "2FA code if your account requires it.",
                                        "example": "123456"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/payout-methods": {
            "get": {
                "operationId": "payout_methods",
                "tags": [
                    "finance"
                ],
                "summary": "Your saved payout methods (masked)",
                "description": "Scope: `read`",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": [
                                        {
                                            "id": 3,
                                            "type": "bank",
                                            "label": "Kapital Bank",
                                            "account": "AZ21 •••• 5512",
                                            "default": true,
                                            "status": "active",
                                            "usable": true,
                                            "usable_after": null
                                        }
                                    ],
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/withdrawals/{id}": {
            "delete": {
                "operationId": "withdrawal_cancel",
                "tags": [
                    "finance"
                ],
                "summary": "Cancel a pending payout request",
                "description": "Scope: `payouts`",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "Resource ID.",
                        "schema": {
                            "type": "integer"
                        },
                        "example": 42
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "ok": true,
                                    "data": {
                                        "id": 121,
                                        "status": "cancelled"
                                    },
                                    "meta": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer",
                "description": "Authorization: Bearer alo_live_…  (or X-Api-Key header)"
            }
        },
        "responses": {
            "Error": {
                "description": "Error",
                "content": {
                    "application/json": {
                        "example": {
                            "ok": false,
                            "error": {
                                "code": "INVALID_API_KEY",
                                "message": "API key is missing, invalid or revoked."
                            }
                        }
                    }
                }
            }
        }
    }
}