Recast Knowledge Base
Breadcrumbs

Helper Endpoints

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.

  1. GET /kpis - returns all KPIs you have configured in your app.

  2. GET /kpis/[kpi-id] returns the current depvar_configurations with the latest deployments and spikes for a given KPI.

  3. POST /kpis - creates a KPI.

  4. PATCH /kpis/[kpi-id] - updates a KPI.

  5. DELETE /kpis/[kpi-id] - deletes a KPI.

Creating and editing a KPI

Both POST and PATCH take a form:

JSON
{
  "form": {
    "name": "Walmart Revenue",
    "slug": "walmart_revenue",
    "model_type": "roi",
    "depvars": [
      { "slug": "walmart_us", "weight": 1 },
      { "slug": "walmart_ca", "weight": 0.5 }
    ]
  }
}
  1. name - how the KPI appears in the app.

  2. slug - a unique identifier for the KPI. Lowercase letters, numbers and underscores only.

  3. model_type - either roi or cpa.

  4. depvars - the models to combine, each with a weight.

    1. Each slug must be the dashboard slug of one of your individual dashboards. Aggregate dashboards can't be used in a KPI.

    2. Weights are relative. In the example above, walmart_us counts twice as heavily as walmart_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.

  1. GET /deployments - returns all deployments available in your app.

    1. dashboad_slug can be used to narrow down to a single dashboard.

  2. GET /deployments/[deployments-id] returns a summary of that deployment, including:

    1. active - boolean

    2. dashboard_slug - what dashboard it's connected to

    3. model_date - the last day included in the model

    4. spend - an array of the historical spend. You must specify that you want this using the extra_fields argument.

    5. default_budget - A default business as usual budget. You must specify that you want this using the extra_fields argument.

    6. drop_days - Recast predicted frequency of spend in each channel for use in the Optimizer. You must specify that you want this using the extra_fields argument.

    7. upper_funnel_channel_labels - the names of the upper funnel channels

    8. lower_funnel_channel_labels - the names of the lower funnel channels

    9. spend_channels_labels - the names of the spend channels

    10. non_spend_channels_labels - the names of the non-spend channels

    11. 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