{
  "openapi": "3.1.0",
  "info": {
    "title": "Orbito Ads API",
    "version": "1.0.0",
    "description": "Use an Orbito workspace key for your connected advertising accounts. Read, management and conversion permissions are issued separately."
  },
  "servers": [
    {
      "url": "https://orbitoads.pro/api/v1"
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/account/info": {
      "get": {
        "operationId": "listCabinets",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Cabinet"
                      }
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "read"
      }
    },
    "/campaigns": {
      "get": {
        "operationId": "listCampaigns",
        "parameters": [
          {
            "$ref": "#/components/parameters/AccountIdQuery"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "title",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bot_username",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_]{5,32}$"
            }
          },
          {
            "name": "promote_domain",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "promote_domain_mode",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "exact",
                "suffix"
              ],
              "default": "exact"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "bot",
                "channel",
                "site"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "date"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "DESC"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CampaignListItem"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "integer"
                        },
                        "cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "hasMore": {
                          "type": "boolean"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "offset": {
                          "type": "integer"
                        },
                        "truncated": {
                          "type": "boolean"
                        },
                        "next_step": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "read"
      },
      "post": {
        "operationId": "createCampaigns",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKeyRequired"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/CreateSingleRequest"
                  },
                  {
                    "$ref": "#/components/schemas/CreateBatchRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/TaskAccepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        },
        "x-access": "manage campaigns; cabinet owner/manager; current eligible plan and feature",
        "x-deduplication": "required Idempotency-Key",
        "x-completion": "task"
      }
    },
    "/campaigns/bulk": {
      "post": {
        "operationId": "bulkCampaigns",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKeyRequired"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/TaskAccepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "manage campaigns; cabinet owner/manager; current eligible plan and feature",
        "x-deduplication": "required Idempotency-Key",
        "x-completion": "task"
      }
    },
    "/campaigns/{ad_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/AdId"
        },
        {
          "$ref": "#/components/parameters/AccountIdQuery"
        }
      ],
      "get": {
        "operationId": "getCampaign",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Campaign"
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "read"
      },
      "patch": {
        "operationId": "updateCampaign",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Campaign"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "status_warning": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "status_intent_only": {
                          "type": "boolean"
                        },
                        "status_already_set": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "manage campaigns; cabinet owner/manager; current eligible plan and feature",
        "x-deduplication": "optional Idempotency-Key"
      },
      "delete": {
        "operationId": "deleteCampaign",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "ad_id": {
                          "type": "integer"
                        },
                        "account_id": {
                          "type": "integer"
                        },
                        "deleted": {
                          "const": true
                        }
                      }
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "manage campaigns; cabinet owner/manager; current eligible plan and feature",
        "x-deduplication": "optional Idempotency-Key"
      }
    },
    "/campaigns/{ad_id}/history": {
      "get": {
        "operationId": "getCampaignHistory",
        "parameters": [
          {
            "$ref": "#/components/parameters/AdId"
          },
          {
            "$ref": "#/components/parameters/AccountIdQuery"
          },
          {
            "$ref": "#/components/parameters/Period"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "$ref": "#/components/parameters/StartHour"
          },
          {
            "$ref": "#/components/parameters/EndHour"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/StatsNumbers"
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "x-access": "read"
      }
    },
    "/campaigns/{ad_id}/pause": {
      "post": {
        "operationId": "pauseCampaign",
        "parameters": [
          {
            "$ref": "#/components/parameters/AdId"
          },
          {
            "$ref": "#/components/parameters/AccountIdQuery"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/RunState"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "manage campaigns; cabinet owner/manager; current eligible plan and feature",
        "x-deduplication": "optional Idempotency-Key"
      }
    },
    "/campaigns/{ad_id}/resume": {
      "post": {
        "operationId": "resumeCampaign",
        "parameters": [
          {
            "$ref": "#/components/parameters/AdId"
          },
          {
            "$ref": "#/components/parameters/AccountIdQuery"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/RunState"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "manage campaigns; cabinet owner/manager; current eligible plan and feature",
        "x-deduplication": "optional Idempotency-Key"
      }
    },
    "/campaigns/{ad_id}/budget": {
      "post": {
        "operationId": "changeCampaignBudget",
        "parameters": [
          {
            "$ref": "#/components/parameters/AdId"
          },
          {
            "$ref": "#/components/parameters/AccountIdQuery"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyRequired"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BudgetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Campaign"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "action": {
                          "type": "string",
                          "enum": [
                            "add",
                            "withdraw",
                            "withdraw_all"
                          ]
                        },
                        "moved": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "partial": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "manage campaigns; cabinet owner/manager; current eligible plan and feature",
        "x-deduplication": "required Idempotency-Key"
      }
    },
    "/campaigns/{ad_id}/copy": {
      "post": {
        "operationId": "copyCampaign",
        "parameters": [
          {
            "$ref": "#/components/parameters/AdId"
          },
          {
            "$ref": "#/components/parameters/AccountIdQuery"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKeyRequired"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CopyRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/TaskAccepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/IdempotencyReused"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "manage campaigns; cabinet owner/manager; current eligible plan and feature",
        "x-deduplication": "required Idempotency-Key",
        "x-completion": "task"
      }
    },
    "/tasks/{id}": {
      "get": {
        "operationId": "getTask",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Task"
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "x-access": "read"
      }
    },
    "/groups": {
      "get": {
        "operationId": "listGroups",
        "parameters": [
          {
            "$ref": "#/components/parameters/AccountIdQuery"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Group"
                      }
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "x-access": "read"
      }
    },
    "/targeting": {
      "get": {
        "operationId": "getTargetingCodes",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/Targeting"
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "x-access": "read"
      }
    },
    "/media": {
      "post": {
        "operationId": "uploadMedia",
        "parameters": [
          {
            "$ref": "#/components/parameters/AccountIdQuery"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "account_id": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "media": {
                          "type": "string"
                        },
                        "account_id": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "$ref": "#/components/responses/BadRequest"
          }
        },
        "x-access": "manage campaigns; cabinet owner/manager; current eligible plan and feature",
        "x-deduplication": "optional Idempotency-Key"
      }
    },
    "/stats": {
      "get": {
        "operationId": "getStatsPerCampaign",
        "parameters": [
          {
            "$ref": "#/components/parameters/Period"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "$ref": "#/components/parameters/StartHour"
          },
          {
            "$ref": "#/components/parameters/EndHour"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "additionalProperties": {
                          "$ref": "#/components/schemas/StatsNumbers"
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "read"
      }
    },
    "/stats/total": {
      "get": {
        "operationId": "getStatsTotals",
        "parameters": [
          {
            "$ref": "#/components/parameters/Period"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "$ref": "#/components/parameters/StartHour"
          },
          {
            "$ref": "#/components/parameters/EndHour"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "read"
      }
    },
    "/stats/analytics": {
      "get": {
        "operationId": "getStatsAnalytics",
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "30d"
            }
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "$ref": "#/components/parameters/StartHour"
          },
          {
            "$ref": "#/components/parameters/EndHour"
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "read"
      }
    },
    "/postback": {
      "post": {
        "operationId": "sendConversions",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ConversionEvent"
                  },
                  {
                    "type": "object",
                    "required": [
                      "events"
                    ],
                    "properties": {
                      "events": {
                        "type": "array",
                        "maxItems": 1000,
                        "items": {
                          "$ref": "#/components/schemas/ConversionEvent"
                        }
                      }
                    }
                  },
                  {
                    "type": "array",
                    "maxItems": 1000,
                    "items": {
                      "$ref": "#/components/schemas/ConversionEvent"
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "Accepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-access": "API key; receive-postbacks enabled",
        "x-deduplication": "txid"
      }
    },
    "/ingest/{token}": {
      "get": {
        "operationId": "trackerPostback",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ref",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "event",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "txid",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "description": "Bad Request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "429": {
            "description": "Too Many Requests"
          }
        },
        "x-access": "write-only tracker token; receive-postbacks enabled",
        "x-deduplication": "txid"
      }
    },
    "/conversions": {
      "get": {
        "operationId": "listConversions",
        "parameters": [
          {
            "name": "adId",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 365
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ConversionsRow"
                      }
                    }
                  }
                }
              }
            },
            "description": "OK"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        },
        "x-access": "read"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "parameters": {
      "AdId": {
        "name": "ad_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "AccountIdQuery": {
        "name": "account_id",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "IdempotencyKeyRequired": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 8,
          "maxLength": 255
        }
      },
      "Period": {
        "name": "period",
        "in": "query",
        "schema": {
          "type": "string",
          "default": "1d"
        }
      },
      "StartDate": {
        "name": "startDate",
        "in": "query",
        "schema": {
          "type": "string",
          "format": "date"
        }
      },
      "EndDate": {
        "name": "endDate",
        "in": "query",
        "schema": {
          "type": "string",
          "format": "date"
        }
      },
      "StartHour": {
        "name": "startHour",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23
        }
      },
      "EndHour": {
        "name": "endHour",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23
        }
      }
    },
    "headers": {
      "RetryAfter": {
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "TaskAccepted": {
        "headers": {
          "Location": {
            "schema": {
              "type": "string"
            }
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "const": true
                },
                "data": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          }
        },
        "description": "Accepted"
      },
      "RunState": {
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "const": true
                },
                "data": {
                  "$ref": "#/components/schemas/Campaign"
                },
                "meta": {
                  "type": "object",
                  "properties": {
                    "intent_only": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        },
        "description": "OK"
      },
      "BadRequest": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Bad Request"
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Unauthorized"
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Forbidden"
      },
      "NotFound": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Not Found"
      },
      "Conflict": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Conflict"
      },
      "IdempotencyReused": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Unprocessable Entity"
      },
      "RateLimited": {
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Too Many Requests"
      },
      "Unavailable": {
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Service Unavailable"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "success",
          "error"
        ],
        "properties": {
          "success": {
            "const": false
          },
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "param": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "min_cpm": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "limit": {
            "type": "integer"
          }
        }
      },
      "Money": {
        "type": [
          "string",
          "null"
        ]
      },
      "Cabinet": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "cabinet_type": {
            "type": "string",
            "enum": [
              "euro",
              "ton",
              "stars"
            ]
          },
          "is_active": {
            "type": "boolean"
          },
          "access_level": {
            "type": "string",
            "enum": [
              "owner",
              "manager",
              "viewer",
              "admin"
            ]
          },
          "currency": {
            "type": "string",
            "enum": [
              "EUR",
              "TON",
              "STARS"
            ]
          },
          "balance": {
            "$ref": "#/components/schemas/Money"
          },
          "balance_updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "min_budget": {
            "type": "number"
          },
          "features": {
            "type": "object",
            "properties": {
              "ad_button": {
                "type": "boolean"
              },
              "crypto_filters": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "CampaignStatus": {
        "type": "string",
        "enum": [
          "Active",
          "In Review",
          "Declined",
          "On Hold",
          "Stopped",
          "Paused",
          "Deleted"
        ]
      },
      "CampaignListItem": {
        "type": "object",
        "properties": {
          "ad_id": {
            "type": "integer"
          },
          "account_id": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/CampaignStatus"
          },
          "tme_path": {
            "type": [
              "string",
              "null"
            ]
          },
          "promote_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "views": {
            "type": "integer"
          },
          "opens": {
            "type": "integer"
          },
          "clicks": {
            "type": "integer"
          },
          "actions": {
            "type": "integer"
          },
          "spent": {
            "$ref": "#/components/schemas/Money"
          },
          "budget": {
            "$ref": "#/components/schemas/Money"
          },
          "cpm": {
            "$ref": "#/components/schemas/Money"
          },
          "cpc": {
            "$ref": "#/components/schemas/Money"
          },
          "cpa": {
            "$ref": "#/components/schemas/Money"
          },
          "ctr": {
            "type": [
              "string",
              "null"
            ]
          },
          "cvr": {
            "type": [
              "string",
              "null"
            ]
          },
          "date": {
            "type": [
              "string",
              "null"
            ]
          },
          "group_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status_changed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Campaign": {
        "type": "object",
        "properties": {
          "ad_id": {
            "type": "integer"
          },
          "account_id": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/CampaignStatus"
          },
          "active": {
            "type": "boolean"
          },
          "promote_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "tme_path": {
            "type": [
              "string",
              "null"
            ]
          },
          "target_type": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "channels",
              "bots",
              "search",
              "users",
              null
            ]
          },
          "targets": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cpm": {
            "$ref": "#/components/schemas/Money"
          },
          "budget": {
            "$ref": "#/components/schemas/Money"
          },
          "spent": {
            "$ref": "#/components/schemas/Money"
          },
          "daily_budget": {
            "type": [
              "number",
              "string",
              "null"
            ]
          },
          "views": {
            "type": "integer"
          },
          "opens": {
            "type": "integer"
          },
          "clicks": {
            "type": "integer"
          },
          "actions": {
            "type": "integer"
          },
          "ctr": {
            "type": [
              "string",
              "null"
            ]
          },
          "cvr": {
            "type": [
              "string",
              "null"
            ]
          },
          "cpc": {
            "$ref": "#/components/schemas/Money"
          },
          "cpa": {
            "$ref": "#/components/schemas/Money"
          },
          "views_per_user": {
            "type": [
              "integer",
              "null"
            ]
          },
          "schedule": {
            "$ref": "#/components/schemas/Schedule"
          },
          "has_media": {
            "type": "boolean"
          },
          "media_type": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "image",
              "video",
              null
            ]
          },
          "button": {
            "type": [
              "string",
              "null"
            ]
          },
          "website_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "group_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "auto_cpm_enabled": {
            "type": "boolean"
          },
          "date": {
            "type": [
              "string",
              "null"
            ]
          },
          "synced_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "status_changed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "CreativeFields": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "text": {
            "type": "string",
            "maxLength": 4096
          },
          "promote_url": {
            "type": "string",
            "maxLength": 2048
          },
          "cpm": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "daily_budget": {
            "type": "number",
            "minimum": 0
          },
          "views_per_user": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4
          },
          "media": {
            "type": "string"
          },
          "picture": {
            "type": "boolean"
          },
          "button": {
            "type": "string",
            "enum": [
              "subscribe",
              "view",
              "read",
              "learn_more",
              "download",
              "open",
              "sign_up",
              "buy",
              "order",
              "play",
              "try",
              "leave_request"
            ]
          },
          "website_name": {
            "type": "string",
            "maxLength": 255
          },
          "schedule": {
            "$ref": "#/components/schemas/Schedule"
          }
        }
      },
      "Schedule": {
        "type": [
          "object",
          "null"
        ],
        "required": [
          "days",
          "timezone"
        ],
        "additionalProperties": false,
        "properties": {
          "days": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "mon": {
                "$ref": "#/components/schemas/ScheduleHours"
              },
              "tue": {
                "$ref": "#/components/schemas/ScheduleHours"
              },
              "wed": {
                "$ref": "#/components/schemas/ScheduleHours"
              },
              "thu": {
                "$ref": "#/components/schemas/ScheduleHours"
              },
              "fri": {
                "$ref": "#/components/schemas/ScheduleHours"
              },
              "sat": {
                "$ref": "#/components/schemas/ScheduleHours"
              },
              "sun": {
                "$ref": "#/components/schemas/ScheduleHours"
              }
            }
          },
          "timezone": {
            "type": "string"
          }
        }
      },
      "ScheduleHours": {
        "type": "array",
        "maxItems": 24,
        "items": {
          "type": "integer",
          "minimum": 0,
          "maximum": 23
        }
      },
      "CampaignInput": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CreativeFields"
          },
          {
            "type": "object",
            "required": [
              "title",
              "text",
              "promote_url",
              "cpm",
              "budget",
              "target_type"
            ],
            "properties": {
              "title": {
                "type": "string"
              },
              "text": {
                "type": "string"
              },
              "promote_url": {
                "type": "string"
              },
              "cpm": {
                "type": "number"
              },
              "budget": {
                "type": "number",
                "minimum": 0
              },
              "active": {
                "type": "boolean",
                "default": true
              },
              "target_type": {
                "type": "string",
                "enum": [
                  "channels",
                  "bots",
                  "search",
                  "users"
                ]
              },
              "channels": {
                "type": "array",
                "minItems": 1,
                "maxItems": 100,
                "items": {
                  "type": "string"
                }
              },
              "bots": {
                "type": "array",
                "minItems": 1,
                "maxItems": 100,
                "items": {
                  "type": "string"
                }
              },
              "search_keywords": {
                "type": "array",
                "minItems": 1,
                "maxItems": 100,
                "items": {
                  "type": "string",
                  "maxLength": 64
                }
              },
              "countries": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "languages": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "topics": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "exclude_topics": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "audience_channels": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "add_similar_channels": {
                "type": "boolean"
              }
            }
          }
        ]
      },
      "GroupFields": {
        "type": "object",
        "properties": {
          "account_id": {
            "type": "integer"
          },
          "group_id": {
            "type": "integer"
          },
          "new_group_name": {
            "type": "string",
            "maxLength": 100
          }
        }
      },
      "CreateSingleRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GroupFields"
          },
          {
            "$ref": "#/components/schemas/CampaignInput"
          }
        ]
      },
      "CreateBatchRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/GroupFields"
          },
          {
            "type": "object",
            "required": [
              "campaigns"
            ],
            "properties": {
              "campaigns": {
                "type": "array",
                "minItems": 1,
                "maxItems": 100,
                "items": {
                  "$ref": "#/components/schemas/CampaignInput"
                }
              }
            }
          }
        ]
      },
      "UpdateRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CreativeFields"
          },
          {
            "type": "object",
            "minProperties": 1,
            "properties": {
              "account_id": {
                "type": "integer"
              },
              "active": {
                "type": "boolean"
              }
            }
          }
        ]
      },
      "BudgetRequest": {
        "type": "object",
        "required": [
          "action"
        ],
        "properties": {
          "account_id": {
            "type": "integer"
          },
          "action": {
            "type": "string",
            "enum": [
              "add",
              "withdraw",
              "withdraw_all"
            ]
          },
          "amount": {
            "type": "number",
            "exclusiveMinimum": 0
          }
        }
      },
      "CopyRequest": {
        "type": "object",
        "properties": {
          "account_id": {
            "type": "integer"
          },
          "copies": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 1
          },
          "title": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "promote_url": {
            "type": "string"
          },
          "cpm": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "budget": {
            "type": "number",
            "minimum": 0
          },
          "media": {
            "type": "string"
          },
          "picture": {
            "type": "boolean"
          },
          "views_per_user": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4
          },
          "schedule": {
            "$ref": "#/components/schemas/Schedule"
          },
          "group_id": {
            "type": "integer"
          },
          "new_group_name": {
            "type": "string"
          }
        }
      },
      "BulkRequest": {
        "type": "object",
        "required": [
          "action",
          "ad_ids"
        ],
        "properties": {
          "account_id": {
            "type": "integer"
          },
          "action": {
            "type": "string",
            "enum": [
              "pause",
              "resume",
              "add_budget",
              "withdraw_budget",
              "withdraw_all_budget",
              "set_cpm",
              "set_schedule",
              "delete"
            ]
          },
          "ad_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1000,
            "items": {
              "type": "integer"
            }
          },
          "amount": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "cpm": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "schedule": {
            "$ref": "#/components/schemas/Schedule"
          }
        }
      },
      "Task": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "type": {
            "type": "string",
            "enum": [
              "create",
              "copy",
              "status",
              "budget",
              "cpm",
              "delete",
              "edit",
              "recreate"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "paused",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "account_id": {
            "type": "integer"
          },
          "progress": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "succeeded": {
            "type": [
              "integer",
              "null"
            ]
          },
          "failed": {
            "type": [
              "integer",
              "null"
            ]
          },
          "ad_ids": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "errors": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "object",
              "properties": {
                "ad_id": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "index": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "paused_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Group": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "account_id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          }
        }
      },
      "Targeting": {
        "type": "object",
        "properties": {
          "countries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "topics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "buttons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "StatsNumbers": {
        "type": "object",
        "properties": {
          "views": {
            "type": "number"
          },
          "clicks": {
            "type": "number"
          },
          "actions": {
            "type": "number"
          },
          "spent": {
            "type": "number"
          },
          "ctr": {
            "type": "number"
          },
          "cpm": {
            "type": "number"
          },
          "cpa": {
            "type": "number"
          },
          "group_id": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      },
      "ConversionEvent": {
        "type": "object",
        "required": [
          "event",
          "txid"
        ],
        "properties": {
          "ref": {
            "type": "string",
            "maxLength": 512
          },
          "invite_link": {
            "type": "string"
          },
          "event": {
            "type": "string"
          },
          "txid": {
            "type": "string",
            "maxLength": 128
          },
          "amount": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "maxLength": 64
          },
          "event_time": {
            "type": [
              "string",
              "integer"
            ]
          },
          "account_id": {
            "type": "integer"
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "ConversionsRow": {
        "type": "object",
        "properties": {
          "account_id": {
            "type": "integer"
          },
          "ad_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "leads": {
            "type": "integer"
          },
          "conversions": {
            "type": "integer"
          },
          "purchases": {
            "type": "integer"
          },
          "revenue": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          }
        }
      }
    }
  }
}
