> For the complete documentation index, see [llms.txt](https://docs.tyrads.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tyrads.com/publishers-integrations/publisher-api/api-resources/campaign.md).

# Active Campaigns

## API Endpoints

### List of active campaign

Return list of activated [Campaign](#campaign)

```
GET https://api.tyrads.com/publisher/campaigns
```

**Example:**

{% openapi src="/files/9NmNRiejQMwz6myGqY1D" path="/publisher/campaigns" method="get" %}
[publisher-api.yml](https://2066086824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjxRWBSTcObUX1TCoTG61%2Fuploads%2FZJsIvUnvtttYfQ6Jswcw%2Fpublisher-api.yml?alt=media\&token=40cbb2ef-2f41-4f20-b0b5-195815e560eb)
{% endopenapi %}

{% hint style="danger" %}
To ensure a smooth experience for your users and prevent potential customer service issues related to capped campaigns, it is *mandatory* that you filter campaigns using the `capReached` parameter in our API response.

When a campaign's cap is fully reached, it will ***not*** be *automatically removed* from our API response. Therefore, you must apply a filter **on your end** so that only campaigns with `capReached=false` are shown to users. This will provide the most reliable and real-time prevention of showing capped campaigns to the user.&#x20;
{% endhint %}

## API References

### Campaign

| Attribute               | Type                                           | Description                                                                                           |
| ----------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `campaignId`            | integer                                        | Campaign ID                                                                                           |
| `campaignName`          | string                                         | Campaign name                                                                                         |
| `capReached`            | boolean                                        | Campaign is over cap or not.                                                                          |
| `rankingScore`          | float                                          | Campaign ranking score. Campaigns in the response are sorted based on this field in descending order. |
| `campaignDescription`   | string                                         | Campaign description                                                                                  |
| `status`                | string                                         | Campaign status `active`, `paused`, or `suspended`                                                    |
| `reportingCampaignName` | string                                         | Campaign name used within the MMP (Mobile Measurement Partner)                                        |
| `app`                   | [Campaign App](#campaign-app)                  | The advertiser app of the campaign                                                                    |
| `currency`              | [Campaign Currency](#campaign-currency)        | The currency of the campaign                                                                          |
| `kpis`                  | array of [Campaign KPI](#campaign-kpi)         | The KPIs (Key performance indicator) of the campaign                                                  |
| `payoutEvents`          | array of [PayoutEvent](#payout-event)          | The payout events of the campaign                                                                     |
| `publisherBudgets`      | array of [Publisher Budget](#publisher-budget) | The specific budgets for you as a publisher of a specific campaign                                    |
| `tracking`              | [Campaign Tracking](#campaign-tracking)        | The tracking of the campaign with the MMP (Mobile Measurement Partners) Links                         |
| `targeting`             | [Campaign Targeting](#campaign-targeting)      | The targeting of the campaign                                                                         |
| `creative`              | [Campaign Creative](#campaign-creative)        | The creatives of the campaign                                                                         |

### Campaign App

| Attribute          | Type           | Description                                               |
| ------------------ | -------------- | --------------------------------------------------------- |
| `id`               | integer        | Internal App ID                                           |
| `title`            | string         | App Title from the appstore page                          |
| `packagename`      | string         | Application package name                                  |
| `rating`           | float \| null  | Rating from the appstore page                             |
| `shortDescription` | string \| null | Short description from the appstore page                  |
| `store`            | string         | The store name of the application `apple` or `googlePlay` |
| `storeCategory`    | string \| null | Application category on store                             |
| `previewUrl`       | string         | The preview URL of the app from the appstore              |
| `thumbnail`        | string         | The thumbnail URL of the app from the appstore            |

### Campaign Currency

| Attribute | Type   | Description     |
| --------- | ------ | --------------- |
| `name`    | string | Currency name   |
| `symbol`  | string | Currency symbol |

### Campaign KPI

| Attribute   | Type                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ----------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`        | integer               | The ID of the KPI                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `kpiType`   | string                | <p>The type of the KPI <code>Soft</code>, <code>Hard</code>, or <code>Conditional</code></p><ul><li><code>Soft</code>: Soft KPI are KPI's that are not payment related but need to achieved to keep the campaign active.</li><li><code>Hard</code>: HARD KPI's are related to payment if not achieved payment is not made.</li><li><code>Conditional</code>: Conditional Hard KPI's are KPI's that will payout a % of the amount based on the criteria.</li></ul> |
| `eventType` | string                | The type of the KPI event `ROI`, `Retention` or `Event`                                                                                                                                                                                                                                                                                                                                                                                                           |
| `eventName` | string                | The name of the event to measure the KPI on.                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `rule`      | [KPI Rule](#kpi-rule) | The rule of the KPI                                                                                                                                                                                                                                                                                                                                                                                                                                               |

### KPI Rule

| Attribute        | Type   | Description                                                                                                                                                                         |
| ---------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `rule`           | string | The operator of the KPI rule `Less Than`, `More Than`, or `Between`                                                                                                                 |
| `criteriaFirst`  | string | The first criteria of the KPI rule, only used for Conditional Hard KPI's                                                                                                            |
| `criteriaSecond` | string | <p>The second criteria of the KPI rule to combine with <code>firstCriteria</code> only if <code>rule</code> is <code>Between</code><br><br>only used for Conditional Hard KPI's</p> |
| `goal`           | string | The goal of the KPI rule mianly used for SOFT and HARD KPI's                                                                                                                        |
| `unit`           | string | The unit of the KPI rule `%` or `$`                                                                                                                                                 |
| `payout`         | float  | The percentage of the payout when the criteria is met. Only used for Conditional Hard KPI's                                                                                         |

### Payout Event

| Attribute                  | Type             | Description                                                                      |
| -------------------------- | ---------------- | -------------------------------------------------------------------------------- |
| `id`                       | integer          | The ID of the event                                                              |
| `identifier`               | string           | The unique identifier of the event                                               |
| `eventName`                | string           | The name of the event                                                            |
| `eventCategory`            | string           | The category name of the event                                                   |
| `payoutAmount`             | float            | The payout amount of the event                                                   |
| `payoutTypeId`             | integer          | The payout type ID of the event                                                  |
| `payoutType`               | string           | The payout type name of the event                                                |
| `allowDuplicateEvents`     | boolean          | If `true` the duplicate event will count                                         |
| `minTime`                  | interger \| null | The minimum time amount of the event to be count                                 |
| `minTimeMetric`            | string \| null   | The minimum time metric `seconds`, `minutes`, `hours`, or `days`                 |
| `maxTime`                  | interger \| null | The maximum time amount of the event to be count                                 |
| `maxTimeMetric`            | string \| null   | The maximum time metric `seconds`, `minutes`, `hours`, or `days`                 |
| `enforceEventOrder`        | boolean          | If `true` the event need to follow the `orderEvent` to be count                  |
| `enforceMinTimeCompletion` | boolean          | If `true` the event need to follow the `minTime` and `minTimeMetric` to be count |
| `enforceMaxTimeCompletion` | boolean          | If `true` the event need to follow the `maxTime` and `maxTimeMetric` to be count |
| `everflowEventId`          | integer          | The ID of everflow  event                                                        |
| `appEventId`               | integer          | The App Event Id                                                                 |
| `userPayout`               | float \| null    | User payout amount of the event                                                  |
| `order`                    | Integer          | Order of the event in campaign.                                                  |

### Publisher Budget

| Attribute      | Type                                            | Description                                                            |
| -------------- | ----------------------------------------------- | ---------------------------------------------------------------------- |
| `id`           | integer                                         | Budget ID                                                              |
| `budget`       | [Publisher Budget Type](#publisher-budget-type) | The type of budget, **click, conversion, revenue and payouts budgets** |
| `dailyBudget`  | integer \| null                                 | Budget limit per day                                                   |
| `weeklyBudget` | integer \| null                                 | Budget limit per week                                                  |
| `monthBudget`  | integer \| null                                 | Budget limit per month                                                 |
| `globalBudget` | integer \| null                                 | Total Budget limit without time limit                                  |
| `isActive`     | boolean                                         | Budget active status                                                   |

### Publisher Budget Type

| Attribute | Type    | Description      |
| --------- | ------- | ---------------- |
| `id`      | integer | Budget type ID   |
| `name`    | string  | Budget type name |

### Campaign Tracking

| Attribute         | Type    | Description                                                                              |
| ----------------- | ------- | ---------------------------------------------------------------------------------------- |
| `id`              | integer | Campaign tracking ID                                                                     |
| `attributionTool` | string  | Attribution tool of the campaign `Appsflyer`, `Adjust`, `Branch`, `Singular`, or `Other` |
| `impressionUrl`   | string  | Campaign tracking URL for impression                                                     |
| `clickUrl`        | string  | Campaign tracking URL for click                                                          |

### Campaign Targeting

| Attribute       | Type                                                                                                                                                               | Description                                                                 |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------- |
| `os`            | string                                                                                                                                                             | The OS target of the campaign `Android` or `iOS`                            |
| `countries`     | array of [Country](#country)                                                                                                                                       | List of countries to target for the campaign                                |
| `demographics`  | array of [Demographic](#demographic)                                                                                                                               | List of demographics to target for the campaign                             |
| `targetingType` | string                                                                                                                                                             | The traffic targeting type of the campaign `incent`, `non-incent` or `both` |
| `reward`        | [Targeting Reward](#targeting-reward)                                                                                                                              | The reward of the campaign if `targetingType` is `incent` or `both`         |
| `states`        | array of [States](https://app.gitbook.com/o/DuOKLqs5YxgaistFStF6/s/yctTPYkX5OA6WuoXV5ru/~/edit/~/changes/65/publishers-integrations/api-resources/campaign#states) | List of states to target for the campaign                                   |

### Country

| Attribute | Type    | Description      |
| --------- | ------- | ---------------- |
| `id`      | integer | Country ID       |
| `iso`     | string  | Country ISO code |

#### States <a href="#states" id="states"></a>

| Attribute | Type    | Description |
| --------- | ------- | ----------- |
| `id`      | integer | State ID    |
| `name`    | string  | State Name  |

### Demographic

| Attribute  | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                |
| ---------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`       | integer | Target demographic ID                                                                                                                                                                                                                                                                                                                                                                                                      |
| `category` | string  | Target demographic category `gender` or `age-group`                                                                                                                                                                                                                                                                                                                                                                        |
| `target`   | string  | <p>Depend on the value of <code>category</code><br><br>Options for <code>gender</code>:</p><ul><li><code>Male</code></li><li><code>Female</code></li></ul><p>Options for <code>age-group</code>:</p><ul><li><code>12 to 17</code></li><li><code>18 to 24</code></li><li><code>25 to 34</code></li><li><code>35 to 44</code></li><li><code>45 to 54</code></li><li><code>55 to 64</code></li><li><code>65+</code></li></ul> |

### Targeting Reward

| Attribute                 | Type   | Description                                              |
| ------------------------- | ------ | -------------------------------------------------------- |
| `rewardDifficulty`        | string | The difficulty of the reward `Easy`, `Medium`, or `Hard` |
| `incentRewardDescription` | string | The description of the reward                            |

### Campaign Creative

| Attribute       | Type                                     | Description                                    |
| --------------- | ---------------------------------------- | ---------------------------------------------- |
| `creativeUrl`   | string                                   | The creative URL to download all the creatives |
| `creativePacks` | array of [Creative Pack](#creative-pack) | List of creative packs                         |

### Creative Pack

| Attribute          | Type                           | Description                                 |
| ------------------ | ------------------------------ | ------------------------------------------- |
| `creativePackName` | string                         | The creative pack name                      |
| `languageName`     | string                         | The language of the creative pack           |
| `languageCode`     | string                         | The language code of the creative pack      |
| `creatives`        | array of [Creative](#creative) | List of creatives within the creative pack. |

### Creative

| Attribute      | Type                            | Description                                              |
| -------------- | ------------------------------- | -------------------------------------------------------- |
| `creativeName` | string                          | The creative name                                        |
| `callToAction` | string \| null                  | The text of the ad button for the Call to Action (CTA)   |
| `byteSize`     | string                          | The size of the creative file in bytes                   |
| `fileUrl`      | string                          | The URL of the creative file.                            |
| `duration`     | string \| null                  | The duration of the ad (mainly used for video creatives) |
| `creativeType` | [Creative Type](#creative-type) | The type of the creative                                 |

### Creative Type

| Attribute              | Type           | Description                                                   |
| ---------------------- | -------------- | ------------------------------------------------------------- |
| `name`                 | string         | The creative type name                                        |
| `type`                 | string         | The creative file type `images` or `videos`                   |
| `width`                | string \| null | The width of the creative in pixel. `null` if type is `text`  |
| `height`               | string \| null | The height of the creative in pixel. `null` if type is `text` |
| `creativeCategoryType` | string         | The category type of the creative.                            |
|                        |                |                                                               |
