Create a single interleaving
curl -X POST 'https://api.growthbook.io/api/v1/interleavings' \
-H 'Authorization: Bearer YOUR_API_KEY'import requests
url = "https://api.growthbook.io/api/v1/interleavings"
payload = {
"name": "<string>",
"key": "<string>",
"variations": [],
"datasource": "<string>",
"interleavingQueryId": "<string>",
"userIdType": "<string>",
"description": "<string>",
"project": "<string>",
"owner": "<string>",
"tags": ["<string>"],
"trackingKey": "<string>",
"hashAttribute": "<string>",
"metrics": [
{
"id": "<string>",
"analyses": [{ "type": "paired" }]
}
],
"coverage": 0.5,
"condition": "<string>",
"savedGroups": [{ "ids": ["<string>"] }],
"prerequisites": [
{
"id": "<string>",
"condition": "<string>"
}
],
"environmentSettings": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
key: '<string>',
variations: [],
datasource: '<string>',
interleavingQueryId: '<string>',
userIdType: '<string>',
description: '<string>',
project: '<string>',
owner: '<string>',
tags: ['<string>'],
trackingKey: '<string>',
hashAttribute: '<string>',
metrics: [{id: '<string>', analyses: [{type: 'paired'}]}],
coverage: 0.5,
condition: '<string>',
savedGroups: [{ids: ['<string>']}],
prerequisites: [{id: '<string>', condition: '<string>'}],
environmentSettings: {}
})
};
fetch('https://api.growthbook.io/api/v1/interleavings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.growthbook.io/api/v1/interleavings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'key' => '<string>',
'variations' => [
],
'datasource' => '<string>',
'interleavingQueryId' => '<string>',
'userIdType' => '<string>',
'description' => '<string>',
'project' => '<string>',
'owner' => '<string>',
'tags' => [
'<string>'
],
'trackingKey' => '<string>',
'hashAttribute' => '<string>',
'metrics' => [
[
'id' => '<string>',
'analyses' => [
[
'type' => 'paired'
]
]
]
],
'coverage' => 0.5,
'condition' => '<string>',
'savedGroups' => [
[
'ids' => [
'<string>'
]
]
],
'prerequisites' => [
[
'id' => '<string>',
'condition' => '<string>'
]
],
'environmentSettings' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.growthbook.io/api/v1/interleavings"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"variations\": [],\n \"datasource\": \"<string>\",\n \"interleavingQueryId\": \"<string>\",\n \"userIdType\": \"<string>\",\n \"description\": \"<string>\",\n \"project\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"trackingKey\": \"<string>\",\n \"hashAttribute\": \"<string>\",\n \"metrics\": [\n {\n \"id\": \"<string>\",\n \"analyses\": [\n {\n \"type\": \"paired\"\n }\n ]\n }\n ],\n \"coverage\": 0.5,\n \"condition\": \"<string>\",\n \"savedGroups\": [\n {\n \"ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prerequisites\": [\n {\n \"id\": \"<string>\",\n \"condition\": \"<string>\"\n }\n ],\n \"environmentSettings\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.growthbook.io/api/v1/interleavings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"variations\": [],\n \"datasource\": \"<string>\",\n \"interleavingQueryId\": \"<string>\",\n \"userIdType\": \"<string>\",\n \"description\": \"<string>\",\n \"project\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"trackingKey\": \"<string>\",\n \"hashAttribute\": \"<string>\",\n \"metrics\": [\n {\n \"id\": \"<string>\",\n \"analyses\": [\n {\n \"type\": \"paired\"\n }\n ]\n }\n ],\n \"coverage\": 0.5,\n \"condition\": \"<string>\",\n \"savedGroups\": [\n {\n \"ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prerequisites\": [\n {\n \"id\": \"<string>\",\n \"condition\": \"<string>\"\n }\n ],\n \"environmentSettings\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.growthbook.io/api/v1/interleavings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"variations\": [],\n \"datasource\": \"<string>\",\n \"interleavingQueryId\": \"<string>\",\n \"userIdType\": \"<string>\",\n \"description\": \"<string>\",\n \"project\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"trackingKey\": \"<string>\",\n \"hashAttribute\": \"<string>\",\n \"metrics\": [\n {\n \"id\": \"<string>\",\n \"analyses\": [\n {\n \"type\": \"paired\"\n }\n ]\n }\n ],\n \"coverage\": 0.5,\n \"condition\": \"<string>\",\n \"savedGroups\": [\n {\n \"ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prerequisites\": [\n {\n \"id\": \"<string>\",\n \"condition\": \"<string>\"\n }\n ],\n \"environmentSettings\": {}\n}"
response = http.request(request)
puts response.read_body{
"interleaving": {
"id": "<string>",
"dateCreated": "2023-11-07T05:31:56Z",
"dateUpdated": "2023-11-07T05:31:56Z",
"name": "<string>",
"owner": "<string>",
"tags": [
"<string>"
],
"archived": true,
"status": "draft",
"key": "<string>",
"trackingKey": "<string>",
"hashAttribute": "<string>",
"seed": "<string>",
"variations": [
{
"id": "<string>",
"key": "<string>",
"name": "<string>",
"config": "<string>",
"description": "<string>"
}
],
"jsonSchema": {
"schemaType": "schema",
"schema": "<string>",
"simple": {
"type": "object",
"fields": [
{
"key": "<string>",
"type": "integer",
"required": true,
"default": "<string>",
"description": "<string>",
"enum": [
"<string>"
],
"min": 123,
"max": 123,
"nullable": true,
"jsonSchema": "<string>"
}
],
"additionalProperties": true,
"invariants": [
{
"name": "<string>",
"rule": "<string>",
"message": "<string>"
}
]
},
"enabled": true,
"date": "2023-11-07T05:31:56Z"
},
"datasource": "<string>",
"interleavingQueryId": "<string>",
"userIdType": "<string>",
"metrics": [
{
"id": "<string>",
"analyses": [
{
"type": "paired"
}
]
}
],
"environmentSettings": {},
"description": "<string>",
"project": "<string>",
"ownerEmail": "<string>",
"dateStarted": "2023-11-07T05:31:56Z",
"dateStopped": "2023-11-07T05:31:56Z",
"coverage": 0.5,
"condition": "<string>",
"savedGroups": [
{
"match": "all",
"ids": [
"<string>"
]
}
],
"prerequisites": [
{
"id": "<string>",
"condition": "<string>"
}
]
}
}{
"confirmation": {
"id": "<string>",
"status": "pending",
"actions": [
{
"action": "feature.create",
"environments": [
"<string>"
]
}
],
"summary": "<string>",
"url": "<string>",
"expiresAt": "<string>",
"response": {
"status": 123,
"body": "<unknown>"
},
"note": "<string>"
},
"message": "<string>"
}Authorizations
If using Bearer auth, pass the Secret Key as the token:
curl https://api.growthbook.io/api/v1/features -H "Authorization: Bearer secret_abc123DEF456"
Body
The key your code passes to interleave() as ranker. Can't be changed later. Several experiments may share a key so you can iterate without changing code, but only one of them can be running in a given environment, and each needs its own trackingKey.
^[a-zA-Z0-9_.:\|\-]+$Exactly two rankers. Users who are not exposed to interleaved rankings get the first ranker's list.
Show child attributes
Show child attributes
10000The userId or email address of the owner. If an email address is provided, it will be used to look up the userId of the matching organization member. If an ID is provided, it will be validated as existing in the organization.
The experiment_id recorded in exposures. Defaults to key.
Validation schema to stage on the draft. The server sets date, so don't send it.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
0 <= x <= 1Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Resource created
Show child attributes
Show child attributes
Was this page helpful?
curl -X POST 'https://api.growthbook.io/api/v1/interleavings' \
-H 'Authorization: Bearer YOUR_API_KEY'import requests
url = "https://api.growthbook.io/api/v1/interleavings"
payload = {
"name": "<string>",
"key": "<string>",
"variations": [],
"datasource": "<string>",
"interleavingQueryId": "<string>",
"userIdType": "<string>",
"description": "<string>",
"project": "<string>",
"owner": "<string>",
"tags": ["<string>"],
"trackingKey": "<string>",
"hashAttribute": "<string>",
"metrics": [
{
"id": "<string>",
"analyses": [{ "type": "paired" }]
}
],
"coverage": 0.5,
"condition": "<string>",
"savedGroups": [{ "ids": ["<string>"] }],
"prerequisites": [
{
"id": "<string>",
"condition": "<string>"
}
],
"environmentSettings": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
key: '<string>',
variations: [],
datasource: '<string>',
interleavingQueryId: '<string>',
userIdType: '<string>',
description: '<string>',
project: '<string>',
owner: '<string>',
tags: ['<string>'],
trackingKey: '<string>',
hashAttribute: '<string>',
metrics: [{id: '<string>', analyses: [{type: 'paired'}]}],
coverage: 0.5,
condition: '<string>',
savedGroups: [{ids: ['<string>']}],
prerequisites: [{id: '<string>', condition: '<string>'}],
environmentSettings: {}
})
};
fetch('https://api.growthbook.io/api/v1/interleavings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.growthbook.io/api/v1/interleavings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'key' => '<string>',
'variations' => [
],
'datasource' => '<string>',
'interleavingQueryId' => '<string>',
'userIdType' => '<string>',
'description' => '<string>',
'project' => '<string>',
'owner' => '<string>',
'tags' => [
'<string>'
],
'trackingKey' => '<string>',
'hashAttribute' => '<string>',
'metrics' => [
[
'id' => '<string>',
'analyses' => [
[
'type' => 'paired'
]
]
]
],
'coverage' => 0.5,
'condition' => '<string>',
'savedGroups' => [
[
'ids' => [
'<string>'
]
]
],
'prerequisites' => [
[
'id' => '<string>',
'condition' => '<string>'
]
],
'environmentSettings' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.growthbook.io/api/v1/interleavings"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"variations\": [],\n \"datasource\": \"<string>\",\n \"interleavingQueryId\": \"<string>\",\n \"userIdType\": \"<string>\",\n \"description\": \"<string>\",\n \"project\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"trackingKey\": \"<string>\",\n \"hashAttribute\": \"<string>\",\n \"metrics\": [\n {\n \"id\": \"<string>\",\n \"analyses\": [\n {\n \"type\": \"paired\"\n }\n ]\n }\n ],\n \"coverage\": 0.5,\n \"condition\": \"<string>\",\n \"savedGroups\": [\n {\n \"ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prerequisites\": [\n {\n \"id\": \"<string>\",\n \"condition\": \"<string>\"\n }\n ],\n \"environmentSettings\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.growthbook.io/api/v1/interleavings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"variations\": [],\n \"datasource\": \"<string>\",\n \"interleavingQueryId\": \"<string>\",\n \"userIdType\": \"<string>\",\n \"description\": \"<string>\",\n \"project\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"trackingKey\": \"<string>\",\n \"hashAttribute\": \"<string>\",\n \"metrics\": [\n {\n \"id\": \"<string>\",\n \"analyses\": [\n {\n \"type\": \"paired\"\n }\n ]\n }\n ],\n \"coverage\": 0.5,\n \"condition\": \"<string>\",\n \"savedGroups\": [\n {\n \"ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prerequisites\": [\n {\n \"id\": \"<string>\",\n \"condition\": \"<string>\"\n }\n ],\n \"environmentSettings\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.growthbook.io/api/v1/interleavings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"key\": \"<string>\",\n \"variations\": [],\n \"datasource\": \"<string>\",\n \"interleavingQueryId\": \"<string>\",\n \"userIdType\": \"<string>\",\n \"description\": \"<string>\",\n \"project\": \"<string>\",\n \"owner\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"trackingKey\": \"<string>\",\n \"hashAttribute\": \"<string>\",\n \"metrics\": [\n {\n \"id\": \"<string>\",\n \"analyses\": [\n {\n \"type\": \"paired\"\n }\n ]\n }\n ],\n \"coverage\": 0.5,\n \"condition\": \"<string>\",\n \"savedGroups\": [\n {\n \"ids\": [\n \"<string>\"\n ]\n }\n ],\n \"prerequisites\": [\n {\n \"id\": \"<string>\",\n \"condition\": \"<string>\"\n }\n ],\n \"environmentSettings\": {}\n}"
response = http.request(request)
puts response.read_body{
"interleaving": {
"id": "<string>",
"dateCreated": "2023-11-07T05:31:56Z",
"dateUpdated": "2023-11-07T05:31:56Z",
"name": "<string>",
"owner": "<string>",
"tags": [
"<string>"
],
"archived": true,
"status": "draft",
"key": "<string>",
"trackingKey": "<string>",
"hashAttribute": "<string>",
"seed": "<string>",
"variations": [
{
"id": "<string>",
"key": "<string>",
"name": "<string>",
"config": "<string>",
"description": "<string>"
}
],
"jsonSchema": {
"schemaType": "schema",
"schema": "<string>",
"simple": {
"type": "object",
"fields": [
{
"key": "<string>",
"type": "integer",
"required": true,
"default": "<string>",
"description": "<string>",
"enum": [
"<string>"
],
"min": 123,
"max": 123,
"nullable": true,
"jsonSchema": "<string>"
}
],
"additionalProperties": true,
"invariants": [
{
"name": "<string>",
"rule": "<string>",
"message": "<string>"
}
]
},
"enabled": true,
"date": "2023-11-07T05:31:56Z"
},
"datasource": "<string>",
"interleavingQueryId": "<string>",
"userIdType": "<string>",
"metrics": [
{
"id": "<string>",
"analyses": [
{
"type": "paired"
}
]
}
],
"environmentSettings": {},
"description": "<string>",
"project": "<string>",
"ownerEmail": "<string>",
"dateStarted": "2023-11-07T05:31:56Z",
"dateStopped": "2023-11-07T05:31:56Z",
"coverage": 0.5,
"condition": "<string>",
"savedGroups": [
{
"match": "all",
"ids": [
"<string>"
]
}
],
"prerequisites": [
{
"id": "<string>",
"condition": "<string>"
}
]
}
}{
"confirmation": {
"id": "<string>",
"status": "pending",
"actions": [
{
"action": "feature.create",
"environments": [
"<string>"
]
}
],
"summary": "<string>",
"url": "<string>",
"expiresAt": "<string>",
"response": {
"status": 123,
"body": "<unknown>"
},
"note": "<string>"
},
"message": "<string>"
}
