---
title: 'Criteo Resellers Program API V2 - Full Reference Guide'
description: 'Concepts The following concepts are used in the Criteo Reseller Program API: Budget - a budget limits the spending of a seller on one or more campaigns. It…'
language: en
guide: NSmWpwLQbg
updated: 2024-04-01T11:10:47Z
canonical: https://help.criteo.com/kb/guide/en/criteo-resellers-program-api-v2-full-reference-guide-NSmWpwLQbg/Steps/775661
alternates:
  de: https://help.criteo.com/kb/guide/de/criteo-resellers-program-api-v2-vollstandiges-referenzhandbuch-NSmWpwLQbg.md
  es: https://help.criteo.com/kb/guide/es/criteo-resellers-program-api-v2-guia-de-referencia-completa-NSmWpwLQbg.md
  fr: https://help.criteo.com/kb/guide/fr/criteo-resellers-program-api-v2-guide-de-reference-complet-NSmWpwLQbg.md
  it: https://help.criteo.com/kb/guide/it/programma-rivenditori-criteo-api-v2-guida-di-riferimento-completa-NSmWpwLQbg.md
  ja: https://help.criteo.com/kb/guide/ja/criteo-api-v2-NSmWpwLQbg.md
  ko: https://help.criteo.com/kb/guide/ko/criteo-api-v2-NSmWpwLQbg.md
  pt: https://help.criteo.com/kb/guide/pt/criteo-resellers-program-api-v2-guia-de-referencia-completo-NSmWpwLQbg.md
---

> Index of this knowledge base: https://help.criteo.com/llms.txt
>
> Interactive version: https://help.criteo.com/kb/guide/en/criteo-resellers-program-api-v2-full-reference-guide-NSmWpwLQbg/Steps/775661

# Criteo Resellers Program API V2 - Full Reference Guide

<a id="step-775661"></a>

## Criteo Resellers Program API V2 - Full Reference Guide

**Concepts**

The following concepts are used in the Criteo Reseller Program API:  

-   **Budget** - a budget limits the spending of a seller on one or more campaigns. It has an initial amount as well as a spent amount. It also has a start and end date. Clicks on an ad sold through a seller campaign are billed against the associated budget according to the negotiated rate. A budget may be consumed by multiple seller campaigns as long as they belong to the same seller.
    
-   **Campaign** - a campaign is a course of action to promote products from your Sellers.
    
-   **Advertiser**\- The advertiser is the entity advertising on behalf of the Seller. Typically, the advertiser is a marketplace using the CRP solution to monetize the Seller Advertising Budget. **Aliases:** Marketplace
    
-   **Seller** - a seller sell products on your marketplace. A seller benefits from a campaign by getting more exposure of products on the internet through the Criteo platform. However a Seller does not interact financially with Criteo.
    
-   **Seller Campaign** - a seller campaign is a resource that encapsulates the business rules agreed upon by the seller to use in a specific campaign. For example, it contains the maximum bid the seller is willing to place on some campaign. Different platforms (web vs mobile) typically have different campaigns.
    

  

The resources exposed in this API are the following:

-   Advertisers (advertisers)
    
-   Seller (sellers)
    
-   Seller Campaign (seller-campaigns)
    
-   Budget (budgets)
    

In addition, the v1 **Campaign** resource (/marketing/v1/campaigns) is also referenced from the API.

These resources each have globally unique identifiers, except for the seller campaign for which the sellerId and the campaignId serve as a unique identifier.

The seller resource is associated with an advertiser and also has a unique name in that context.

Next: [Design](#step-908769)

<a id="step-908769"></a>

## Design

The design of the v2 schema is based on the following relationship diagram for the most important resources.  

  

Note that every Seller Campaign uses a composite primary key consisting of a single Seller and a single Campaign. It can be associated to multiple Budget resources. A budget may be consumed by multiple seller campaigns as long as they belong to the same seller. However, the business rules stipulate that there is at most one current daily budget and one current non-daily budget. A daily budget may be configured without a non-daily budget behind it, but by itself a daily budget is not sufficient to activate a Seller Campaign and start serving ads; a non-daily (AKA "total") budget is required.

Next: [API Endpoints](#step-908768)

<a id="step-908768"></a>

## API Endpoints

> **Warning:** All dates in the API are expressed in UTC. It is the responsibility of the client to convert from local time to UTC when creating a request.

  

> **Tip:** GET advertisers HTTP/1.1

> **Tip:** GET advertisers/{advertiserId} HTTP/1.1

> **Tip:** POST advertisers/{advertiserId}/sellers HTTP/1.1

> **Tip:** GET sellers HTTP/1.1

> **Tip:** GET sellers/{sellerId} HTTP/1.1

> **Tip:** GET sellers/{sellerId}/budgets HTTP/1.1

> **Tip:** GET sellers/{sellerId}/seller-campaigns HTTP/1.1

> **Tip:** POST sellers/{sellerId}/seller-campaigns HTTP/1.1

   

> **Tip:** GET seller-campaigns HTTP/1.1

> **Tip:** GET seller-campaigns/{sellerCampaignId} HTTP/1.1

> **Tip:** GET seller-campaigns/{sellerCampaignId}/budgets HTTP/1.1

> **Tip:** PATCH seller-campaigns HTTP/1.1

> **Tip:** PATCH seller-campaigns/{sellerCampaignId} HTTP/1.1

> **Tip:** GET budgets HTTP/1.1

> **Tip:** GET budgets/{budgetId} HTTP/1.1

> **Tip:** PATCH budgets HTTP/1.1

> **Tip:** PATCH budgets/{budgetId} HTTP/1.1

> **Tip:** POST budgets HTTP/1.1

> **Tip:** POST budgets/{budgetId} HTTP/1.1

   

-   This design document describes services found under the following service root: [https://api.criteo.com/marketing/v2/crp](https://api.criteo.com/marketing/v2/crp)
-   A swagger description of the API will be available here: [https://api.criteo.com/marketing/swagger](https://api.criteo.com/marketing/swagger)

  
This service root will be used exclusively for the Reseller Program domain. In the past the Reseller Program was part of the [https://api.criteo.com/marketing/v1/](https://api.criteo.com/marketing/v1/) service root under the sellers URI path segment.  

The rest of this section is organized by URI address. There are four major subsections:

-   Advertisers
-   Sellers (sellers)
-   Seller Campaigns (seller-campaigns)
-   Budgets (budgets)

Each subsection starts with a table of supported endpoints.

- If "Advertisers": [Advertisers](#step-908762)
- If "Sellers": [Sellers](#step-908764)
- If "Seller Campaigns": [Seller Campaigns](#step-908761)
- If "Budgets": [Budgets](#step-908763)
- If "JSON Schema": [JSON Schema](#step-908767)
- If "API Stats Endpoints": [API Stats Endpoints](#step-908765)

<a id="step-908762"></a>

## Advertisers

```javascript
GET advertisers/1234 HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
    "id": "1234",
	"advertiserName": "testAdvertiser",
    "currencyName": "USD"
}
```

> **Tip:** GET advertisers HTTP/1.1

> **Tip:** GET advertisers/{advertiserId} HTTP/1.1

> **Tip:** POST advertisers/{advertiserId}/sellers HTTP/1.1

An advertiser represents a CRP marketplace.  
  

**GET Collection**

The advertisers URI is a collection of advertisers which the user is authenticated to view. For a typical user there will be one entry. When accessed by an administrator who manages multiple advertisers it may include more than one entry.

  

**GET Resource**

The advertisers /{advertiserId} endpoint is used to access a single advertiser. The information returned includes the advertiser Id, the name of the advertiser, and the currency of the advertiser.

This path ends here.

<a id="step-908764"></a>

## Sellers

**POST to Collection**

A POST of a sellers collection to a collection is useful when an advertiser needs to manually set up one or more sellers before they have provided the sellers to us in their catalog.

The request must contain the list of seller names in the body. The seller names must not already exist in the database. A seller's name must also match exactly the name that is anticipated to appear in the catalog, or else the resulting seller will be represented as a separate entity.

POST advertisers/1234/sellers HTTP/1.1
Content-Type: application/json
Accept: application/json
\["test1", "test2"\]

**Sellers**

The advertisers/{advertiserId}/sellers URI is a collection of the sellers belonging to a single Advertiser. It is identical to the sellers URI filtered to a single advertiser.

**GET Collection**

For documentation see the GET sellers endpoint.

**Sellers**

> **Tip:** GET sellers HTTP/1.1

> **Tip:** PATCH sellers HTTP/1.1

> **Tip:** GET sellers/{sellerId} HTTP/1.1

> **Tip:** PATCH sellers/{sellerId} HTTP/1.1

> **Tip:** GET sellers/{sellerId}/budgets HTTP/1.1

> **Tip:** GET sellers/{sellerId}/seller-campaigns HTTP/1.1

A seller works through a advertiser to sell products. The advertiser agrees to sell products through one or more campaigns and establishes the maximum bid for each campaign. In practice the sellers API is used by the advertiser on behalf of the seller.

**Sellers**

The sellers endpoint is used to access all sellers or to modify a collection of sellers.

**GET Collection**

Getting the collection of sellers returns a list of seller resources.

GET sellers HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
\[
    {
        "id": "1000",
        "sellerName": "AHepburn"
    },
    {
        "id": "1001",
        "sellerName": "HBogart"
    }
\] 

**Seller Budgets**

The sellers/{sellerId}/budgets URI is used to access all budgets for a particular seller or to modify a collection of sellers budgets. It behaves similarly to the budgets URI but restricted to a specific seller.

**GET Collection**

See the documentation for GET budgets.

**PATCH Collection**

See the documentation for PATCH budgets.

**Seller Campaigns**

The sellers/{sellerId}/seller-campaigns URI is used to access the seller campaigns associated with the seller. It is identical to the seller-campaigns URI filtered to a specific seller.

**GET Collection**

See the documentation for GET seller-campaigns.

**PATCH Collection**

See the documentation for PATCH seller-campaigns.

**POST to Collection**

A POST of seller campaigns to a seller's collection is the prerequisite step to creating budgets for a manually created Seller (see POST advertisers/{advertiserId}/sellers above).

POST seller-campaigns/1000 HTTP/1.1
Content-type: application/json
Accept: application/json
\[
    {
        "campaignId": 100,
		"bid": 1.0
    },
    {
        "campaignId": 101,
		"bid": 0.5
    }
\]

This path ends here.

<a id="step-908761"></a>

## Seller Campaigns

> **Tip:** GET seller-campaigns HTTP/1.1

> **Tip:** PATCH seller-campaigns HTTP/1.1

> **Tip:** GET seller-campaigns/{sellerCampaignId} HTTP/1.1

> **Tip:** PATCH seller-campaigns/{sellerCampaignId} HTTP/1.1

> **Tip:** GET seller-campaigns/{sellerCampaignId}/budgets HTTP/1.1

Seller campaigns represent the business parameters for a particular seller in an ad campaign, in particular the status and the bid. There can be at most one seller campaign resource for any combination of seller and campaign. For this reason the seller id and campaign id serve as a composite key for the seller campaign.

Seller Campaigns are automatically created. The set is managed by the system and contains the cross product of all sellers with the campaigns to which they have access. A client can only modify the properties of existing seller campaigns via this API.

Sellers and their products are periodically updated by the advertiser. When a seller is removed the suspendedSince attribute reflects the date of removal.

A seller campaign is "Active" so long as it is not suspended and the campaign is still active.

**Seller Campaigns**

The seller-campaigns URI is a collection of seller campaigns.

**GET Collection**

Getting the collection of seller campaigns returns all public attributes of the seller campaigns including the link, sellerId, campaignId, bid and the suspendedSince date.

GET seller-campaigns HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
\[
    {
        "id": "1000.100",
        "sellerId": "1000",
        "campaignId": "100",
        "bid": 2.5,
        "suspendedSince": "2019-01-11T17:00:12.333",
        "suspensionReasons": \["ManuallyStopped"\]
    },
    {
        "id": "1001.100",
        "sellerId": "1001",
        "campaignId": "101",
        "bid": 1.5
    }
\]

  

A seller campaign is active if it has not been suspended and if the associated campaign is active.

**GET Resource**

A single seller campaign can be returned by a GET request using the resource URI.

GET seller-campaigns/1001.101 HTTP/1.1
HTTP/1.1 200 OK
Content-type: application/json
{
    "id": "1000.100",
    "sellerId": "1000",
    "campaignId": "100",
    "bid": 1.5,
    "suspendedSince": "2019-01-11T17:00:12.333",
    "suspensionReasons": \["ManuallyStopped"\]
}

**PATCH Collection**

Patching the collection of seller campaigns allows the bids to be modified. The patch command will find the seller campaign using the required id.

PATCH seller-campaigns HTTP/1.1
Content-Type: application/json
Accept: application/json
\[
    {
        "id": "1000.100",
        "bid": 2.5
    },
    {
        "id": "1001.101",
        "bid": 3
    }
\]

HTTP/1.1 200 OK
\[
    {
        "id": "1000.100",
        "sellerId": "1000",
        "campaignId": "100",
        "bid": 2.5
    },
    {
        "id": "1001.101",
        "sellerId": "1001",
        "campaignId": "101",
        "bid": 3
    }
\]

**PATCH Resource**

A specific seller campaign resource can also be patched.

PATCH seller-campaigns/1000.100 HTTP/1.1
Content-Type: application/json
{
    "bid": 5
}

HTTP/1.1 200 OK
{
    "id": "1000.100",
    "sellerId": "1000",
    "campaignId": "100",
    "bid": 5
}

**Seller Campaign Budgets**

The seller-campaigns/{sellerCampaignId}/budgets URI is used to retrieve budgets associated with a specific seller campaign. It is identical to the budgets endpoint but filtered to a specific seller and campaign.

This path ends here.

<a id="step-908763"></a>

## Budgets

> **Tip:** GET budgets HTTP/1.1

> **Tip:** POST budgets HTTP/1.1

> **Tip:** PATCH budgets HTTP/1.1

> **Tip:** GET budgets/{budgetId} HTTP/1.1

> **Tip:** PATCH budgets/{budgetId} HTTP/1.1

A budget limits the spending of a seller on one or more campaigns. It has an initial amount, an inclusive startDate and an exclusive endDate. The startDate must be less than or equal to the endDate. The value of endDate may be the special token "Never", which is greater than any other date and makes the budget open ended.

The budgetType defines rules for consuming the budget. There are three types of budgets.

The campaigns lists the campaign ids against which spending is allowed. A budget may be consumed by multiple seller campaigns as long as they belong to the same seller. Clicks on an ad sold through a seller campaign are billed against the associated budget according to the negotiated rate. The accumulated cost is indicated by the spend attribute. Spend may lag actual accrual.

A client may suspend a budget in order to prevent consumption against a campaign. This is done by setting the suspended flag to false in a patch operation.

A budget's status determines when the budget is/was used. The client is interested in three scenarios when looking at budgets:

-   Reporting: I want to see what I have done in the past.
-   Monitoring: I want to see what is going on.
-   Prediction: I want to see what I have scheduled for the future.

  

Two budgets of the same type MUST NOT be current for the same combination of seller and campaign at the same time. This rule is applied whenever a budget is created or modified.

  

**Budgets**

**GET Collection** 

GET budgets HTTP/1.1
HTTP/1.1 200 OK
Content-type: application/json
\[
    {
        "id": "100101",
        "sellerId": "1001",
        "campaignIds": \[
            "10001",
            "10002"
        \],
        "budgetType": "Capped",
        "amount": 1000,
        "startDate": "2019-01-11",
        "endDate": "2019-01-12",
        "spend": 100,
        "status": "Current"
    },
    {
        "id": "100102",
        "sellerId": "1001",
        "campaignIds": \[
            "10001",
            "10002"
        \],
        "budgetType": "Capped",
        "amount": 900,
        "startDate": "2019-01-10",
        "endDate": "Never",
        "spend": 890,
        "status": "Archived"
    }
\]

  

If both endAfterDate and startBeforeDate are supplied, the end after date MUST be before the start before date.

The endAfterDate and startBeforeDate filter parameters together form an inclusive range. Only budgets whose activity _overlaps_ with that range will be returned. The default returns budgets that have not yet ended. This may be surprising since we will in effect filter budgets even when no query parameters are supplied, but we believe this is the desired behavior.

> **Tip:** In the future we may support filtering dates not only by overlap but also by _containment_ so that clients can find budgets that start after a certain date and end before a certain date.

When filtering daily budgets using a date range the spend shown will be the spend for the final day of the date range, or the endDate of the budget, whichever is earlier. This definition allows advertisers to get helpful data for managing spend.

  

**POST to Collection**

A POST of a budget collection to a collection is useful when a advertiser needs to create budgets for one or more sellers, either because a previous budget had a mistake and needed to be deactivated, or because a seller was just added. All three types of budgets can be created this way.

The following constraints apply when creating a new budget.

-   sellerId: the seller MUST be supplied
-   campaignIds: a non-empty array of campaign ids MUST be supplied
-   budgetType: a budget type MUST be supplied
-   amount: an amount MAY be supplied only if the type is not Uncapped and if supplied it MUST be non-negative
-   startDate: a future start date MUST be supplied
-   endDate: an end date MAY be supplied and if supplied MUST be greater than the start date; if left off the endDate is equivalent to Never
-   if both the start and end date are supplied, the end date MUST be greater than the start date

> **Warning:** Other attributes MUST NOT be supplied.

The example below creates two new budgets (one Capped and one Daily). Because the Accept header is supplied, the response includes the newly created or modified budgets.

POST budgets HTTP/1.1
Content-type: application/json
Accept: application/json
\[
    {
        "sellerId": "1001",
        "campaignIds": \[
            "10001",
            "10002"
        \],
        "budgetType": "Capped",
        "amount": 1000,
        "startDate": "2019-01-11"
    },
    {
        "sellerId": "1001",
        "campaignIds": \[
            "10001",
            "10002"
        \],
        "budgetType": "Daily",
        "amount": 100,
        "startDate": "2019-01-10",
        "endDate": "2021-01-10"
    }
\]

HTTP/1.1 200 OK
Content-type: application/json
\[
    {
        "id": "100101",
        "sellerId": "1001",
        "campaignIds": \[
            "10001",
            "10002"
        \],
        "budgetType": "Capped",
        "amount": 1000,
        "startDate": "2019-01-11",
        "endDate": "Never",
        "spend": 0,
        "status": "Current"
    },
    {
        "id": "100102",
        "sellerId": "1001",
        "campaignIds": \[
            "10001",
            "10002"
        \],
        "budgetType": "Daily",
        "amount": 100,
        "startDate": "2019-01-10",
        "endDate": "2021-01-10",
        "spend": 0,
        "status": "Archived"
    }
\]

**PATCH Collection**

A PATCH against the collection can be used to modify multiple existing budget resources. Creation is not supported via PATCH. This prevents accidental creation of budgets when the budget id is corrupted.

Patching multiple budgets is the primary means by which a marketplace currently adjusts the existing budgets of sellers. All three types of budgets can be created this way.

The following example modifies an existing budget.

PATCH budgets HTTP/1.1
Content-type: application/json
Accept: application/json
\[
    {
        "id": "100100",
        "isSuspended": true
    }
\]

HTTP/1.1 200 OK
Content-type: application/json
\[
    {
        "id": "100100",
        "sellerId": "1001",
        "campaignIds": \[
            "10001",
            "10002"
        \],
        "budgetType": "Uncapped",
        "startDate": "2019-01-11",
        "endDate": "Never",
        "spend": 0,
        "status": "Archived",
        "isSuspended": false
    }
\]

  
See the section "POST to Collection" for constraints that apply to newly created budgets. See the section "PATCH Resource" for constraints that apply to existing budgets.

> **Tip:** Since performance was an issue in the past the recommended best practice is for the client to throttle the number of budget resources in each patch request. A useful guideline would be to limit the size of the patch to around 2,000 budgets (~0.5MB). Ten thousand budgets would then require five PATCH requests from the client.

**GET Resource**

A single budget can be returned by a GET request using the resource URI. 

GET budgets/100101 HTTP/1.1
HTTP/1.1 200 OK
Content-type: application/json
{
    "id": "100101",
    "sellerId": "1001",
    "campaignIds": \[
        "10001",
        "10002"
    \],
    "budgetType": "Capped",
    "amount": 1000,
    "startDate": "2019-01-11",
    "endDate": "2019-01-12",
    "spend": 100,
    "status": "Current",
    "isSuspended": false
}

  
**PATCH Resource**

A single budget can be modified by a PATCH request using the resource URI. The following rules limit what can be modified.

The following attributes MAY appear:

-   amount: the amount MUST be greater than spend if capped
-   campaignIds: array MUST be non-empty and will replace the existing array
-   startDate: the new and old values MUST be in the future
-   endDate: the new and old values MUST be in the future or "Never"
-   suspended: set to true to suspend a budget, false to un-suspend a budget

For daily budgets the amount may decrease and the new amount will apply to the next day. Values not supplied in the patch remain unchanged.

No other attributes of the budget can be supplied in the patch. The resulting start and end date MUST obey the constraint that the start date precedes the end date. The following example shows a patch that modifies an existing budget.

PATCH budgets/100100 HTTP/1.1
Content-Type: application/json
{
    "amount": 2500.0
}

HTTP/1.1 200 OK
Content-type: application/json
{
    "id": "100100",
    "sellerId": "1001",
    "campaignIds": \[
        "10001",
        "10002"
    \],
    "budgetType": "Capped",
    "amount": 2500.0,
    "startDate": "2019-01-11",
    "endDate": "2019-01-12",
    "spend": 1500,
    "status": "Current"
}

This path ends here.

<a id="step-908767"></a>

## JSON Schema

The following schema are used for validation. The required properties found in the schema are for creation methods (POST). At this time only the budgets endpoint supports creation.

**Sellers**

{

"$schema": "[http://json-schema.org/draft-07/schema#](http://json-schema.org/draft-07/schema)",

"type": "object",

"properties":

{

"id" : {

"type": "string"

},

"type" : {

"type": "string",

"enum": \["sellers"\]

},

"sellerName" : {

"type": "string"

}

},

"required": \["sellerName"\]

}

**

Seller Campaigns**

{

"$schema": "[http://json-schema.org/draft-07/schema#](http://json-schema.org/draft-07/schema)",

"type": "object",

"properties":

{

"id" : {

"type": "string"

},

"type" : {

"type": "string",

"enum": \["seller-campaigns"\]

},

"suspendedSince" : {

"type": \["null", "string"\] // {YYYY-MM-DDTHH:mm:ss.S}

},

"sellerId" : {

"type": "string"

},

"campaignId" : {

"type": "number",

"minimum": 0

},

"bid" : {

"type": \["null", "number"\],

"minimum": 0

}

},

"required": \["sellerId", "campaignId", "bid"\]

}

For a patch the required properties are \["id"\].

  

**Budgets**

{

"$schema": "[http://json-schema.org/draft-07/schema#](http://json-schema.org/draft-07/schema)",

"type": "object",

"properties": {

"id" : {

"type": "string"

},

"type" : {

"type": "string",

"enum": \["budgets"\]

},

"campaignIds" : {

"type": "array",

"items": "number"

},

"budgetType" : {

"type": "string",

"enum": \["Capped", "Uncapped", "Daily"\]

},

"amount" : {

"type": "number",

"minimum": 0

},

"startDate" : {

"type": \["null", "string"\] // {YYYY-MM-DD}

},

"endDate" : {

"type": \["null", "string"\] // {YYYY-MM-DD}, Never

},

"spend" : {

"type": \["null", "number"\],

"minimum": 0

},

"status" : {

"type": "string",

"enum": \["Archived", "Current", "Scheduled"\]

},

"isSuspended" : {

"type": "boolean"

}

},

"required": \["sellerId", "campaignIds", "budgetType", "amount", "startDate"\]

}

For a patch the required properties are \["id"\].

This path ends here.

<a id="step-908765"></a>

## API Stats Endpoints

> **Tip:** GET stats/campaigns HTTP/1.1

> **Tip:** GET stats/sellers HTTP/1.1

> **Tip:** GET stats/seller-campaigns HTTP/1.1

The statistical endpoints allows you to review the performance of your campaigns and pass on seller specific statistics to your sellers.

  

**Metrics**

The last six metrics can be computed in two ways depending on the policy to count only the sales that result from clicks on the same sellers product in a banner (same-seller) or not (any-seller). Reporting can be controlled by clickAttributionPolicy.

  

**Aggregation Interval Size**

The duration of the aggregation interval for the fundamental events is controlled by the filter parameter intervalSize. (Consider also the name frequency.) 

For example, the following request fetches aggregated seller statistics for the current day with a granularity of one row per hour. Every seller managed by this advertiser will have up to 24 rows in the response.

> **Tip:** GET /stats/sellers?intervalSize=hour

The default interval size is day. If the interval size is hour, then the maximum date range allowed is one month.

  

**Date Filtering**

Filtering the results to events that happened in a temporal interval is done by setting the date filter parameters. These are startDate and the endDate. The start date includes all events timestamped since the beginning of that day while the end date includes events until the end of day.

If the end date is left off it defaults to today. If the start date is left off it defaults to the end date. As a result, the default query returns one day of stats. Using just the end date returns a single day as well:

> **Tip:** GET /stats/sellers?endDate=2019-01-01

There are a few constraints. The start date must not be in the future and must be on or precede the end date. The format to use for each is YYY-MM-DD (e.g. 2018-04-30). The maximum duration of the date range is 1 year. If the granularity is hour, then the maximum duration of the date range is 1 month. Note that month and year aggregate values may contain partial data if filtered by date.

Next: [API Stats](#step-908770)

<a id="step-908770"></a>

## API Stats

**Count Filtering**

Filtering the results to a maximum number of data rows is done by setting the count filter parameter. When combined with startDate this can be used to perform simple pagination. For example the first page can have a count of 100; the second page can start on the day after the last date in the first result and still have a count of 100 and so on.

The following query will return up to 100 rows of data.

> **Tip:** GET /stats/sellers?count=100

The default is to report all rows.

  

**Seller Stats**

> **Tip:** GET stats/sellers HTTP/1.1

Get performance statistics aggregated for sellers.

GET stats/sellers?intervalSize=Month HTTP/1.1
HTTP/1.1 200 OK
Content-type: application/json
{
    "columns": \["sellerId", "sellerName", "month", "impressions", "clicks", "cost", "saleUnits", "revenue", "cr", "cpo", "cos", "roas"\],
    "data": \[
       \[1200972, "sellerA", "2019-05-01", 14542, 48, 3.36, 0, 0.0, 0.0, null, null, 0.0\],
       \[1200972, "sellerA", "2019-06-01", 16619, 53, 3.71, 0, 0.0, 0.0, null, null, 0.0\],
       \[1200974, "sellerB", "2019-05-01", 10102, 47, 3.29, 3, 396000.0, 0.063, 1.096, 8.308E-6, 120364.741\],
       \[1200974, "sellerB", "2019-06-01", 11576, 54, 3.78, 1, 132000.0, 0.018, 3.78, 2.863E-5, 34920.634\]
    \],
    "rows": 4
}

The seller id appears in the output in the first column and the seller name appears in the second. The time interval appears in the output as the third column. The remaining columns are metrics.

**Campaign Stats**

> **Tip:** GET stats/campaigns HTTP/1.1

Get performance statistics aggregated for campaigns.

GET stats/sellers?intervalSize=Month HTTP/1.1
HTTP/1.1 200 OK
Content-type: application/json
{
    "columns": \["sellerId", "sellerName", "month", "impressions", "clicks", "cost", "saleUnits", "revenue", "cr", "cpo", "cos", "roas"\],
    "data": \[
       \[1200972, "sellerA", "2019-05-01", 14542, 48, 3.36, 0, 0.0, 0.0, null, null, 0.0\],
       \[1200972, "sellerA", "2019-06-01", 16619, 53, 3.71, 0, 0.0, 0.0, null, null, 0.0\],
       \[1200974, "sellerB", "2019-05-01", 10102, 47, 3.29, 3, 396000.0, 0.063, 1.096, 8.308E-6, 120364.741\],
       \[1200974, "sellerB", "2019-06-01", 11576, 54, 3.78, 1, 132000.0, 0.018, 3.78, 2.863E-5, 34920.634\]
    \],
    "rows": 4
}

The seller id appears in the output in the first column and the seller name appears in the second. The time interval appears in the output as the third column. The remaining columns are metrics.

  

**Campaign Stats**

> **Tip:** GET stats/campaigns HTTP/1.1

Get performance statistics aggregated for campaigns.

GET stats/campaigns?intervalSize=Month HTTP/1.1
HTTP/1.1 200 OK
Content-type: application/json
{
   "columns": \[ "campaignId", "month", "impressions", "clicks", "cost", "saleUnits", "revenue", "cr", "cpo", "cos", "roas" \],
   "data": \[
       \[168423, "2019-05-01", 3969032, 13410, 1111.295, 985, 190758099, 0.073, 1.128, 0.000, 171653.880 \],
       \[168423, "2019-06-01", 8479603, 25619, 2190.705, 740, 152783656, 0.028, 2.960, 0.000, 69741.775 \]
       \],
   "rows": 2
}

The campaign id appears in the output as the first column. The time interval appears in the output as the second column. The remaining columns are metrics.

Next: [Seller Campaign Stats](#step-908766)

<a id="step-908766"></a>

## Seller Campaign Stats

**Seller Campaign Stats**

> **Tip:** GET stats/seller-campaigns HTTP/1.1

Get performance statistics aggregated for seller campaigns.

  

GET stats/seller-campaigns?intervalSize=Month HTTP/1.1
HTTP/1.1 200 OK
Content-type: application/json
{
    "columns": \[
        "campaignId", "sellerId", "sellerName", "month", "impressions", "clicks", "cost", "saleUnits", "revenue", "cr", "cpo", "cos", "roas"
    \],
    "data": \[
        \[168423, 1110222, "118883955", "2019-05-01", 14542, 48, 3.36, 0, 0.0, 0.0, null, null, 0.0\],
        \[168423, 1110222, "118883955", "2019-06-01", 16619, 53, 3.71, 0, 0.0, 0.0, null, null, 0.0\],
        \[168423, 1110225, "117980027", "2019-05-01", 12502, 48, 3.36, 0, 0.0, 0.0, null, null, 0.0\],
        \[168423, 1110225, "117980027", "2019-06-01", 20266, 53, 3.71, 0, 0.0, 0.0, null, null, 0.0\]
    \],
    "rows": 4
}

The campaign id, seller id, and seller name appear in the first three columns of the output. These are followed by the interval size column. The remaining columns are metrics.

This path ends here.
