Scopes

Which predictions you want on which people

In order to understand what predictions you may need, Faraday allows you to declare one or more Scopes. These scopes provide a pre-computation boundary so that Faraday's deployment system can continuously deliver what you need.

Scopes

A scope consists of two things:

  1. Population — who will you want to retrieve predictions about?
  2. Payload — what predictions about them will you want to retrieve?

Defining

You'll use POST /scopes to define your scopes. Here's the main part of the query:

curl --request POST \
     --url https://api.faraday.io/v1/scopes \
     --header 'Authorization: Bearer YOUR_API_TOKEN' \
     --header 'Content-Type: application/json' \
     --data '
{
  ...
}
'

You will need to specify the two parameters above (population and payload) in the JSON POST data as follows.

Population

When creating a scope, you list one or more cohorts that together serve as the scope's population. If you use multiple cohorts, they are unioned (OR) to produce a single population with no duplicates.

{
     "population": {
          "cohort_ids": [
               "A_COHORT_ID",
               "ANOTHER_COHORT_ID",
               ...
          ]
     },
     ...
}
'

Payload

You will also choose one or more elements to comprise your scope's payload. These can include:

  • Outcomespropensity objectives
  • Persona Setspersona objectives
  • Attributes (private beta) — Include raw data in your scope
  • Cohorts (private beta) — Include cohort membership flags in your scope
{
  ...
     "payload": {
          "outcome_ids": [
               "YOUR_OUTCOME_ID"
          ],
          "persona_set_ids": [
               "YOUR_PERSONA_SET_ID"
          ]
     }
}
'

Complete scope example

curl --request POST \
     --url https://api.faraday.io/v1/scopes \
     --header 'Authorization: Bearer YOUR_API_TOKEN' \
     --header 'Content-Type: application/json' \
     --data '
{
     "payload": {
          "persona_set_ids": [
               "YOUR_PERSONA_SET_ID"
          ]
     },
     "population": {
          "cohort_ids": [
               "YOUR_COHORT_ID"
          ]
     },
     "name": "SCOPE_NAME"
}
'

What's next

Now set up where you want your predictions to go with Targets