# Get orchestrations stats

## Stats

> Get statistics about an orchestration.

```json
{"openapi":"3.1.0","info":{"title":"Batch - REST API","version":"2.9"},"tags":[],"servers":[{"url":"https://api.batch.com/{version}","description":"production","variables":{"version":{"default":"2.10","description":"Version of the API"}}}],"security":[{"rest_key":[]}],"components":{"securitySchemes":{"rest_key":{"type":"http","scheme":"bearer","description":"## API Key Authentication\n\nAuthentication is required in order to interact with Batch's APIs.\n\nBatch implements authentication using API Keys, that we call the \"REST API Key\".\nYou can find it on your dashboard.\n\nPlease make sure that you keep this key secret. You should never use it in client apps to call APIs from there as it would\neasily be extractable.\n\n### How to authenticate\n\nIn order to authenticate your requests, add your REST API Key in the `Authorization` header and prefix it by `Bearer`. Example: `Authorization: Bearer bcd38d9rfb38ra28`.\n"}},"parameters":{"HeaderProjectKey":{"in":"header","name":"X-Batch-Project","description":"The unique project key, identifying a project on the Batch platform","schema":{"type":"string"},"required":true}},"schemas":{"CampaignRecurringAndWarmupStats":{"type":"object","title":"Campaign, Recurring and Warmup Stats","description":"Statistics about a Campaign, Recurring or Warmup orchestration.","properties":{"id":{"type":"string","description":"Unique identifier for the orchestration."},"details":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/StatsDetails"},{"type":"object","properties":{"date":{"type":"string","format":"date","description":"Date of the statistic."},"platform":{"$ref":"#/components/schemas/StatsPlatform"},"versions":{"type":"array","description":"Statistics about each version of the orchestration when A/B testing.","items":{"allOf":[{"$ref":"#/components/schemas/StatsDetails"},{"type":"object","properties":{"version":{"type":"string","description":"The version identifier, ranging from `a` to `d`."},"platform":{"$ref":"#/components/schemas/StatsPlatform"}}}]}}}}]}}}},"StatsDetails":{"type":"object","properties":{"sent":{"type":"integer","description":"Number of messages sent."},"delivered":{"type":"integer","description":"Number of messages delivered."},"sent_optin":{"type":"integer","description":"Number of messages sent to opt-in users."},"unique_open":{"type":"integer","description":"Number of unique open of the message."},"unique_direct_open":{"type":"integer","description":"Number of unique direct open of the message."},"total_open":{"type":"integer","description":"Total number of opened messages."},"unique_machine_open":{"type":"integer","description":"Number of unique machine open of the message."},"unique_click":{"type":"integer","description":"Number of unique click on the message."},"total_click":{"type":"integer","description":"Total number of clicks on the message."},"spam":{"type":"integer","description":"Number of messages flagged as spam."},"unsubscribe":{"type":"integer","description":"Number of unsubscription from the message."},"total_bounce":{"type":"integer","description":"Total number of rejected messages."},"skipped":{"type":"integer","description":"Total number of skipped messages."},"unique_conversion":{"type":"integer","description":"Number of unique conversions attributed to the message."},"total_conversion":{"type":"integer","description":"Total number of conversions attributed to the message."},"total_revenue":{"type":"number","format":"float","description":"Total revenue attributed to the message."},"revenue_per_mille":{"type":"number","format":"float","description":"Revenue generated per thousand messages sent."},"dismissed":{"type":"integer","description":"Number of times the push notification was dismissed by the user."},"displayed":{"type":"integer","description":"Number of in-app messages displayed as a result of a push notification click. Only present for push notification orchestrations."}}},"StatsPlatform":{"type":"array","description":"Statistics broken down by platform.","items":{"allOf":[{"type":"object","properties":{"platform":{"type":"string","description":"The platform name.","enum":["ANDROID","IOS","WEB"]}}},{"$ref":"#/components/schemas/StatsDetails"}]}},"TriggerAutomationStats":{"type":"object","title":"Trigger Automation Stats","description":"Statistics about a Trigger Automation orchestration.","properties":{"id":{"type":"string","description":"Unique identifier for the orchestration."},"details":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/StatsDetails"},{"type":"object","properties":{"date":{"type":"string","format":"date","description":"Date of the statistic."},"platform":{"$ref":"#/components/schemas/StatsPlatform"},"message_steps":{"type":"array","description":"Statistics about each message steps.","items":{"allOf":[{"$ref":"#/components/schemas/StatsDetails"},{"type":"object","properties":{"step_id":{"type":"string","description":"The API identifier of the step."},"platform":{"$ref":"#/components/schemas/StatsPlatform"}}}]}}}}]}}}},"InAppStats":{"type":"object","title":"InApp Stats","description":"Statistics about an InApp Orchestration.","properties":{"id":{"type":"string","description":"Unique identifier for the orchestration."},"details":{"type":"array","items":{"properties":{"date":{"type":"string","format":"date","description":"Date of the statistic."},"delivered":{"type":"number","description":"Number of delivered mobile landings."},"unique_click":{"type":"number","description":"Number of unique clicks on the mobile landing."},"total_click":{"type":"number","description":"Total number of clicks on the mobile landing."},"dismissed":{"type":"number","description":"Number of times the mobile landing was dismissed."},"versions":{"type":"array","description":"Statistics about each version of the orchestration when A/B testing.","items":{"type":"object","properties":{"delivered":{"type":"number","description":"Number of delivered mobile landings."},"unique_click":{"type":"number","description":"Number of unique clicks on the mobile landing."},"total_click":{"type":"number","description":"Total number of clicks on the mobile landing."},"dismissed":{"type":"number","description":"Number of times the mobile landing was dismissed."}}}}}}}}},"Error":{"type":"object","required":["error_message","error_code"],"properties":{"error_message":{"description":"A human readable error message","type":"string"},"error_code":{"description":"Error code","type":"string"}}}},"responses":{"400":{"description":"The request is malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The Rest API Key is not valid for this project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Batch's services are under maintenance. Please try again later","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/orchestrations/stats":{"get":{"operationId":"orchestrations_stats","summary":"Stats","description":"Get statistics about an orchestration.","tags":["Orchestrations"],"parameters":[{"$ref":"#/components/parameters/HeaderProjectKey"},{"name":"orchestration_id","in":"query","description":"The id of the orchestration to fetch statistics from.","required":true,"schema":{"type":"string"}},{"name":"from","in":"query","description":"Statistics starting date in a yyyy-MM-dd format. Cannot be earlier than 6 months ago.","required":true,"schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":true,"description":"Statistics ending date in a yyyy-MM-dd format.","schema":{"type":"string","format":"date"}},{"name":"include_platforms","in":"query","description":"Boolean parameter to show optional detailed stats for each platform (`android`, `ios`, `web`) if `true`\n","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Successful response with statistics about an orchestration.","content":{"application/json":{"schema":{"type":"object","oneOf":[{"$ref":"#/components/schemas/CampaignRecurringAndWarmupStats"},{"$ref":"#/components/schemas/TriggerAutomationStats"},{"$ref":"#/components/schemas/InAppStats"}]}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"429":{"$ref":"#/components/responses/429"},"500":{"$ref":"#/components/responses/500"},"503":{"$ref":"#/components/responses/503"}}}}}}
```

### Request structure

#### Route

The orchestration API exposes a GET endpoint that allows you to export message analytics for a specific Orchestration within a defined date range. This includes metrics such as sent, open, and click counts, with daily granularity.

`/orchestrations/stats`

#### Headers and authentication

See [Overview → Using Project APIs](https://doc.batch.com/developer/api/cep/..#request-headers-and-authentication).

#### Query parameters

See the API Description.

### Responses

#### Success

A successful `GET` request to this endpoint will return an `HTTP 200 OK` response. The body of the response will contain a JSON object with the statistics for the requested orchestration over the specified date range.

#### Response Body

The main JSON object contains the following fields:

* `id` (string): The unique identifier of the orchestration for which statistics are being returned.
* `details` (array): An array of objects, where each object contains the daily statistics for a specific date. This can include:
  * Step Detail: For `trigger` orchestrations.
  * Variant Detail: For A/B tested orchestrations.

```json
{
  "id": "orchestration_0664hyh918hr1gnzka9py5t62nrc0e1q",
  "details": [
    {
      "date": "2025-03-18",
      "sent": 972,
      "delivered": 847,
      "sent_optin": 843,
      "unique_open": 214,
      "unique_direct_open": 188,
      "total_open": 259,
      "unique_machine_open": 126,
      "unique_click": 37,
      "total_click": 41,
      "spam": 4,
      "unsubscribe": 13,
      "total_bounce": 14,
      "skipped": 15,
      "unique_conversion": 12,
      "total_conversion": 15,
      "total_revenue": 149.99,
      "revenue_per_mille": 9999.33,
      "dismissed": 45,
      "displayed": 87,
      "platform": {
        "android": {
          "sent": 376,
          "delivered": 370,
          "sent_optin": 327,
          "unique_open": 285,
          "unique_direct_open": 211,
          "total_open": 85,
          "unique_machine_open": 74,
          "unique_click": 37,
          "total_click": 41,
          "total_bounce": 14,
          "unique_conversion": 7,
          "total_conversion": 9,
          "total_revenue": 68.35,
          "revenue_per_mille": 7594.44
        }
      },
      "message_steps": [
        {
          "step_id": "step_0664hyh918hr1gnzka9py5t62nrc0e1q",
          "sent": 530,
          "delivered": 465,
          "sent_optin": 459,
          "unique_open": 139,
          "unique_direct_open": 110,
          "total_open": 161,
          "unique_machine_open": 37,
          "unique_click": 14,
          "total_click": 16,
          "spam": 3,
          "unsubscribe": 10,
          "total_bounce": 4,
          "skipped": 10,
          "unique_conversion": 6,
          "total_conversion": 8,
          "total_revenue": 99.25,
          "revenue_per_mille": 12406.25,
          "dismissed": 28,
          "displayed": 52,
          "platform": {
            "android": {
              "sent": 207,
              "delivered": 204,
              "sent_optin": 180,
              "unique_open": 157,
              "unique_direct_open": 116,
              "total_open": 47,
              "unique_machine_open": 41,
              "unique_click": 20,
              "total_click": 22,
              "total_bounce": 8,
              "unique_conversion": 4,
              "total_conversion": 5,
              "total_revenue": 40,
              "revenue_per_mille": 8000
            }
          }
        },
        {
          "step_id": "step_aae13559e0493c0b350c547533f5b28f",
          "sent": 442,
          "delivered": 382,
          "sent_optin": 384,
          "unique_open": 75,
          "unique_direct_open": 58,
          "total_open": 98,
          "unique_machine_open": 89,
          "unique_click": 23,
          "total_click": 25,
          "spam": 1,
          "unsubscribe": 3,
          "total_bounce": 10,
          "skipped": 5,
          "unique_conversion": 6,
          "total_conversion": 7,
          "total_revenue": 50.74,
          "revenue_per_mille": 7248.57,
          "dismissed": 17,
          "displayed": 35,
          "platform": {
            "android": {
              "sent": 169,
              "delivered": 166,
              "sent_optin": 147,
              "unique_open": 128,
              "unique_direct_open": 95,
              "total_open": 38,
              "unique_machine_open": 33,
              "unique_click": 17,
              "total_click": 19,
              "total_bounce": 6,
              "unique_conversion": 3,
              "total_conversion": 4,
              "total_revenue": 28.35,
              "revenue_per_mille": 7087.5
            }
          }
        }
      ]
    }
  ]
}
```

#### Failure

If the GET data does not meet the API requirements you will receive an actionable error message. Contact us at <support@batch.com> if you need further support.

See the list of potential failures in the API Description.
