Campaigns API (xx.xx.xx)

MediaMath Platform API

Download OpenAPI description
Languages
Servers
Mock server
https://apidocs.mediamath.com/_mock/apis/campaigns-api/openapi/

Organizations

Organizations

Operations

Agencies

Agencies

Operations

Advertisers

Advertisers

Operations

Campaigns

Campaigns

Operations

Get A Specific Campaign

Request

Get a campaign by id

Path
campaign_idintegerrequired

Numeric ID of the campaign to get

curl -i -X GET \
  'https://apidocs.mediamath.com/_mock/apis/campaigns-api/openapi/campaigns/{campaign_id}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

Responses

OK

Bodyapplication/json
dataobject(campaign_full)
metaobject(single_metadata)
Response
application/json
{ "data": { "archived": false, "status": true, "name": "string", "service_type": "SELF", "io_name": "string", "io_reference_num": "string", "is_programmatic_guaranteed": true, "political": false, "source_campaign_id": 0, "zone_name": "string", "id": 0, "version": 0, "advertiser_id": 0, "created_on": "2019-08-24T14:15:22Z", "updated_on": "2019-08-24T14:15:22Z", "identity": {}, "ad_server": {}, "duration": {}, "goals": {}, "budget": {}, "frequency_cap": {}, "pacing": {}, "inventory": {}, "attribution": {}, "budget_flights": [], "viewability": {}, "vendor_contracts": [], "site_lists": [], "custom_brain_selections": [], "strategies": {}, "strategy_groups": {} }, "meta": { "status": "success" } }

Update A Campaign

Request

Update a campaign by id

Path
campaign_idintegerrequired

Numeric ID of the campaign to update

Bodyapplication/json
archivedboolean
Default false
statusboolean
Default true
namestring[ 1 .. 256 ] charactersrequired
service_typestringrequired
Enum"SELF""MANAGED"
io_namestring<= 256 characters
io_reference_numstring<= 32 characters
is_programmatic_guaranteedboolean
politicalboolean
Default false
source_campaign_idinteger or null
zone_namestringnon-empty
advertiser_idinteger>= 1
identityobject(campaign_identity)
ad_serverobject(campaign_ad_server)
goalsobject(campaign_goals)
budgetobjectrequired
budget.​currency_codestring= 3 charactersrequired
Example: "USD"
budget.​margin_pctnumber(float)[ 0 .. 9999999.9999 ]required
budget.​dynamic_budget_allocation_typestring
Default "OFF"
Enum"SBA_AUTO_ALLOCATION""SBA_RECOMMENDATIONS_ONLY""OFF"
budget.​dynamic_budget_allocation_appliedstring(date-time)
budget.​dynamic_budget_allocation_availablestring(date-time)
budget.​flightsArray of objects(campaign_budget_flights)non-emptyrequired
budget.​flights[].​start_datestring(date-time)
budget.​flights[].​end_datestring(date-time)
budget.​flights[].​total_budgetnumber(float)
budget.​flights[].​total_impression_budgetinteger or null
frequencyobject(campaign_frequency)
pacingobject(campaign_pacing)
inventoryobject(campaign_inventory)
attributionobject(campaign_attribution)
viewabilityobject or null(campaign_viewability)
vendor_contractsArray of objects(vendor_contract)
site_listsArray of objects
custom_brain_selectionsArray of objects
curl -i -X POST \
  'https://apidocs.mediamath.com/_mock/apis/campaigns-api/openapi/campaigns/{campaign_id}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "archived": false,
    "status": true,
    "name": "string",
    "service_type": "SELF",
    "io_name": "string",
    "io_reference_num": "string",
    "is_programmatic_guaranteed": true,
    "political": false,
    "source_campaign_id": 0,
    "zone_name": "string",
    "advertiser_id": 1,
    "identity": {
      "device_graph_only": false,
      "bid_min_devices": 1,
      "connected_id_type": "DETERMINISTIC_FIRST"
    },
    "ad_server": {
      "ad_server_id": 0,
      "ad_server_username": "string",
      "ad_server_password": "string",
      "use_default_ad_server": true,
      "ad_server_fee": 9999999.99
    },
    "goals": {
      "goal_type": "spend",
      "goal_alert": 9999999.99,
      "goal_value": 0.0001,
      "goal_category": "audience"
    },
    "budget": {
      "currency_code": "USD",
      "margin_pct": 9999999.9999,
      "dynamic_budget_allocation_type": "SBA_AUTO_ALLOCATION",
      "dynamic_budget_allocation_applied": "2019-08-24T14:15:22Z",
      "dynamic_budget_allocation_available": "2019-08-24T14:15:22Z",
      "flights": [
        {
          "start_date": "2019-08-24T14:15:22Z",
          "end_date": "2019-08-24T14:15:22Z",
          "total_budget": 0.1,
          "total_impression_budget": 0
        }
      ]
    },
    "frequency": {
      "frequency_type": "even",
      "frequency_interval": "hour",
      "frequency_amount": 0,
      "use_mm_freq": false,
      "frequency_optimization": false
    },
    "pacing": {
      "pacing_alert": 0,
      "impression_cap_automatic": false,
      "impression_cap_amount": 0,
      "impression_cap_type": "even",
      "spend_cap_type": "even",
      "spend_cap_amount": 0,
      "spend_cap_automatic": true,
      "brain_intraday_pacing": false
    },
    "inventory": {
      "ads_txt_verified": "ANY",
      "minimize_multi_ads": false,
      "override_suspicious_traffic_filter": false,
      "suspicious_traffic_filter_level": 25,
      "dcs_data_is_campaign_level": false,
      "restrict_targeting_to_deterministic_id": false,
      "restrict_targeting_to_same_device_id": true
    },
    "attribution": {
      "has_custom_attribution": false,
      "custom_attribution_source": "3rd Party Attribution",
      "pc_window_minutes": 0,
      "pv_window_minutes": 0,
      "pv_pct": 100,
      "merit_pixel_id": 0,
      "conversion_type": "every",
      "conversion_variable_minutes": 1
    },
    "viewability": {
      "vendor_id": 0,
      "type": "AUTO_TAG",
      "sample_rate": 1
    },
    "vendor_contracts": [
      {
        "vendor_id": 0,
        "use_mm_contract": true,
        "price": 0.1,
        "rate_card_type": "CPM",
        "site_lists": {
          "id": 0,
          "name": "string",
          "version": 0,
          "status": true,
          "organization_id": 0,
          "restriction": "string",
          "filename": "string",
          "campaign_id": 0,
          "assigned": true,
          "sites_count": 0,
          "sites_count_app": 0,
          "sites_count_domain": 0
        }
      }
    ],
    "site_lists": [
      {
        "id": 0,
        "assigned": true
      }
    ],
    "custom_brain_selections": [
      {
        "selection_id": 0,
        "selection_type": "Audience Target"
      }
    ]
  }'

Responses

campaign response

Bodyapplication/json
dataobject(campaign_full)
metaobject(single_metadata)
Response
application/json
{ "data": { "archived": false, "status": true, "name": "string", "service_type": "SELF", "io_name": "string", "io_reference_num": "string", "is_programmatic_guaranteed": true, "political": false, "source_campaign_id": 0, "zone_name": "string", "id": 0, "version": 0, "advertiser_id": 0, "created_on": "2019-08-24T14:15:22Z", "updated_on": "2019-08-24T14:15:22Z", "identity": {}, "ad_server": {}, "duration": {}, "goals": {}, "budget": {}, "frequency_cap": {}, "pacing": {}, "inventory": {}, "attribution": {}, "budget_flights": [], "viewability": {}, "vendor_contracts": [], "site_lists": [], "custom_brain_selections": [], "strategies": {}, "strategy_groups": {} }, "meta": { "status": "success" } }

List Campaigns

Request

Get a list of campaigns. The data fetched for each campaign depends on the values of query params. For example, if you use query parameter full; all properties are fetched.

Query
page_limitinteger[ 1 .. 1000 ]

Number of elements in the collection to retrieve

Example: page_limit=100
page_offsetinteger[ 0 .. 1000 ]

Index of the first element in the collection to retrieve

Example: page_offset=0
sort_bystring

The field to sort by. You can use any field name in ascending or descending order. For ascending order, use the field name directly, e.g., id. For descending order, prefix the field name with a hyphen (-), e.g., -id.

Example: sort_by=id, -id, name, -name
qstring

Query search for filtering. This parameter can be used to filter results based on various fields.

  • q=name=:{search}* to find all results with names starting with "search".
  • q=status==true to find all active entities.
  • q=id>=1000 to find all entities with id greater than or equal to 1000.
fullstring

Use this parameter to specify which properties to include in the response. To return all fields, set the value to *. For example, full=* will include all properties

Example: full=*
curl -i -X GET \
  'https://apidocs.mediamath.com/_mock/apis/campaigns-api/openapi/campaigns?full=*&page_limit=100&page_offset=0&q=string&sort_by=id%2C%20-id%2C%20name%2C%20-name' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

Responses

OK

Bodyapplication/json
Any of:
dataArray of objects
metaobject(pagination metadata)
Response
application/json
{ "data": [ {} ], "meta": { "status": "success", "count": 10, "total_count": 100, "offset": 0, "next_page": "string", "prev_page": "string" } }

Create A Campaign

Request

Create a campaign

Bodyapplication/json
archivedboolean
Default false
statusboolean
Default true
namestring[ 1 .. 256 ] charactersrequired
service_typestringrequired
Enum"SELF""MANAGED"
io_namestring<= 256 characters
io_reference_numstring<= 32 characters
is_programmatic_guaranteedboolean
politicalboolean
Default false
source_campaign_idinteger or null
zone_namestringnon-empty
advertiser_idinteger>= 1
identityobject(campaign_identity)
ad_serverobject(campaign_ad_server)
goalsobject(campaign_goals_create)
budgetobjectrequired
budget.​currency_codestring= 3 charactersrequired
Example: "USD"
budget.​margin_pctnumber(float)[ 0 .. 9999999.9999 ]required
budget.​dynamic_budget_allocation_typestring
Default "OFF"
Enum"SBA_AUTO_ALLOCATION""SBA_RECOMMENDATIONS_ONLY""OFF"
budget.​dynamic_budget_allocation_appliedstring(date-time)
budget.​dynamic_budget_allocation_availablestring(date-time)
budget.​flightsArray of objects(campaign_budget_flights)non-emptyrequired
budget.​flights[].​start_datestring(date-time)
budget.​flights[].​end_datestring(date-time)
budget.​flights[].​total_budgetnumber(float)
budget.​flights[].​total_impression_budgetinteger or null
frequencyobject(campaign_frequency)
pacingobject(campaign_pacing)
inventoryobject(campaign_inventory)
attributionobject(campaign_attribution)
viewabilityobject or null(create_campaign_viewability)
vendor_contractsArray of objects(vendor_contract)
site_listsArray of objects