# Media Partners API

## Media Partners

Media partners is the overarching term for an advertiser or debtor. Media parntners have media brands associated with them. 

### Get a single media partner

```
GET /v1/media-partners/{mediaPartnerId}
```
<table><thead><tr><th>Parameter</th><th>In</th><th>Required</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>mediaPartnerId</code></td><td>path</td><td>Yes</td><td>integer</td><td>The id of the media partner you want to fetch.</td></tr></tbody></table>

**Responses**

<table><thead><tr><th>Status</th><th>Meaning</th></tr></thead><tbody><tr><td><code>200</code></td><td>Media partner found.</td></tr><tr><td><code>400</code></td><td> Bad request -Invalid input or parameters.</td></tr><tr><td><code>401</code> / <code>403</code></td><td>Not authenticated / not allowed.</td></tr><tr><td><code>404</code></td><td>Media partner not found.</td></tr><td><code>500</code></td><td>Internal Server Error</td></tr></tbody></table>

### Update media partner

```
PUT /v1/media-partners/{mediaPartnerId}
```
<table><thead><tr><th>Parameter</th><th>In</th><th>Required</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>mediaPartnerId</code></td><td>path</td><td>Yes</td><td>integer</td><td>The id of the media partner you want to fetch.</td></tr></tbody></table>

**Request body** — `UpdateMediaPartnerRequest`

<table id><thead><tr><th>Field</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td><td>Yes</td><td>Media partner name.</td></tr><tr><td><code>roles</code></td><td>string</td><td>No</td><td>Media partner role:<code>INVOICE, ADVERTISER, INTERMEDIARY, MEDIA</code>.</td></tr><tr><td><code>subsystemExternalIds</code></td><td>object (string → string)</td><td>No</td><td>External ids per subsystem.</td></tr></tbody></table>

## Create brands

A brand is a **media brand** that belongs to a media partner (typically the advertiser company). A brand can be present in multiple media partners.

### Create a brand

```
POST /v1/media-partners/{mediaPartnerId}/brands
```

<table id="bkmrk-parameter-in-require-2"><thead><tr><th>Parameter</th><th>In</th><th>Required</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>mediaPartnerId</code></td><td>path</td><td>Yes</td><td>integer</td><td>The media partner (company) the brand belongs to.</td></tr></tbody></table>

**Request body** — `CreateMediaBrandRequest`

<table id><thead><tr><th>Field</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td><td>Yes</td><td>Brand name.</td></tr><tr><td><code>externalKey</code></td><td>string</td><td>No</td><td>Your own external reference key.</td></tr><tr><td><code>subsystemExternalIds</code></td><td>object (string → string)</td><td>No</td><td>External ids per subsystem.</td></tr></tbody></table>

```json
{
  "name": "Acme Cola",
  "externalKey": "acme-cola",
  "subsystemExternalIds": {}
}
```

**Responses**

<table id="bkmrk-status-meaning-201-m-1"><thead><tr><th>Status</th><th>Meaning</th></tr></thead><tbody><tr><td><code>201</code></td><td>Media brand created.</td></tr><tr><td><code>400</code></td><td>Invalid input.</td></tr><tr><td><code>401</code> / <code>403</code></td><td>Not authenticated / not allowed.</td></tr><tr><td><code>404</code></td><td>Media partner not found.</td></tr></tbody></table>

> As with companies, `201` will return a body including the generated `id` and all information known about the brand.

### List a company's brands

```
GET /v1/media-partners/{mediaPartnerId}/brands?limit=50&offset=0

```

<table id="bkmrk-parameter-in-require-3" style="width: 99.6429%;"><thead><tr><th style="width: 18.1818%;">Parameter</th><th style="width: 8.49478%;">In</th><th style="width: 11.6244%;">Required</th><th style="width: 10.8793%;">Type</th><th style="width: 50.8197%;">Description</th></tr></thead><tbody><tr><td style="width: 18.1818%;"><code>mediaPartnerId</code></td><td style="width: 8.49478%;">path</td><td style="width: 11.6244%;">Yes</td><td style="width: 10.8793%;">integer</td><td style="width: 50.8197%;">The media partner.</td></tr><tr><td style="width: 18.1818%;"><code>limit</code></td><td style="width: 8.49478%;">query</td><td style="width: 11.6244%;">Yes</td><td style="width: 10.8793%;">integer</td><td style="width: 50.8197%;">Max number of results.</td></tr><tr><td style="width: 18.1818%;"><code>offset</code></td><td style="width: 8.49478%;">query</td><td style="width: 11.6244%;">Yes</td><td style="width: 10.8793%;">integer</td><td style="width: 50.8197%;">Results to skip.</td></tr><tr><td style="width: 18.1818%;"><code>includeInactive</code></td><td style="width: 8.49478%;">query</td><td style="width: 11.6244%;">No</td><td style="width: 10.8793%;">boolean</td><td style="width: 50.8197%;">Include deactivated brands.</td></tr><tr><td style="width: 18.1818%;"><code>search</code></td><td style="width: 8.49478%;">query</td><td style="width: 11.6244%;">No</td><td style="width: 10.8793%;">string</td><td style="width: 50.8197%;">URL-encoded, case-insensitive match on name.</td></tr></tbody></table>

**Response** — array of `MediaBrand Schema`

```json
[
  {
    "id": 8801,
    "name": "Acme Cola",
    "externalKey": "acme-cola",
    "subsystemExternalIds": {},
    "active": true
  }
]

```

### Get a single brand

```
GET /v1/media-partners/{mediaPartnerId}/brands/{mediaBrandId}

```

Returns a single `MediaBrand Schema`.