Complete experiment
curl --request POST \
--url https://api.pictify.io/experiments/api/{uid}/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"winnerVariantId": "variant-a"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({winnerVariantId: 'variant-a'})
};
fetch('https://api.pictify.io/experiments/api/{uid}/complete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pictify.io/experiments/api/{uid}/complete"
payload = { "winnerVariantId": "variant-a" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pictify.io/experiments/api/{uid}/complete"
payload := strings.NewReader("{\n \"winnerVariantId\": \"variant-a\"\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))
}require 'uri'
require 'net/http'
url = URI("https://api.pictify.io/experiments/api/{uid}/complete")
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 \"winnerVariantId\": \"variant-a\"\n}"
response = http.request(request)
puts response.read_body{
"experiment": {
"uid": "exp_abc123",
"slug": "homepage-hero-test",
"name": "Homepage Hero A/B Test",
"variants": [
{
"id": "variant-a",
"weight": 5000,
"name": "New Design",
"templateUid": "<string>",
"variables": {},
"isDefault": false,
"conditions": {
"children": "<array>",
"property": "<string>",
"value": "<unknown>"
},
"schedule": {
"startAt": "2023-11-07T05:31:56Z",
"endAt": "2023-11-07T05:31:56Z",
"recurrence": {
"type": "none",
"cronExpression": "<string>",
"timezone": "America/New_York"
}
},
"impressions": 123,
"clicks": 123
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"templateUid": "tmpl_xyz789",
"goalConfig": {
"type": "impressions_only",
"destinationUrl": "<string>"
},
"banditConfig": {
"enabled": false,
"algorithm": "thompson_sampling",
"warmupImpressions": 50,
"recomputeIntervalMinutes": 15
},
"hypothesis": "<string>",
"minimumSampleSize": 1000,
"confidenceThreshold": 0.95,
"minimumRunDays": 7,
"winnerVariantId": "<string>",
"winnerDeclaredAt": "2023-11-07T05:31:56Z",
"fallbackImageUrl": "<string>",
"outputConfig": {
"format": "png",
"quality": 90
}
}
}{
"type": "https://docs.pictify.io/errors/invalid-api-key",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API key is invalid or has been revoked.",
"instance": "/image"
}{
"type": "https://docs.pictify.io/errors/invalid-api-key",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API key is invalid or has been revoked.",
"instance": "/image"
}Experiments
Complete Experiment
Complete an experiment and declare a winner. Requires winnerVariantId.
Valid transitions: running → completed, paused → completed
POST
/
experiments
/
api
/
{uid}
/
complete
Complete experiment
curl --request POST \
--url https://api.pictify.io/experiments/api/{uid}/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"winnerVariantId": "variant-a"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({winnerVariantId: 'variant-a'})
};
fetch('https://api.pictify.io/experiments/api/{uid}/complete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pictify.io/experiments/api/{uid}/complete"
payload = { "winnerVariantId": "variant-a" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pictify.io/experiments/api/{uid}/complete"
payload := strings.NewReader("{\n \"winnerVariantId\": \"variant-a\"\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))
}require 'uri'
require 'net/http'
url = URI("https://api.pictify.io/experiments/api/{uid}/complete")
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 \"winnerVariantId\": \"variant-a\"\n}"
response = http.request(request)
puts response.read_body{
"experiment": {
"uid": "exp_abc123",
"slug": "homepage-hero-test",
"name": "Homepage Hero A/B Test",
"variants": [
{
"id": "variant-a",
"weight": 5000,
"name": "New Design",
"templateUid": "<string>",
"variables": {},
"isDefault": false,
"conditions": {
"children": "<array>",
"property": "<string>",
"value": "<unknown>"
},
"schedule": {
"startAt": "2023-11-07T05:31:56Z",
"endAt": "2023-11-07T05:31:56Z",
"recurrence": {
"type": "none",
"cronExpression": "<string>",
"timezone": "America/New_York"
}
},
"impressions": 123,
"clicks": 123
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"templateUid": "tmpl_xyz789",
"goalConfig": {
"type": "impressions_only",
"destinationUrl": "<string>"
},
"banditConfig": {
"enabled": false,
"algorithm": "thompson_sampling",
"warmupImpressions": 50,
"recomputeIntervalMinutes": 15
},
"hypothesis": "<string>",
"minimumSampleSize": 1000,
"confidenceThreshold": 0.95,
"minimumRunDays": 7,
"winnerVariantId": "<string>",
"winnerDeclaredAt": "2023-11-07T05:31:56Z",
"fallbackImageUrl": "<string>",
"outputConfig": {
"format": "png",
"quality": 90
}
}
}{
"type": "https://docs.pictify.io/errors/invalid-api-key",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API key is invalid or has been revoked.",
"instance": "/image"
}{
"type": "https://docs.pictify.io/errors/invalid-api-key",
"title": "Invalid API Key",
"status": 401,
"detail": "The provided API key is invalid or has been revoked.",
"instance": "/image"
}⌘I