# How can we help?

## Overview

The Programs API is a resource for obtaining information about [Programs](https://support.cordial.com/hc/en-us/articles/24090737365901).

**API set name: programs**

Programs endpoints are a beta feature. Please contact your CSM or Solutions representative for more information.

## Authentication

Cordial's core APIs use https Basic Authentication (BA). From within the Cordial platform, you can generate an encoded [API key for your account](https://support.cordial.com/hc/en-us/articles/115005365087) and use it for authorization.

- [Learn more about Cordial API authentication here](httpss://support.cordial.com/hc/en-us/articles/203885498-RESTful-API-summary-and-usage#authentication).

## Resource associations

The following resource collections are associated to this collection.

| Collection | Association |
| --- | --- |
| orchestrations | Programs often contain multiple Podium Orchestrations. |
| automationtemplates | Podium Orchestrations often contain multiple message automations. |

## Methods, parameters, and examples

- [GET/v2/programs/{id}/summary](https://support.cordial.com/hc/en-us/articles/32892751374477-Programs-API#h_01JFJFF4AKTQ8J9N6WVY2AG1MG)
- [GET/v2/programs/{id}/stats](https://support.cordial.com/hc/en-us/articles/32892751374477-Programs-API#01JFJGHVY4H3ZNZ45VGHA5F0AC)

## GET/v2/programs/{id}/summary

| Method | URL Path |
| --- | --- |
| GET | /v2/programs/{id}/summary |
| Validates if the Program exists and returns summary statistics for it. |

- [Example request URL](https://support.cordial.com/hc/en-us/articles/32892751374477-Programs-API#zp-1-0)
- [Example JSON response](https://support.cordial.com/hc/en-us/articles/32892751374477-Programs-API#zp-1-1)

The following URL will retrieve a summary of statistics for a Program with the ID number `65c275d8b39e087d0c009fa2`, start date `2024-12-13`, and end date `2024-12-19`.

```
https://api.cordial.io/v2/programs/65c275d8b39e087d0c009fa2/summary?start_date=2024-12-13&end_date=2024-12-19
```

The GET request returns a summary of the following statistics and Program information.

```
{
  "name": "abandon-series",
  "stats": {
    "delivered": 171666,
    "delivered_rate": 1,
    "orders": 6283,
    "clicks": 5207,
    "clicks_unique": 2640,
    "click_through_rate": 0.0303,
    "click_to_open_rate": 0.1024,
    "opt_outs": 0,
    "opt_out_rate": 0,
    "opens": 25773,
    "opens_unique": 25773,
    "open_rate": 0.1501,
    "complaints": 0,
    "complaint_rate": 0,
    "bounce_rate": 0,
    "bounce_hard": 0,
    "bounce_soft": 0,
    "bounce_total": 0
  },
  "query": {
    "start_date": "2024-12-13",
    "end_date": "2024-12-19",
    "channel_type": null,
    "channel_key": null
  },
  "ct": "2024-02-06T18:09:28.859000Z",
  "lm": "2024-02-06T18:12:37.870000Z"
}
```

## GET/v2/programs/{id}/stats

| Method | URL Path |
| --- | --- |
| GET | /v2/programs/{id}/stats |
| Validates if the Program exists and returns summary statistics for the Orchestrations and individual messages within the Program. |

- [Example request URL](https://support.cordial.com/hc/en-us/articles/32892751374477-Programs-API#zp-2-0)
- [Example JSON response](https://support.cordial.com/hc/en-us/articles/32892751374477-Programs-API#zp-2-1)

```
https://api.cordial.io/v2/programs/65c275d8b39e087d0c009fa2/stats?start_date=2024-12-13&end_date=2024-12-19
```

The GET request returns a summary of the following statistics and Program information. Standard retrieval and pagination options are available.

```
{
 "data": [\
   {\
     "message_id": "1003:7dca912dc91575e6ab5ceda678d4312d:d241213",\
     "message_name": "browse_abandon_1",\
     "message_key": "646687a2466f80_53696078",\
     "orchestration_id": "646687a21a37c7673f0a5f8e",\
     "orchestration_name": "Demo_Browse_Abandon",\
     "mdt_id": "646687a24a946a99480d23f6",\
     "subject": "Take another look",\
     "tags": [\
       "event_trigger",\
       "browse_abandon",\
       "p_2"\
     ],\
     "channel_key": "email",\
     "channel_type": "email",\
     "sent_at": "2024-12-13T05:06:01+0000",\
     "stats": {\
       "delivered": 1556,\
       "delivered_rate": 100,\
       "revenue": 36364,\
       "orders": 157,\
       "clicks": 50,\
       "clicks_unique": 24,\
       "opens": 222,\
       "opens_unique": 222,\
       "click_through_rate": 3.21,\
       "click_to_open_rate": 10.81,\
       "opt_outs": 0,\
       "opt_out_rate": 0,\
       "open_rate": 14.27,\
       "complaints": 0,\
       "complaint_rate": 0,\
       "bounce_rate": 0,\
       "bounce_hard": 0,\
       "bounce_soft": 0,\
       "bounce_total": 0\
     }\
   },\
   {\
     "message_id": "1003:e3b6af02a15dbd6791b6be18f1cc4824:d241213",\
     "message_name": "search_abandon_1",\
     "message_key": "6466867672e6d7_50094843",\
     "orchestration_id": "6466867693f23da5a106de3f",\
     "orchestration_name": "Demo_Search_Abandon",\
     "mdt_id": "646686764a946a9948fa0fff",\
     "subject": "We have what you're searching for",\
     "tags": [\
       "event_trigger",\
       "search_abandon",\
       "P_3"\
     ],\
     "channel_key": "email",\
     "channel_type": "email",\
     "sent_at": "2024-12-13T05:06:01+0000",\
     "stats": {\
       "delivered": 3820,\
       "delivered_rate": 100,\
       "revenue": 67956,\
       "orders": 283,\
       "clicks": 116,\
       "clicks_unique": 54,\
       "opens": 626,\
       "opens_unique": 626,\
       "click_through_rate": 3.04,\
       "click_to_open_rate": 8.63,\
       "opt_outs": 0,\
       "opt_out_rate": 0,\
       "open_rate": 16.39,\
       "complaints": 0,\
       "complaint_rate": 0,\
       "bounce_rate": 0,\
       "bounce_hard": 0,\
       "bounce_soft": 0,\
       "bounce_total": 0\
     }\
   }\
 ],
 "query": {
   "start_date": "2024-12-13",
   "end_date": "2024-12-19",
   "channel_type": null,
   "channel_key": null
 },
 "pagination": {
   "total": 77,
   "per_page": 15,
   "current_page": 1,
   "last_page": 6,
   "first_page_url": "http://api.cordial.io/v2/programs/65c275d8b39e087d0c009fa2/stats?page=1",
   "last_page_url": "http://api.cordial.io/v2/programs/65c275d8b39e087d0c009fa2/stats?page=6",
   "next_page_url": "http://api.cordial.io/v2/programs/65c275d8b39e087d0c009fa2/stats?page=2",
   "prev_page_url": "http://api.cordial.io/v2/programs/65c275d8b39e087d0c009fa2/stats?page=",
   "path": "http://api.cordial.io/v2/programs/65c275d8b39e087d0c009fa2/stats?page=",
   "from": 1,
   "to": 15
 }
}
```

## Error responses

You can find a full list of common error responses on the [Global API error responses](https://support.cordial.com/hc/en-us/articles/4402427843597-Global-API-Error-Responses) page.

| errorKey | Message | Modification |
| --- | --- | --- |
| `RECORD_NOT_FOUND` | Record not found. | Make sure the Podium ID number, start date, and end date are correct.
