---
updatedAt: 2026-04-15T11:14:17.000Z
agentTools:
  projectIndex: https://developer.moloco.cloud/llms.txt
---

# Create and manage your campaign

# Moloco Ads APIs for campaign management

We have a comprehensive set of APIs for creating and managing Moloco Ads campaigns. You can create, read, update, delete, and list the following entities.

* AdAccount: This entity represents the advertiser (either an individual or an organization).
* Product: This entity represents the app or website that your campaign advertises.
* TrackingLink: This entity represents the tracking link for your campaign. The tracking link collects data you need to analyze your campaign results.
* Campaign: This entity represents your campaign.
* AdGroup: This entity represents the ad group for your campaign.
* CreativeGroup: This entity represents the creative group, which is a group of creatives used in your campaign.
* Creative: This entity represents the creative asset(s) your campaign uses.
* AudienceTarget: This entity represents a particular group of users your campaign targets.
* CustomerSet: This entity represents a set of users you can use for different purposes.

# Entities you need to launch your campaign

In order to launch a new campaign, you need to first create all the entities that make up a campaign. See the entity relationship diagram below for entities you need. If the entity you need has already been created, you can reuse that entity. Otherwise, you must create one.

<Image align="center" alt={465} caption="\<Entity relationship diagram>" title="Screen Shot 2020-07-26 at 11.02.17 PM.png" src="https://files.readme.io/0e3f863-Screen_Shot_2020-07-26_at_11.02.17_PM.png" />

If you are new to Moloco Ads, you should follow the steps below to launch your campaign.

1. Create an `ad_account` object that contains information about your AdAccount.
2. Create a `product` object for the app or website your campaign is promoting.
3. Create a `tracking_link` object for `product`.
4. Create one or more `creative` objects to represent creative assets to be included in your campaign. All creative assets must be uploaded to Google Cloud Storage before you can create a `creative` object.

> Note: An API that lets you upload a creative asset and create a `creative` object all at once will be made available soon.

5. Create one or more `creative_group` objects to represent multiple creatives grouped together. Each `creative_group` includes one or more `creatives`. You can reuse existing `creative_group` and `creative` objects.
6. Create a `campaign` object to launch your campaign.

# Step-by-step guide to launch a campaign

## 1. Create an `ad_account` object

The first step to creating and launching a campaign is to create an `ad_account` object.

The following example shows you how you can use your command-line interface to make an API request to generate an `ad_account` object with the request body parameters you have specified as a `.json` file.  The parameters you have specified for your new `ad_account` object are saved to the `.json` file and delivered to the Campaign Management API as an HTTP POST request body. For more information about the parameters you can specify, see [Create a new ad account.](https://developer.moloco.cloud/reference/dspapi_createadaccount-1)

```shell
$ cat ad_account.json
{
  "title": "Ad Account For Tutorial",
  "description": "Ad Account For Tutorial",
  "timezone": "America/Los_Angeles",
  "currency": "USD"
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@ad_account.json" \
  "https://api.moloco.cloud/cm/v1/ad-accounts"

{
  "ad_account": {
    "id": "$AD_ACCOUNT_ID",
    "title": "Ad Account For Tutorial",
    "description": "Ad Account For Tutorial",
    "timezone": "America/Los_Angeles",
    "currency": "USD",
    "created_at": "2020-07-01T00:00:17.317689Z",
    "updated_at": "2020-07-01T00:00:17.317689Z"
  }
}
```

As in the example, the response includes the Moloco-issued ID for the AdAccount entity. Your AdAccount ID is the value of the `id` property in the `ad_account` object. For more information about each of the parameters included in the response, see [Create a new ad account.](https://developer.moloco.cloud/reference/dspapi_createadaccount-1)

> **Note**: To make an API request, you need a Moloco-issued token to include in the request body. To learn how to receive a token for authentication, see [Get Started with Moloco Ads API](https://developer.moloco.cloud/docs/getting-started#prerequisite).

## 2. Create a `product` object

After you have a created an `ad_account` object, you must create a `product` object. You need to include in the request body the AdAccount ID that was created in the previous step.

The following example shows you how you can use your command-line interface to make an API request to generate a `product` object with the request body parameters you have specified as a `.json` file. The parameters you have specified for your new `product` object are saved to the `.json` file and delivered to the Campaign Management API as an HTTP POST request body. For more information about the parameters you can specify, see [Create a new product.](https://developer.moloco.cloud/reference/dspapi_createproduct)

> **Note**: For the best performance, you must map each of the events you are tracking to measure campaign performance to one of the available event types. This is to optimize your campaign configurations with accurately labeled data. To map events, you must specify one or more of the following values for the `app_event_types` object in the `app` object. You won't be able to successfully create a campaign without having mapped ALL events you are tracking. For more details, see [Create a new product.](https://developer.moloco.cloud/reference/dspapi_createproduct). If you still run into issues when trying to create new campaigns, try [updating an existing product and mapping all your events](https://developer.moloco.cloud/reference/dspapi_updateproduct).
>
> | Value                      | Event                           |
> | :------------------------- | :------------------------------ |
> | IN\_APP\_ADVERTISING       | In-app advertising (IAA)        |
> | IN\_APP\_PURCHASE          | In-app purchase (IAP)           |
> | SIGN\_UP                   | Sign-up / registration          |
> | SUBSCRIPTION               | Subscription                    |
> | PREDICTED\_LIFETIME\_VALUE | Predicted lifetime value (pLTV) |
> | ACHIEVE\_LEVEL             | Achieve target level in game    |
> | START\_TRIAL               | Start trial                     |
> | ADD\_PAYMENT\_INFO         | Add payment info                |
> | VIEW\_PRODUCT\_OR\_CONTENT | View product/content            |
> | ADD\_TO\_WISHLIST          | Add to wishlist                 |
> | SEARCH                     | Search                          |
> | ADD\_TO\_CART              | Add to cart                     |
> | BEGIN\_CHECKOUT            | Begin checkout                  |
> | FIRST\_DEPOSIT             | First deposit                   |
> | FIRST\_TRADE               | First transaction               |
> | OTHER                      | Other                           |
>
> <br />

```shell
$ cat product.json
{
  "title": "Create Request Sample",
  "description": "Create Request Sample",
  "advertiser_domain": "wildrift.leagueoflegends.com",
  "allow_empty_advertiser_domain": false,
  "device_os": "IOS",
  "type": "APP",
  "developer_name": "Riot Games",
  "app": {
    "bundle_id": "1480616990",
    "category": "IAB9-30",
    "content_rating": "12+",
    "app_store_url": "https://apps.apple.com/us/app/league-of-legends-wild-rift/id1480616990",
    "rating": "4.1",
    "postback_integration": {
      "mmp": "APPSFLYER",
      "bundle_id": "id1480616990"
    },
    "mmp_integration": {},
    "storekit_enabled": true,
    "app_event_types": {
	    "af_purchase": "IN_APP_PURCHASE",
		"your_event": "PREDICTED_LIFETIME_VALUE"
    }
  },
  "user_targets": [],
  "adult_content_setting": {
    "enable_adult_content": false
  }
}
```

As in the example, the response includes the Moloco-issued ID for the Product entity. Your Product ID is the value of the `id` property in the `product` object. For more information about each of the parameters included in the response, see [Create a new Product.](https://developer.moloco.cloud/reference/dspapi_createproduct)

## 3. Create a `tracking_link` object

You must create a `tracking_link` object to track your campaign's performance. The `tracking_link` object includes the name of tracking company (e.g., Adjust, Airbridge, AppsFlyer, etc.), click-through (CT) link, and view-through (VT) link. The CT link notifies the tracking company of any click events, and the VT link notifies them of any impression events. To create a `tracking_link` object, you need to enter the name of tracking company your app is using, the CT link, and an optional VT link issued by the tracking company.

The following example shows you how you can use your command-line interface to make an API request to generate a `tracking_link` object with the request body parameters you have specified as a `.json` file. The parameters you have specified for your new `tracking_link` object are saved to the `.json` file and delivered to the Campaign Management API as an HTTP POST request body. For more information about the parameters you can specify, see [Create a new tracking link.](https://developer.moloco.cloud/reference/dspapi_createtrackinglink)

```shell
$ cat tracking_link.json
{
  "title": "Tutorial App Tracking Link",
  "description": "Tutorial App Tracking Link",
  "device_os": "ANDROID",
  "click_through_link": {
    "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&mt_ad=%{creative_filename}&mt_ad_id=%{creative_id}&mt_ad_type=%{creative_type}&mt_click_lookback=7d&mt_cost_currency=%{cost_currency}&mt_cost_model=%{cost_type}&mt_cost_value=%{cost_amount}&mt_siteid=%{raw_app_bundle}&mt_sub4=%{source}&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int"
  },
  "view_through_link": {
    "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&mt_ad=%{creative_filename}&mt_ad_id=%{creative_id}&mt_ad_type=%{creative_type}&mt_cost_currency=%{cost_currency}&mt_cost_model=%{cost_type}&mt_cost_value=%{cost_amount}&mt_siteid=%{raw_app_bundle}&mt_sub4=%{source}&mt_viewthrough_lookback=1d&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int"
  },
  "tracking_company": "TRACKFNT"
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@tracking_link.json" \
  "https://api.moloco.cloud/cm/v1/tracking-links?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "tracking_link": {
    "id": "$TRACKING_LINK_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Tutorial App Tracking Link",
    "description": "Tutorial App Tracking Link",
    "device_os": "ANDROID",
    "click_through_link": {
      "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&ml_ad=%{creative_filename}&ml_ad_id=%{creative_id}&ml_ad_type=%{creative_type}&ml_click_lookback=7d&ml_cost_currency=%{cost_currency}&ml_cost_model=%{cost_type}&ml_cost_value=%{cost_amount}&ml_siteid=%{raw_app_bundle}&ml_sub4=%{source}&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int",
      "status": "UNVERIFIED",
      "unverified_status_data": {
        "stored_at": "2020-07-01T09:50:37Z"
      }
    },
    "view_through_link": {
      "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&ml_ad=%{creative_filename}&ml_ad_id=%{creative_id}&ml_ad_type=%{creative_type}&ml_cost_currency=%{cost_currency}&ml_cost_model=%{cost_type}&ml_cost_value=%{cost_amount}&ml_siteid=%{raw_app_bundle}&ml_sub4=%{source}&ml_viewthrough_lookback=1d&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int",
      "status": "UNVERIFIED",
      "unverified_status_data": {
        "stored_at": "2020-07-01T09:50:37Z"
      }
    },
    "tracking_company": "TRACKFNT",
    "created_at": "2020-07-01T09:50:37.924722Z",
    "updated_at": "2020-07-01T09:50:37.924722Z"
  }
}
```

As in the example, the response includes the Moloco-issued TrackingLink ID that you need when creating a `creative_group` object. Your TrackingLink ID is the value of the `id` property in the `tracking_link` object. For more information about each of the parameters included in the response, see [Create a new tracking link.](https://developer.moloco.cloud/reference/dspapi_createtrackinglink)

## 4. Upload a creative asset and create a `creative` object

For each of your campaigns, you must create at least one `creative` object to add to a `creative_group` object. Every campaign must have at least one CreativeGroup entity, and each CreativeGroup entity can include multiple Creative entities.

### 4-1. Upload a creative asset to storage

To create a `creative` object for your creative asset, you must first upload the creative asset file. The following limitations apply to the types of assets you can specify as the value of the  `asset_kind` property.

| Asset type                         | Maximum file size |
| :--------------------------------- | :---------------: |
| CREATIVE, ASSET\_DYNAMIC\_CREATIVE |       200MB       |
| CSV                                |        4GB        |
| FB\_PLAYABLE\_AD                   |        5MB        |

> Note: Your video files are automatically transcoded to optimize performance. An error message is returned in the event that the file exceeds the size limit after it has been transcoded. For more information, see the [release note](https://developer.moloco.cloud/page/v15-release-notes#video-creatives-video-will-be-transcoded-automatically).

To upload a creative asset, you must do the following.

1. Make a POST API request to get a [session URL](https://cloud.google.com/storage/docs/resumable-uploads#session-uris) for uploading your creative asset to Google Cloud Storage.
2. Make a PUT API request with the session URL to upload the creative asset to Google Cloud Storage.

The following example shows you how you can use your command-line interface to make API requests to get a session URL for your creative asset and upload the creative asset to storage. To learn more about the parameters you can specify, see [Create a new asset upload session.](https://developer.moloco.cloud/reference/dspapi_createassetuploadsession-1)

The first step is making a POST API request with the required parameters as in the following example.

```shell
$ cat asset.json
{
  "asset_kind": "CREATIVE",
  "mime_type": "image/jpeg"
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@asset.json" \
  "https://api.moloco.cloud/cm/v1/creative-assets?ad_account_id=$AD_ACCOUNT_ID"

{
  "asset_url": "$CREATIVE_ASSET_URL",
  "content_upload_url": "$UPLOAD_URL"
}
```

As in the example, the response includes the asset URL and upload URL. The asset URL, which is the value of the `asset_url` property, is the address where your creative asset is made available after it has been uploaded to Google Cloud Storage. The upload URL, which is the value of the `content_upload_url` property, is for uploading the creative asset file to Google Cloud Storage.

You must make a PUT API request with the upload URL to upload the creative asset file to Google Cloud Storage as in the following example. You must include in the request `$ASSET_PATH`, which is the location the file is saved in (e.g., `my-dir/file.jpg`).

```shell
$ curl -X PUT \
  --data-binary "@$ASSET_PATH" \
  -H "Content-Type: image/jpeg" \
  $UPLOAD_URL
```

Your creative asset has been uploaded to Google Cloud Storage, and is available at the URL specified for `asset_url`, which you need for creating a new `creative` object.

### 4-2. Create a `creative` object

After your creative asset has been uploaded to Google Cloud Storage and assigned a unique URL, you must create a `creative` object.

The following example shows you how you can use your command-line interface to make an API request to generate a `creative` object with the request body parameters you have specified as a `.json` file. The parameters you have specified for your new `creative` object are saved to the `.json` file and delivered to the Campaign Management API as an HTTP POST request body. For more information about the parameters you can specify, see [Create a new creative.](https://developer.moloco.cloud/reference/dspapi_createcreative-1)

```shell Image 
$ cat creative.json
{
  "title": "Test Image Creative",
  "type": "IMAGE",
  "original_filename": "test_image.jpg",
  "size_in_bytes": 94994,
  "image": {
    "image_url": "$CREATIVE_ASSET_URL",
    "width": 640,
    "height": 960,
    "size_in_bytes": 94994
  }
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@creative.json" \
  "https://api.moloco.cloud/cm/v1/creatives?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "creative": {
    "id": "$CREATIVE_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "title": "Test Image Creative",
    "enabling_state": "ENABLED",
    "ad_account_info": {
      "id": "$AD_ACCOUNT_ID",
      "title": "Ad Account For Tutorial",
      "description": "Ad Account For Tutorial"
    },
    "type": "IMAGE",
    "original_filename": "test_image.jpg",
    "size_in_bytes": 94994,
    "image": {
      "image_url": "$CREATIVE_ASSET_URL",
      "width": 640,
      "height": 960,
      "size_in_bytes": 94994
    },
    "created_at": "2020-07-01T14:54:00.526009Z",
    "updated_at": "2020-07-01T14:54:00.526009Z"
  }
}
```
```shell Playable
$ cat creative.json
{
  "title": "Test Playable Creative",
  "type": "RICH_CUSTOM_HTML",
  "original_filename": "index.html",
  "rich_custom_html": {
    "html_requirement_attributes": {
      "flags": [
        "MRAID2"
      ],
      "use_custom_close": "CUSTOM_CLOSE_TYPE_NONE",
      "auto_play_audio": "AUTO_PLAY_AUDIO_TYPE_MUTED"
    },
    "html_size_attributes": {
      "interstitial": true
    },
    "playable_ad_source": {
      "type": "PLAYABLE_AD_SOURCE_TYPE_URL",
      "value": "$CREATIVE_ASSET_URL"
    },
    "filename": "index.html"
  }
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@creative.json" \
  "https://api.moloco.cloud/cm/v1/creatives?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "creative":{
    "id": "$CREATIVE_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id":"$PRODUCT_ID",
      "title":"Test Playable Creative",
      "enabling_state":"ENABLED",
      "advertiser_info":{
         "id":"$AD_ACCOUNT_ID",
         "title":"$AD_ACCOUNT_TITLE"
      },
      "type":"RICH_CUSTOM_HTML",
      "original_filename":"index.html",
      "rich_custom_html":{
         "entry_html": "<script src=\"mraid.js\">...</script>...",
         "html_requirement_attributes":{
            "flags":[
               "MRAID2"
            ],
            "use_custom_close":"CUSTOM_CLOSE_TYPE_NONE",
            "auto_play_audio":"AUTO_PLAY_AUDIO_TYPE_MUTED"
         },
         "html_size_attributes":{
            "interstitial":true
         },
         "playable_ad_source":{
            "type":"PLAYABLE_AD_SOURCE_TYPE_URL",
            "value":"$CREATIVE_ASSET_URL"
         },
         "filename":"index.html"
      },
      "feature_type":"GENERAL",
      "created_at":"2026-04-15T10:12:09.938063Z",
      "updated_at":"2026-04-15T10:12:09.938063Z"
   }
}



```
```shell Video with playable end card
$ cat creative.json
  {
    "title": "Test Video With Playable Endcard",
    "type": "VIDEO",
    "original_filename": "test_video.mp4",
    "video": {
      "video_url": "${VIDEO_ASSET_URL}",
      "playable_endcard": {
        "html_requirement_attributes": {
          "flags": ["MRAID2"],
          "use_custom_close": "CUSTOM_CLOSE_TYPE_NONE",
          "auto_play_audio": "AUTO_PLAY_AUDIO_TYPE_MUTED"
        },
        "html_size_attributes": {
          "interstitial": true
        },
        "playable_ad_source": {
          "type": "PLAYABLE_AD_SOURCE_TYPE_URL",
          "value": "${PLAYABLE_ENDCARD_URL}"
        },
        "filename": "playable_endcard.html"
      }
    }
  }

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@creative.json" \
  "https://api.moloco.cloud/cm/v1/creatives?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "creative": {
    "id": "$CREATIVE_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Test Video With Playable Endcard",
    "enabling_state": "ENABLED",
    "advertiser_info": {
      "id": "$AD_ACCOUNT_ID",
      "title": "$ADVERTISER_NAME"
    },
    "type": "VIDEO",
    "original_filename": "test_video.mp4",
    "size_in_bytes": 906640,
    "video": {
      "video_url": "${VIDEO_ASSET_URL}",
      "filename": "test_video.mp4",
      "width": 1080,
      "height": 1920,
      "length_seconds": 7,
      "size_in_bytes": 876621,
      "playable_endcard": {
        "entry_html": "<script src=\"mraid.js\">...</script>...",
        "html_requirement_attributes": {
          "flags": ["MRAID2"],
          "use_custom_close": "CUSTOM_CLOSE_TYPE_NONE",
          "auto_play_audio": "AUTO_PLAY_AUDIO_TYPE_MUTED"
        },
        "html_size_attributes": { "interstitial": true },
        "playable_ad_source": {
          "type": "PLAYABLE_AD_SOURCE_TYPE_URL",
          "value": "${PLAYABLE_ENDCARD_URL}"
        },
        "filename": "playable_endcard.html"
      },
      "transcoding_info": { "status": "SUCCEEDED" }
    },
    "feature_type": "GENERAL",
    "created_at": "2026-04-15T11:02:22.426968Z",
    "updated_at": "2026-04-15T11:02:22.426968Z"
  }
}

```
```shell Video with image end card
$ cat creative.json
  {
    "title": "Test Video With Endcard",
    "type": "VIDEO",
    "original_filename": "campaign_video_portrait.mp4",
    "video": {
      "video_url": "${CREATIVE_ASSET_URL}",
      "fps": 25,
      "companion_images": [
        {
          "image_url": "${COMPANION_IMAGE_URL}"
        }
      ]
    }
  }

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@creative.json" \
  "https://api.moloco.cloud/cm/v1/creatives?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "creative": {
    "id": "$CREATIVE_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Test Video With Endcard",
    "enabling_state": "ENABLED",
    "advertiser_info": {
      "id": "$AD_ACCOUNT_ID",
      "title": "$ADVERTISER_NAME"
    },
    "type": "VIDEO",
    "original_filename": "campaign_video_portrait.mp4",
    "size_in_bytes": 1362011,
    "video": {
      "video_url": "${CREATIVE_ASSET_URL}",
      "filename": "campaign_video_portrait.mp4",
      "width": 1080,
      "height": 1920,
      "length_seconds": 7,
      "fps": 25,
      "size_in_bytes": 876621,
      "companion_images": [
        {
          "image_url": "${COMPANION_IMAGE_URL}"
          "width": 1440,
          "height": 2560,
          "size_in_bytes": 455371
        }
      ],
      "transcoding_info": { "status": "SUCCEEDED" }
    },
    "feature_type": "GENERAL",
    "created_at": "2026-04-15T11:11:43.851067Z",
    "updated_at": "2026-04-15T11:11:43.851067Z"
  }
}
```

As in the example, the response includes the Moloco-issued Creative ID you need when creating a `creative_group` object. The Creative ID is the value of the `id` property in the `creative` object. For more information about each of the parameters included in the response, see [Create a new creative.](https://developer.moloco.cloud/reference/dspapi_createcreative-1)

## 5. Create a `creative_group` object

You can group Creative entities with similar characteristics under a CreativeGroup entity to make it easier to add them to the campaigns of your choice. To create a `creative_group` object, you must have created one or more `creative` objects as well as a `tracking_link` object.

The following example shows you how you can use your command-line interface to make an API request to generate a `creative_group` object with the request body parameters you have specified as a `.json` file. The parameters you have specified for your new `creative_group` object are saved to the `.json` file and delivered to the Campaign Management API as an HTTP POST request body. For more information about the parameters you can specify, see [Create a new creative group.](https://developer.moloco.cloud/reference/dspapi_createcreativegroup-1)

```shell
$ cat creative_group.json
{
  "ad_account_id": "$AD_ACCOUNT_ID",
  "product_id": "$PRODUCT_ID",
  "title": "Test CreativeGroup",
  "description": "Test CreativeGroup",
  "enabling_state": "ENABLED",
  "status": "APPROVED",
  "tracking_link_id": "$TRACKING_LINK_ID",
  "creative_ids": [
    "$CREATIVE_ID"
  ]
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@creative_group.json" \
  "https://api.moloco.cloud/cm/v1/creative-groups?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "creative_group": {
    "id": "tla69ad6dz2JAUAY",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Test CreativeGroup",
    "description": "Test CreativeGroup",
    "enabling_state": "ENABLED",
    "creative_ids": [
      "$CREATIVE_ID"
    ],
    "status": "APPROVED",
    "action_history": [
      {
        "id": "05fb3aa5-44b9-4943-77c4-90f5f15a31c7",
        "action_type": "CREATE",
        "created_at": "2020-07-01T15:21:05.797660752Z"
      }
    ],
    "tracking_link_id": "$TRACKING_LINK_ID",
    "audience": {},
    "created_at": "2020-07-01T15:21:05.909989Z",
    "updated_at": "2020-07-01T15:21:05.909989Z"
  },
  "creatives": [
    {
      "id": "$CREATIVE_ID",
      "ad_account_id": "$AD_ACCOUNT_ID",
      "title": "Test Image Creative",
      "enabling_state": "ENABLED",
      "ad_account_info": {
        "id": "$AD_ACCOUNT_ID",
        "title": "Ad Account For Tutorial",
        "description": "Ad Account For Tutorial"
      },
      "type": "IMAGE",
      "original_filename": "test_image.jpg",
      "size_in_bytes": 94994,
      "image": {
        "image_url": "$CREATIVE_ASSET_URL",
        "width": 640,
        "height": 960,
        "size_in_bytes": 94994
      },
      "created_at": "2020-07-01T14:54:00.526009Z",
      "updated_at": "2020-07-01T14:54:00.526009Z"
    }
  ],
  "tracking_link": {
    "id": "$TRACKING_LINK_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Tutorial App Tracking Link",
    "description": "Tutorial App Tracking Link",
    "device_os": "ANDROID",
    "click_through_link": {
      "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&ml_ad=%{creative_filename}&ml_ad_id=%{creative_id}&ml_ad_type=%{creative_type}&ml_click_lookback=7d&ml_cost_currency=%{cost_currency}&ml_cost_model=%{cost_type}&ml_cost_value=%{cost_amount}&ml_siteid=%{raw_app_bundle}&ml_sub4=%{source}&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int",
      "status": "UNVERIFIED",
      "unverified_status_data": {
        "stored_at": "2020-07-01T09:50:37Z"
      }
    },
    "view_through_link": {
      "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&ml_ad=%{creative_filename}&ml_ad_id=%{creative_id}&ml_ad_type=%{creative_type}&ml_cost_currency=%{cost_currency}&ml_cost_model=%{cost_type}&ml_cost_value=%{cost_amount}&ml_siteid=%{raw_app_bundle}&ml_sub4=%{source}&ml_viewthrough_lookback=1d&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int",
      "status": "UNVERIFIED",
      "unverified_status_data": {
        "stored_at": "2020-07-01T09:50:37Z"
      }
    },
    "tracking_company": "TRACKFNT",
    "created_at": "2020-07-01T09:50:37.924722Z",
    "updated_at": "2020-07-01T09:50:37.924722Z"
  }
}
```

As in the example, the response includes the Moloco-issued CreativeGroup ID. The CreativeGroup ID is the value of the `id` property in the `creative_group` object. For more information about each of the parameters included in the response, see [Create a new creative group.](https://developer.moloco.cloud/reference/dspapi_createcreativegroup-1)

## 6. Create a `campaign` object

> ❗️ Important:
>
> For campaigns with the following goals (specified as the value of the `type` property under the `goal` object), you must map all events you are tracking for the campaigns before you can create and run them. To learn more, see [Create a `product` object](https://developer.moloco.cloud/docs/campaign-management-api#2-create-a-product-object).
>
> | Value                        | Description                                                                                         |
> | :--------------------------- | :-------------------------------------------------------------------------------------------------- |
> | OPTIMIZE\_CPA\_FOR\_APP\_UA  | The goal is to drive up app installs while satisfying long-term cost per target action (CPA).       |
> | OPTIMIZE\_CPA\_FOR\_APP\_RE  | The goal is to drive up user re-engagement while satisfying long-term cost per target action (CPA). |
> | OPTIMIZE\_ROAS\_FOR\_APP\_UA | The goal is to drive up app installs while satisfying long-term return on ad spend (ROAS).          |
> | OPTIMIZE\_ROAS\_FOR\_APP\_RE | The goal is to drive up user re-engagement while satisfying long-term return on ad spend (ROAS).    |

Finally, you must create a `campaign` object using information from the previous steps.

The following example shows you how you can use your command-line interface to make an API request to generate a `campaign` object with the request body parameters you have specified as a `.json` file. The parameters you have specified for your new `campaign` object are saved to the `.json` file and delivered to the Campaign Management API as an HTTP POST request body. For more information about the parameters you can specify, see [Create a new campaign.](https://developer.moloco.cloud/reference/dspapi_createcampaign-1)

```shell
$ cat campaign.json
{
  "campaign": {
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Test Campaign",
    "description": "Test Campaign",
    "enabling_state": "ENABLED",
    "type": "APP_USER_ACQUISITION",
    "device_os": "ANDROID",
    "country": "KOR",
    "currency": "USD",
    "schedule": {
      "start": "2020-07-01T07:00:00Z"
    },
    "budget_schedule": {
      "daily_budget": {
        "daily_budget": {
          "currency": "USD",
          "amount_micros": "1000000"
        }
      }
    },
    "tracking_company": "TRACKFNT",
    "goal": {
      "type": "OPTIMIZE_CPI_FOR_APP_UA",
      "optimize_app_installs": {
        "mode": "TARGET_CPI_CENTRIC",
        "target_cpi": {
          "currency": "USD",
          "amount_micros": "1000000"
        }
      }
    }
  },
  "ad_group": {
    "title": "Test AdGroup",
    "enabling_state": "ENABLED",
    "audience": {},
    "capper": {
      "imp_interval": {
        "amount": "12",
        "unit": "HOUR"
      }
    },
    "creative_group_ids": [
      "$CREATIVE_GROUP_ID"
    ]
  }
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@campaign.json" \
  "https://api.moloco.cloud/cm/v1/campaigns?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "campaign": {
    "id": "$CAMPAIGN_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Test Campaign",
    "description": "Test Campaign",
    "enabling_state": "ENABLED",
    "type": "APP_USER_ACQUISITION",
    "device_os": "ANDROID",
    "state": "SUBMITTED",
    "country": "KOR",
    "currency": "USD",
    "schedule": {
      "start": "2020-07-01T07:00:00Z"
    },
    "budget_schedule": {
      "daily_budget": {
        "daily_budget": {
          "currency": "USD",
          "amount_micros": "1000000"
        }
      }
    },
    "audience": {
      "shared_audience_target_ids": [],
      "targeting_condition": {
        "allowed_exchanges": [
          "ADX",
          "MOPUB",
          "UNITY"
        ]
      }
    },
    "tracking_company": "TRACKFNT",
    "goal": {
      "type": "OPTIMIZE_APP_INSTALLS",
      "optimize_app_installs": {
        "mode": "TARGET_CPI_CENTRIC",
        "target_cpi": {
          "currency": "USD",
          "amount_micros": "1000000"
        }
      }
    },
    "created_at": "2020-07-01T15:34:43.323228Z",
    "updated_at": "2020-07-01T15:34:43.323228Z"
  }
}
```

As in the example, the response includes the Campaign ID, which is the value of the `id` property of the `campaign` object. For more information about each of the parameters included in the response, see [Create a new campaign.](https://developer.moloco.cloud/reference/dspapi_createcampaign-1)

After a `campaign` object has been created, the `state` property indicating campaign status is set to `SUBMITTED` by default. When the ML model for the campaign is ready, campaign status is updated to either `READY ` or `UPCOMING` depending on the value of the `enabling_state` property. Campaign status is updated to `READY` when the value of the `enabling_state` property is set to `DISABLED`.  Campaign status is updated to `UPCOMING` when the value of the `enabling_state` property is set to `ENABLED`.

> Note: It usually takes about 2 hours for the ML model for your campaign to finish training.

On the date and time campaign is scheduled to start running, campaign status is updated to `PAUSED` when the value of the `enabling_state` property is set to `DISABLED` or `ACTIVE` when the value of the `enabling_state` property is set to `ENABLED`. When campaign status is `ACTIVE`, the creatives added to the campaign are live on Moloco Ads, and the campaign can start bidding. To learn how to track campaign performance, see [Report API](https://developer.moloco.cloud/docs/report-api) and [Log API](https://developer.moloco.cloud/docs/log-api).

In the event that the campaign has a specified end date, campaign status is updated to `COMPLETED` on the date and time campaign is scheduled to end.

> Note: When a campaign has been deleted, the campaign status is updated to `COMPLETED`. Campaigns that have been in `PAUSED` status for more than 180 days are converted to `COMPLETED` and subsequently deleted in compliance with Moloco's [data access policy](https://help.moloco.com/hc/en-us/articles/11111419909655-Data-access-policy).

# Next steps

You can create CustomerSet objects and AudienceTarget entities to create targets for your campaigns. To learn how to do so, see [Create a target for your campaigns](https://developer.moloco.cloud/docs/create-a-target-audience-for-your-campaign).