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

# Revenue Report

export const EndpointBadge = ({method = "GET", children}) => {
  const METHOD_STYLES = {
    GET: {
      bg: "mint-bg-[#2AB673]"
    },
    POST: {
      bg: "mint-bg-[#3064E3]"
    },
    PUT: {
      bg: "mint-bg-[#C28C30]"
    },
    PATCH: {
      bg: "mint-bg-[#DA622B]"
    },
    DELETE: {
      bg: "mint-bg-[#CB3A32]"
    },
    API: {
      bg: "mint-bg-black"
    }
  };
  const key = method.toUpperCase();
  const styles = METHOD_STYLES[key] ?? METHOD_STYLES.API;
  return <div className="relative mt-7">
      <span className={`absolute -top-2 -left-2 z-10 ${styles.bg} text-white px-2.5 py-0.5 rounded-full text-xs font-bold tracking-wide`}>
        {key}
      </span>
      {children}
    </div>;
};

Supply Side Revenue Report (v2)

The revenue report serves as a vital tool for supply account owners, such as retailers, enabling them to grasp the origins of their retail media revenue. It offers comprehensive visibility across all advertisers, media platforms, and sales channels, encompassing direct, indirect, and private market avenues.

This report delves into crucial aspects, including generated revenue, delivered impressions, clicks, average rates, and overall performance metrics. Through this API only, supply partners gain the ability to construct detailed reports by accessing a myriad of metrics and dimensions, empowering them with actionable insights to optimize their strategies effectively.

## Endpoints

The report generation uses an asynchronous endpoint that is used to receive the report creation request (using a POST request); then, using the report `id` generated, it's possible to check the report status and download the output results using the following GET endpoint requests.

| Verb     | Endpoint                        | Description                                |
| -------- | ------------------------------- | ------------------------------------------ |
| **POST** | `/retail-media/reports/revenue` | Request a retailer revenue report creation |
| **GET**  | `/reports/{reportId}/status`    | Get status of a specific report            |
| **GET**  | `/reports/{reportId}/output`    | Download output of a specific report       |

## Attributes

| Attribute                | Data Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------------------ | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                     | string        | Supply Account ID to pull results forNote: for apps with access to multiple supply accounts, it is also possible to use an `ids` array for multiple IDs, allowing to pull results across multiple accounts. e.g. `"ids":["supplyAccountId_1","supplyAccountId_2"]`Accepted values: int64 Writeable? N / Nullable? N                                                                                                                                                                                                                                             |
| `reportType`             | enum          | Report types are pre-packaged reports that allow the specification of the report breakdown. They enable reports to view revenue distribution by advertiser, brand, environment, page category, and page type. The metrics and dimensions in these report types are limited. Use the `metrics` and `dimensions` arrays to build your report for additional fields.- \*Note\*\*: when metrics and dimensions are used, the report type is ignored.Accepted values: `advertiser`, `brand`, `environment`, `productCategory`, `pageType` Writeable? N / Nullable? Y |
| `revenueType`            | enum          | The revenue type used to filter report results. If the revenue type filter is not specified, the report will return all existing revenue data for sponsored products and preferred deals within the specified timeframe.Accepted values: `auction`, `preferred` Writeable? N / Nullable? Y                                                                                                                                                                                                                                                                      |
| `soldBy`                 | enum          | The sales channel of indirect sold, direct sold, or private market. This is an optional filter that can be used to narrow down results.Accepted values: `directSold`, `indirectSold`, `privateMarket` Writeable? N / Nullable? Y                                                                                                                                                                                                                                                                                                                                |
| `buyType`                | enum          | The campaign buying strategy. This optional filter can be used to filter down resultsAccepted values: `auction`, `preferredDeals`, `sponsorship` Writeable? N / Nullable? Y                                                                                                                                                                                                                                                                                                                                                                                     |
| `skuRelations`           | enum          | The attributed rule used to match an impression/click to a sale. The filter will narrow down results of the attributed rules set by the advertiser at the campaign level.Accepted values: `sameSku`, `sameParentSku`, `sameCategory`, `sameBrand`, `sameSeller` Writeable? N / Nullable? N                                                                                                                                                                                                                                                                      |
| `format`                 | enum          | The format type the report should return resultsAccepted values: `json`, `json-compact`, `json-newline`, `csv` Writeable? N / Nullable? N                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `campaignType`           | enum          | The campaign type to filter resultsAccepted values: `all`, `sponsoredProducts`, `onSiteDisplays` Default: `all` Writeable? N / Nullable? N                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `salesChannel`           | enum          | The sales channel where attributed sales originatedAccepted values: `all`, `online`, `offline` Default: `all` Writeable? N / Nullable? N                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `advertiserTypes`        | list\<string> | The advertiser type where campaigns originated fromAccepted values: `retailer`, `brand`, `seller` Writeable? N / Nullable? N                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `clickAttributionWindow` | enum          | The post-click attribution window, defined as the maximum number of days considered between a click and a conversion for attribution; conversions are attributed to the date of conversion, not the date of click. Defaults to campaign settings if omitted; must be specified if `viewAttributionWindow` is one of the accepted values.Accepted values: `none`, `7D`, `14D`, `30D` Writeable? N / Nullable? Y                                                                                                                                                  |
| `viewAttributionWindow`  | enum          | The post-view attribution window, defined as the maximum number of days considered between an impression and a conversion for attribution; conversions are attributed to the date of conversion, not the date of impression. Defaults to campaign settings if omitted; must be less than or equal to `clickAttributionWindow`; must be specified if `clickAttributionWindow` is one of the accepted values.Accepted values: `none`, `1D`, `7D`, `14D`, `30D` Writeable? N / Nullable? Y                                                                         |
| `dimensions`             | list\<enum>   | An array of strings used to define which dimensions to see in the reportAccepted values: refer to [Metrics and Dimensions](/retail-media/v2025.01/docs/metrics-and-dimensions) for the complete list of supported dimensions Writeable? N / Nullable? Y                                                                                                                                                                                                                                                                                                         |
| `metrics`                | list\<enum>   | An array of strings used to define which metrics to see in the reportAccepted values: refer to [Metrics and Dimensions](/retail-media/v2025.01/docs/metrics-and-dimensions) for the complete list of supported metrics Writeable? N / Nullable? Y                                                                                                                                                                                                                                                                                                               |
| `startDate`              | timestamp     | Start date of the report (inclusive)Accepted values: `yyyy-mm-ddThh:mm:ss`(in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) ) Writeable? N / Nullable? N                                                                                                                                                                                                                                                                                                                                                                                                   |
| `endDate`                | timestamp     | End date of the report (inclusive)Accepted values: `yyyy-mm-ddThh:mm:ss`(in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) ) Writeable? N / Nullable? N                                                                                                                                                                                                                                                                                                                                                                                                     |
| `timezone`               | string        | Time zone to consider in the metrics calculation,`startDate` and `endDate`Accepted values: [IANA (TZ database)](https://www.iana.org/time-zones) time zones (example: `America/New_York`, `Europe/Paris`, `Asia/Tokyo`, `UTC`) Default: `UTC` Writeable? N / Nullable? Y                                                                                                                                                                                                                                                                                        |

<Info>
  **Metrics and Dimensions**

  For a complete list of all supported metrics and dimension, check out the [Metrics and Dimensions](/retail-media/v2025.01/docs/metrics-and-dimensions-ssp)
</Info>

## Generate Revenue Report

<EndpointBadge method="post">
  ```http theme={null}
  https://api.criteo.com/{version}/retail-media/reports/revenue
  ```
</EndpointBadge>

**Sample Request**

<CodeGroup>
  ```bash cURL expandable theme={null}
  curl -L 'https://api.criteo.com/{version}/retail-media/reports/revenue' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer <MY_ACCESS_TOKEN>' \
  -d '{
    "data": {
          "type": "SSPRevenueReport",
          "attributes": {
            "id": "203209148566716416",
            "revenueType": "auction",
            "soldBy": "directSold",
            "buyType": "auction",
            "skuRelations": [
              "sameSku"
            ],
            "format": "json",
            "campaignType": "sponsoredProducts",
            "salesChannel": "online",
            "clickAttributionWindow": "7D",
            "viewAttributionWindow": "1D",
            "dimensions": [
                "date",
                "hour",
                "advertiserType",
                "accountName",
                "campaignName",
                "activityType",
                "advProductId",
                "advProductName",
                "placementName",
                "taxonomy1Name",
                "taxonomy2Name",
                "taxonomy3Name"      
            ],
            "metrics": [
                "numberOfCampaigns",
                "numberOfSkus",
                "clicks",
                "units",
                "ctr",
                "cr",
                "workingMedia",
                "netRevenue"
            ],
            "startDate": "2024-04-10T21:14:53.816Z",
            "endDate": "2024-04-10T21:14:53.816Z",
            "timezone": "UTC"
       	 }
      }
    }
  }'
  ```
</CodeGroup>

**Sample Response**

<CodeGroup>
  ```json JSON theme={null}
  {
      "data": {
          "type": "RetailMediaReportStatus",
          "id": "22fa642d-ab8a-463c-a2f6-fb174c2f72dd",
          "attributes": {
              "status": "pending",
              "rowCount": null,
              "fileSizeBytes": null,
              "md5Checksum": null,
              "createdAt": null,
              "expiresAt": null,
              "message": null
          }
      }
  }
  ```
</CodeGroup>

## Get status of specific report

<EndpointBadge method="get">
  ```http theme={null}
  https://api.criteo.com/{version}/retail-media/reports/{reportId}/status
  ```
</EndpointBadge>

**Sample Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl -L 'https://api.criteo.com/{version}/retail-media/reports/22fa642d-ab8a-463c-a2f6-fb174c2f72dd/status' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer <MY_ACCESS_TOKEN>'
  ```
</CodeGroup>

**Sample Response**

<CodeGroup>
  ```json JSON theme={null}
  {
      "data": {
          "type": "RetailMediaReportStatus",
          "id": "22fa642d-ab8a-463c-a2f6-fb174c2f72dd",
          "attributes": {
              "status": "success",
              "rowCount": 2,
              "fileSizeBytes": 341,
              "md5Checksum": "f43cf2503a31a100f7b81db3c14d3fae",
              "createdAt": "2023-07-10T16:00:32.000Z",
              "expiresAt": "2023-07-17T16:00:32.000Z",
              "message": null
          }
      }
  }
  ```
</CodeGroup>

## Download Output of a Specific Report

<EndpointBadge method="get">
  ```http theme={null}
  https://api.criteo.com/{version}/retail-media/reports/{reportId}/output
  ```
</EndpointBadge>

**Sample Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.criteo.com/{version}/retail-media/reports/2e733b8c-9983-4237-aab9-17a42f426xx/output" \
      -H "Authorization: Bearer <MY_ACCESS_TOKEN>"
  ```
</CodeGroup>

**Sample Responses**

*Report broken down by advertiser by JSON format*

<CodeGroup>
  ```json JSON expandable theme={null}
  [
      {
          "date": "2024-04-10",
          "hour": 15,
          "advertiserType":"seller",
          "accountName": "Account A",
          "campaignName": "CampaignABC",
          "placementName": "viewSearchResult",
          "activityType": "imp",
          "advProductId": "14364409",
          "advProductName": "360 Deluxe (PC/Mac) - 5 Devices",
          "taxonomy1Name": "computers & tablets",
          "taxonomy2Name": "software",
          "taxonomy3Name": "antivirus, security & utility software",
          "numberOfCampaigns": 1,
          "numberOfSkus": 1,
          "clicks": 0,
          "units": 1,
          "ctr": null,
          "cr": null,
          "workingMedia": 0,
          "netRevenue": 0
      },
      {
          "date": "2024-04-10",
          "hour": 11,
          "advertiserType":"brand",
          "accountName": "Account A",
          "campaignName": "CampaignXYZ",
          "placementName": "viewSearchResult",
          "activityType": "click",
          "advProductId": "15325425",
          "advProductName": "Mini On-Ear Bluetooth Kids Headphones - Pink",
          "taxonomy1Name": "audio",
          "taxonomy2Name": "headphones",
          "taxonomy3Name": "over-ear headphones",
          "numberOfCampaigns": 1,
          "numberOfSkus": 1,
          "clicks": 0,
          "units": 1,
          "ctr": null,
          "cr": null,
          "workingMedia": 0,
          "netRevenue": 0
      },
      {
          "date": "2024-04-10",
          "hour": 10,
          "advertiserType":"seller",
          "accountName": "Account B",
          "campaignName": "CampaignDEF",
          "placementName": "viewItem_API",
          "activityType": "imp",
          "advProductId": "17701444",
          "advProductName": "City Pro Electric Scooter",
          "taxonomy1Name": "sports, recreation & transportation",
          "taxonomy2Name": "electric transportation",
          "taxonomy3Name": "electric scooters",
          "numberOfCampaigns": 1,
          "numberOfSkus": 1,
          "clicks": 0,
          "units": 1,
          "ctr": null,
          "cr": null,
          "workingMedia": 0,
          "netRevenue": 0
      }
  ]
  ```
</CodeGroup>

## Responses

<table>
  <thead>
    <tr>
      <th>
        Response
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        🔵  `200`
      </td>

      <td>
        Call executed with success
      </td>
    </tr>

    <tr>
      <td>
        🔴 `400`
      </td>

      <td>
        Common Validation Errors

        * **endDate cannot be more than 100 days from startDate** - Using a date range with more than 100 days apart
        * **reportType invalid** - calling an unsupported report type will throw a 400 error
        * **timeZone must be a valid timezone** - using a time zone value that is not listed in the list tz database time zones
        * **format invalid** - using an unsupported file format
      </td>
    </tr>
  </tbody>
</table>
