{
  "openapi": "3.0.3",
  "info": {
    "title": "Traffic Creator Reporting API",
    "version": "1.0.0",
    "description": "Read-only, account-scoped reporting. API keys allow 60 reads/minute; accounts allow 4 concurrent reads. Requests are also subject to shared account and IP limits."
  },
  "servers": [
    {
      "url": "https://traffic-creator.com"
    }
  ],
  "paths": {
    "/api/v1/reporting/balance": {
      "get": {
        "summary": "Read your remaining credits",
        "parameters": [],
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "credits": {
                      "type": "object",
                      "properties": {
                        "economy": {
                          "type": "number"
                        },
                        "professional": {
                          "type": "number"
                        },
                        "expert": {
                          "type": "number"
                        },
                        "seo": {
                          "type": "number"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Access denied"
          },
          "404": {
            "description": "Campaign not found"
          },
          "422": {
            "description": "Invalid parameters"
          },
          "429": {
            "description": "Rate or concurrency limit exceeded; respect Retry-After"
          },
          "503": {
            "description": "Protection temporarily unavailable; respect Retry-After"
          }
        }
      }
    },
    "/api/v1/reporting/campaigns": {
      "get": {
        "summary": "List your campaigns",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "description": "next_cursor from the previous response"
          }
        ],
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "tier": {
                            "type": "string"
                          },
                          "total_target": {
                            "type": "integer"
                          },
                          "total_hits": {
                            "type": "integer"
                          },
                          "hits_today": {
                            "type": "integer"
                          },
                          "daily_limit": {
                            "type": "integer"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true
                          },
                          "expires_at": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true
                          }
                        }
                      }
                    },
                    "next_cursor": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Access denied"
          },
          "404": {
            "description": "Campaign not found"
          },
          "422": {
            "description": "Invalid parameters"
          },
          "429": {
            "description": "Rate or concurrency limit exceeded; respect Retry-After"
          },
          "503": {
            "description": "Protection temporarily unavailable; respect Retry-After"
          }
        }
      }
    },
    "/api/v1/reporting/campaigns/{project_id}": {
      "get": {
        "summary": "Read your campaign",
        "parameters": [
          {
            "name": "project_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "tier": {
                      "type": "string"
                    },
                    "total_target": {
                      "type": "integer"
                    },
                    "total_hits": {
                      "type": "integer"
                    },
                    "hits_today": {
                      "type": "integer"
                    },
                    "daily_limit": {
                      "type": "integer"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Access denied"
          },
          "404": {
            "description": "Campaign not found"
          },
          "422": {
            "description": "Invalid parameters"
          },
          "429": {
            "description": "Rate or concurrency limit exceeded; respect Retry-After"
          },
          "503": {
            "description": "Protection temporarily unavailable; respect Retry-After"
          }
        }
      }
    },
    "/api/v1/reporting/campaigns/{project_id}/daily": {
      "get": {
        "summary": "Daily campaign delivery",
        "parameters": [
          {
            "name": "project_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 30
            }
          }
        ],
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "timezone": {
                      "type": "string",
                      "enum": [
                        "UTC"
                      ]
                    },
                    "days": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "visitors": {
                            "type": "integer"
                          },
                          "pageviews": {
                            "type": "integer"
                          },
                          "date": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Access denied"
          },
          "404": {
            "description": "Campaign not found"
          },
          "422": {
            "description": "Invalid parameters"
          },
          "429": {
            "description": "Rate or concurrency limit exceeded; respect Retry-After"
          },
          "503": {
            "description": "Protection temporarily unavailable; respect Retry-After"
          }
        }
      }
    },
    "/api/v1/reporting/campaigns/{project_id}/hourly": {
      "get": {
        "summary": "Hourly campaign delivery",
        "parameters": [
          {
            "name": "project_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hours",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 168,
              "default": 24
            }
          }
        ],
        "security": [
          {
            "APIKeyHeader": []
          },
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "timezone": {
                      "type": "string",
                      "enum": [
                        "UTC"
                      ]
                    },
                    "hours": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "hour": {
                            "type": "string"
                          },
                          "visitors": {
                            "type": "integer"
                          },
                          "pageviews": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Access denied"
          },
          "404": {
            "description": "Campaign not found"
          },
          "422": {
            "description": "Invalid parameters"
          },
          "429": {
            "description": "Rate or concurrency limit exceeded; respect Retry-After"
          },
          "503": {
            "description": "Protection temporarily unavailable; respect Retry-After"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "APIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}