# Schemas

## Campaign

| Field                 | Type      | Notes                                          |
| --------------------- | --------- | ---------------------------------------------- |
| id                    | integer   | Read-only                                      |
| name                  | string    |                                                |
| type                  | string    | `display`, `native`, `text-pop`, `text-search` |
| mode                  | string    | Read-only, e.g. `CPM`                          |
| bid                   | float     | 0.007 to 5                                     |
| budget                | float     | Min 10                                         |
| status                | string    | `A` active (default), `S` paused               |
| start_date / end_date | date      | `YYYY-MM-DD`                                   |
| creatives             | integer[] | Existing creative IDs                          |
| targeting             | object    | See below                                      |

### targeting

| Field            | Type      | Values / notes                                                            |
| ---------------- | --------- | ------------------------------------------------------------------------- |
| browsers         | string[]  | chrome, firefox, safari, opera, msie, unknown                             |
| categories       | object    | `{include: [...]}` or `{exclude: [...]}` IAB codes, e.g. `IAB1`           |
| channel          | integer   | Channel ID                                                                |
| connection_types | string[]  | ethernet, wifi, cellular, unknown                                         |
| countries        | string[]  | 3-letter codes, e.g. `USA`                                                |
| devices          | string[]  | desktop, tablet, phone, others                                            |
| domain_lists     | object    | `{include: [ids]}` or `{exclude: [ids]}`                                  |
| frequency        | integer   |                                                                           |
| keyword_lists    | object    | `include` (search list IDs), `exclude` (negative list IDs)                |
| makers           | string[]  | apple, samsung, motorola, lg, sony, htc, google, amazon, others           |
| models           | string[]  | iphone, ipad                                                              |
| os               | string[]  | windows, macos, android, ios, linux, blackberry, chromeos, others         |
| pacing           | integer   | 0 or 1                                                                    |
| retargeting      | object    | `logic` (`or`/`and`), `ids` (pixel IDs)                                   |
| ron              | integer   | 0 or 1                                                                    |
| schedule         | object[]  | `{day, start_time, end_time}`; day sunday–saturday, times `00:00`–`24:00` |
| source_lists     | integer[] |                                                                           |
| states           | string[]  | 2-letter US state codes; only when countries includes `USA`               |
| supplies         | string[]  | web, mobile, app                                                          |

## Creative

| Field       | Type    | Notes                                                              |
| ----------- | ------- | ------------------------------------------------------------------ |
| id          | integer | Read-only                                                          |
| name        | string  | Max 100                                                            |
| type        | string  | `image`, `script`, `text`, `native`                                |
| status      | string  | Optional; `A` (default), `S`                                       |
| destination | uri     | Required for image, native, text                                   |
| image_url   | uri     | Required for image, native; JPG/PNG/GIF, max 2 MB                  |
| content     | string  | JavaScript tag; required for script                                |
| size        | string  | e.g. `300x250`; required for image, script; see `/creatives/sizes` |
| title       | string  | Required for text, native                                          |
| description | string  | Required for text, native                                          |
| display_url | string  | Required for text, native                                          |

## ListDomains

`id` (read-only), `name` (max 100), `domains` (string[], e.g. `mydomain.com`).

## ListKeywords

`id` (read-only), `name` (max 100), `type` (`exact`/`broad`), `bid` (float, min 0.007), `keywords` (string[]).

## ListSources

`id` (read-only), `name` (max 100), `sources` (array of `{source: integer, bid: float >= 0}`).

## retargetingPixel

`id` (read-only), `name`, `tag` (read-only).

## channels

`id` (read-only), `name` (read-only).

## ApiResponse

`status` (boolean), `message` (string).
