The following endpoints are for your convenience when working with the other endpoints.
KPIs
A KPI is a weighted combination of one or more of your models. It's what you point the Optimizer and Forecaster at when you want them to target a metric.
-
GET /kpis - returns all KPIs you have configured in your app.
-
GET /kpis/[kpi-id] returns the current depvar_configurations with the latest deployments and spikes for a given KPI.
-
POST /kpis - creates a KPI.
-
PATCH /kpis/[kpi-id] - updates a KPI.
-
DELETE /kpis/[kpi-id] - deletes a KPI.
Creating and editing a KPI
Both POST and PATCH take a form:
{
"form": {
"name": "Walmart Revenue",
"slug": "walmart_revenue",
"model_type": "roi",
"depvars": [
{ "slug": "walmart_us", "weight": 1 },
{ "slug": "walmart_ca", "weight": 0.5 }
]
}
}
-
name- how the KPI appears in the app. -
slug- a unique identifier for the KPI. Lowercase letters, numbers and underscores only. -
model_type- eitherroiorcpa. -
depvars- the models to combine, each with a weight.-
Each
slugmust be the dashboard slug of one of your individual dashboards. Aggregate dashboards can't be used in a KPI. -
Weights are relative. In the example above,
walmart_uscounts twice as heavily aswalmart_ca. Use weights to put two models on the same scale. For example, weighting a conversions model by your average revenue per conversion so it can be optimized alongside a revenue model.
-
POST requires all four fields and returns the new KPI's id.
PATCH accepts any subset of the fields and only updates those fields.
Changing a KPI's models or weights re-runs the forecasts for any Plan that use it.
Deployments
A deployment is a specific run of a model. Each weekly update of your model will receive a new deployment ID.
-
GET /deployments - returns all deployments available in your app.
-
dashboad_slugcan be used to narrow down to a single dashboard.
-
-
GET /deployments/[deployments-id] returns a summary of that deployment, including:
-
active- boolean -
dashboard_slug- what dashboard it's connected to -
model_date- the last day included in the model -
spend- an array of the historical spend. You must specify that you want this using theextra_fieldsargument. -
default_budget- A default business as usual budget. You must specify that you want this using theextra_fieldsargument. -
drop_days- Recast predicted frequency of spend in each channel for use in the Optimizer. You must specify that you want this using theextra_fieldsargument. -
upper_funnel_channel_labels- the names of the upper funnel channels -
lower_funnel_channel_labels- the names of the lower funnel channels -
spend_channels_labels- the names of the spend channels -
non_spend_channels_labels- the names of the non-spend channels -
contextual_variable_defaults- The names and default values for contextual variables
-
Several of the Recast endpoints allow you to provide the deployment on which you want to run your analysis. We support the use of deployments up to 6 months after they are deployed.
More information available in Swagger