Skip to end of metadata
Go to start of metadata

Custom Model Service

This service is currently available to a limited set of clients.

The Custom Model service lets you add and maintain custom predictive models (decision trees) for use in campaigns. For background information, see AppNexus Programmable Bidder (customer login required).

Before adding a custom model, use the Custom Model Parser Service to check the validity and size of your decision tree.

On This Page

REST API

Add a new custom model:

Modify a custom model:

View all custom models:  

View a specific custom model: 

Delete a custom model: 

You cannot delete a custom model that is used by one or more campaigns.

Find out which fields you can filter and sort by:

JSON Fields

Field

Type (Length)

Description

Default

Required On

id

int

The ID of the custom model.

Auto-generated number

PUT/ DELETE, in query string

namestring (191)The name of the custom model. This must be unique and must be no more than 191 characters. POST
code
stringA custom code that is used as an external ID or as a look-up value for an object. This value must be unique within your member.  

member_id

intRead-only. The ID of the member to which the custom model belongs.Member's ID 
advertiser_idintThe ID of the advertiser to which the custom model belongs. POST
custom_model_structureenumThe structure of the custom model. Currently, the only allowed structure is "decision_tree". POST
model_outputenum

The type of custom model. Possible values:

  • "bid": The Bid Price model outputs a CPM bid. This type of model serves as a campaign's third-party buying strategy in place of standard CPM strategies. To use this type of model in a campaign, set cpm_bid_type to "custom_model" and then specify the custom model ID in the bid_model object.
  • "bid_modifier": The Bid Modifier model applies a multiplier to a campaign's optimization-derived CPM bid. This type of model is used in conjunction with an AppNexus optimization-based buying strategy (when cpm_bid_type is "predicted" or "margin"). To use this type of model in a campaign, specify the custom model ID in the bid_modifier_model object.
 POST
model_textstring

The logic of the model, expressed as a decision tree. You must write your decision tree in our Bonsai Language and then include a base64-encoded version here.

Size Limit

Although it is not visible in the response, AppNexus stores your tree in Lisp format. This internal representation tends to be smaller in size, as it has less whitespace and uses ID numbers instead of names and other values. The Lisp version of your tree must be smaller than 3 MB, or 3,145,728 bytes. If it is larger than that, you will not be able to add your tree.

GET queries

In a GET query, the model_text will ONLY be returned if you provide a model ID in the query string. It will not be returned for unfiltered queries.

Check the Validity and Size of Your Tree

Before adding a custom model, use the Custom Model Parser Service to check the validity and size of your decision tree. See that service for details about validation and error messages.

null 
original_textstring

Read-only. The decision tree in plain text. We provide this in the response so that you can retrieve and review your tree's original format whenever necessary to iterate on tree design. Note that tabs are replaced with \t and new lines are replaced with \n.

GET queries

In a GET query, the original_text will ONLY be returned if you identify a specific model ID in the query string. It will not be returned for unfiltered queries.

null 
activeBooleanIf true, the custom model is active and available for use in campaigns.true 
last_modifieddateRead-only. The date and time when the custom model was last modified.  

Examples

View all custom models
View a specific custom model
Add a custom model
Modify a custom model
Delete a custom model

Related Topics