Skip to main content
POST
/
console
/
v1
/
experiments
/
qualifying_events
Create Qualifying Event
curl --request POST \
  --url https://statsigapi.net/console/v1/experiments/qualifying_events \
  --header 'Content-Type: application/json' \
  --header 'STATSIG-API-KEY: <api-key>' \
  --data '{
  "name": "<string>",
  "description": "<string>",
  "tags": [
    "<string>"
  ],
  "sql": "<string>",
  "timestampColumn": "<string>",
  "timestampAsDay": true,
  "idTypeMapping": [
    {
      "statsigUnitID": "<string>",
      "column": "<string>"
    }
  ],
  "sourceType": "table",
  "tableName": "<string>",
  "datePartitionColumn": "<string>",
  "customFieldMapping": [
    {
      "key": "<string>",
      "formula": "<string>"
    }
  ],
  "isReadOnly": true,
  "isVerified": false,
  "owner": {
    "ownerID": "user123",
    "ownerType": "USER",
    "ownerName": "John Doe",
    "ownerEmail": "owner123@test.com"
  },
  "team": "<string>",
  "teamID": "<string>",
  "dryRun": true
}'
{
  "message": "Qualifying event created successfully.",
  "data": {
    "name": "test_qualifying_event",
    "description": "Test description for qualifying event",
    "tags": [
      "non_production"
    ],
    "sql": "SELECT * FROM `shoppy-sales.logging.events`",
    "timestampColumn": "ts",
    "timestampAsDay": true,
    "idTypeMapping": [
      {
        "statsigUnitID": "userID",
        "column": "user_id"
      }
    ],
    "sourceType": "table",
    "tableName": "shoppy-sales.logging.events"
  }
}

Authorizations

STATSIG-API-KEY
string
header
required

Headers

x-respect-review-settings
string

Optional header to respect review settings for mutation endpoints.

Body

application/json
name
string
required

The name of the source, serving as its primary identifier.

sql
string
required

The SQL query or statement used to extract data from the source.

timestampColumn
string
required

The name of the column containing timestamp data for the source.

idTypeMapping
object[]
required

Array defining the mapping between Statsig unit IDs and their respective source columns.

description
string

An optional description for the source, providing context and details about its purpose and usage.

tags
string[]

Optional array of tags to categorize the source, facilitating easier organization and retrieval.

timestampAsDay
boolean

Indicates whether the timestamp should be treated as a day-level granularity.

sourceType
enum<string>

The type of source, indicating whether it is a database table or a custom query.

Available options:
table,
query
tableName
string

The name of the database table if the source type is "table".

datePartitionColumn
string

The name of the date partition column if the source type is "table". Can be undefined.

customFieldMapping
object[]

Optional array defining mappings for custom fields using specific formulas.

isReadOnly
boolean

Specifies if the source can only be edited via the Console API.

isVerified
boolean

Marks the metric source as verified, indicating trustworthiness within the organization.

Example:

false

owner
object | null

Schema for owner data including ID, type, name. Note that if Entity is created by CONSOLE API, owner will be undefined.

Example:
{
"ownerID": "user123",
"ownerType": "USER",
"ownerName": "John Doe",
"ownerEmail": "owner123@test.com"
}
team
string | null

Optional field indicating the team name responsible for the metric, aiding in accountability and management.

teamID
string | null

Optional field indicating the team ID responsible for the metric, aiding in accountability and management.

dryRun
boolean

Skips persisting the source (used to validate that inputs are correct)

Response

Create qualifying event response

message
string
required

A simple string explaining the result of the operation.

data
object
required

A single result.

I