> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xtremepush.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Campaign stats

> Used to get statistics for campaigns over a given time period.

## OpenAPI

````json POST /analytics/campaigns_stats
{
  "openapi": "3.1.0",
  "info": {
    "title": "external-api",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.eu.xtremepush.com/api/external"
    }
  ],
  "paths": {
    "/analytics/campaigns_stats": {
      "post": {
        "summary": "Campaign stats",
        "description": "Used to get statistics for campaigns over a given time period.",
        "operationId": "analytics-campaigns-stats",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "apptoken",
                  "from",
                  "to"
                ],
                "properties": {
                  "apptoken": {
                    "type": "string",
                    "description": "Your App token"
                  },
                  "from": {
                    "type": "string",
                    "description": "Start date for the analytics query (YYYY-MM-DD)"
                  },
                  "to": {
                    "type": "string",
                    "description": "End date for the analytics query (YYYY-MM-DD)"
                  },
                  "campaign_id": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Optional. Filter by a specific campaign ID"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": "true",
                      "default": "true"
                    },
                    "code": {
                      "type": "integer",
                      "example": "200",
                      "default": "0"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "totals": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "example": "45352249"
                              },
                              "title": {
                                "type": "string",
                                "example": "Web push notification"
                              },
                              "web_push_sent": {
                                "type": "integer",
                                "example": "6",
                                "default": "0"
                              },
                              "web_push_delivered": {
                                "type": "integer",
                                "example": "6",
                                "default": "0"
                              },
                              "web_push_opened": {
                                "type": "integer",
                                "example": "1",
                                "default": "0"
                              },
                              "web_push_open_rate": {
                                "type": "number",
                                "example": "16.67",
                                "default": "0"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Totals": {
                    "value": {
                      "success": "true",
                      "code": "200",
                      "data": {
                        "totals": [
                          {
                            "id": "45352249",
                            "title": "Web push notification",
                            "web_push_sent": "6",
                            "web_push_delivered": "6",
                            "web_push_opened": "1",
                            "web_push_open_rate": "16.67"
                          },
                          {
                            "id": "47547777",
                            "title": "On site test",
                            "inweb_sent": "12",
                            "inweb_delivered": "11",
                            "inweb_opened": "0",
                            "inweb_open_rate": "0"
                          },
                          {
                            "id": "50236250",
                            "title": "email campaign",
                            "email_sent": "7",
                            "email_failed": "4",
                            "email_delivered": "3",
                            "email_unsubscribed": "0",
                            "email_complained": "0",
                            "email_opened": "2",
                            "email_clicked": "0",
                            "email_open_rate": "66.67",
                            "email_click_rate": "0"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": "false",
                      "default": "true"
                    },
                    "code": {
                      "type": "integer",
                      "example": "400",
                      "default": "0"
                    },
                    "message": {
                      "type": "string",
                      "example": "General error information"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "success": "false",
                      "code": "400",
                      "message": "General error information",
                      "errors": [
                        {
                          "text": [
                            "Detailed information about the specific error"
                          ]
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Analytics Methods"
        ]
      }
    }
  }
}
````

