# API

This is a snapshot of swagger.json file at time of this release.\
\
You can also view the 'live' swagger API documentation details for your hosted backend environment by adding `/swagger` to your backend hostUrl link.

## POST /v5/init

> Create/Update Experiment User

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v5/init":{"post":{"description":"Create/Update Experiment User","tags":["Client Side SDK"],"responses":{"200":{"description":"Set Group Membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v5initResponse"}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"group":{"type":"object","properties":{"schoolId":{"type":"array","items":{"type":"string"}},"classId":{"type":"array","items":{"type":"string"}},"instructorId":{"type":"array","items":{"type":"string"}}}},"workingGroup":{"type":"object","properties":{"schoolId":{"type":"string"},"classId":{"type":"string"},"instructorId":{"type":"string"}}}}}}},"required":true,"description":"ExperimentUser"}}}},"components":{"schemas":{"v5initResponse":{"type":"object","properties":{"id":{"type":"string","minLength":1},"group":{"type":"object","properties":{"class":{"type":"array","items":{"type":"string"}}},"required":["class"]},"workingGroup":{"type":"object","properties":{"school":{"type":"string","minLength":1},"class":{"type":"string","minLength":1},"instructor":{"type":"string","minLength":1}},"required":["school","class","instructor"]}},"required":["id","group","workingGroup"]}}}}
```

## PATCH /v5/groupmembership

> Set group membership for a user

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v5/groupmembership":{"patch":{"description":"Set group membership for a user","tags":["Client Side SDK"],"responses":{"200":{"description":"Set Group Membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v5initResponse"}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"group":{"type":"object","properties":{"schoolId":{"type":"array","items":{"type":"string"}},"classId":{"type":"array","items":{"type":"string"}},"instructorId":{"type":"array","items":{"type":"string"}}}}}}}},"required":true,"description":"ExperimentUser"}}}},"components":{"schemas":{"v5initResponse":{"type":"object","properties":{"id":{"type":"string","minLength":1},"group":{"type":"object","properties":{"class":{"type":"array","items":{"type":"string"}}},"required":["class"]},"workingGroup":{"type":"object","properties":{"school":{"type":"string","minLength":1},"class":{"type":"string","minLength":1},"instructor":{"type":"string","minLength":1}},"required":["school","class","instructor"]}},"required":["id","group","workingGroup"]}}}}
```

## PATCH /v5/workinggroup

> Set working group for a user

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v5/workinggroup":{"patch":{"description":"Set working group for a user","tags":["Client Side SDK"],"responses":{"200":{"description":"Set Group Membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v5initResponse"}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workingGroup":{"type":"object","properties":{"schoolId":{"type":"string"},"classId":{"type":"string"},"instructorId":{"type":"string"}}}}}}},"required":true,"description":"ExperimentUser"}}}},"components":{"schemas":{"v5initResponse":{"type":"object","properties":{"id":{"type":"string","minLength":1},"group":{"type":"object","properties":{"class":{"type":"array","items":{"type":"string"}}},"required":["class"]},"workingGroup":{"type":"object","properties":{"school":{"type":"string","minLength":1},"class":{"type":"string","minLength":1},"instructor":{"type":"string","minLength":1}},"required":["school","class","instructor"]}},"required":["id","group","workingGroup"]}}}}
```

## POST /v5/mark

> Mark a Experiment Point

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v5/mark":{"post":{"description":"Mark a Experiment Point","tags":["Client Side SDK"],"responses":{"200":{"description":"Experiment Point is Marked","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"experimentId":{"type":"string","minLength":1},"site":{"type":"string","minLength":1},"target":{"type":"string","minLength":1},"condition":{"type":"string","minLength":1}},"required":["id","experimentId","enrollmentCode","userId","condition"]}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["userId","data"],"properties":{"userId":{"type":"string"},"data":{"type":"object","properties":{"site":{"type":"string"},"target":{"type":"string"},"assignedCondition":{"type":"object","properties":{"conditionCode":{"type":"string"}}},"experimentId":{"type":"string"}}},"status":{"type":"string"}}}}},"required":true,"description":"ExperimentUser"}}}}}
```

## POST /v5/assign

> Assign a Experiment Point

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v5/assign":{"post":{"description":"Assign a Experiment Point","tags":["Client Side SDK"],"responses":{"200":{"description":"Experiment Point is Assigned","content":{"application/json":{"schema":{"type":"array","description":"","minItems":1,"uniqueItems":true,"items":{"type":"object","required":["site","target","condition"],"properties":{"site":{"type":"string","minLength":1},"target":{"type":"string","minLength":1},"experimentType":{"type":"string","enum":["Simple","Factorial"]},"assignedCondition":{"type":"array","items":{"type":"object","properties":{"conditionCode":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"type":{"type":"string"},"value":{"type":"string"}}},"id":{"type":"string"},"experimentId":{"type":"string"}}}}}}}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"context":{"type":"string"}}}}},"required":true,"description":"User Document"}}}}}
```

## POST /v5/log

> Post log data

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v5/log":{"post":{"description":"Post log data","tags":["Client Side SDK"],"responses":{"200":{"description":"Log data"},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","required":true},"value":{"type":"array","required":true,"items":{"type":"object","properties":{"timestamp":{"type":"string"},"metrics":{"type":"object","properties":{"attributes":{"type":"object","properties":{"continuousMetricName":{"type":"integer"},"categoricalMetricName":{"type":"string"}}},"groupedMetrics":{"type":"array","items":{"type":"object","properties":{"groupClass":{"type":"string","required":true},"groupKey":{"type":"string","required":true},"groupUniquifier":{"type":"string","required":true},"attributes":{"type":"object","properties":{"continuousMetricName":{"type":"integer"},"categoricalMetricName":{"type":"string"}}}}}}}}}}}}}}},"required":true,"description":"User Document"}}}}}
```

## POST /v5/bloblog

> Post blob log data

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v5/bloblog":{"post":{"description":"Post blob log data","tags":["Client Side SDK"],"responses":{"200":{"description":"Log blob data"},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"value":{"type":"array","items":{"type":"object"}}}}}},"required":true,"description":"User Document"}}}}}
```

## POST /v5/featureflag

> Get all feature flags using SDK

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v5/featureflag":{"post":{"description":"Get all feature flags using SDK","tags":["Client Side SDK"],"responses":{"200":{"description":"Feature flags list"},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"context":{"type":"string"}},"description":"User Document"}}},"required":true}}}}}
```

## PATCH /v5/useraliases

> Set aliases for current user

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v5/useraliases":{"patch":{"description":"Set aliases for current user","tags":["Client Side SDK"],"responses":{"200":{"description":"Experiment User aliases added","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"aliases":{"type":"array","items":{"type":"string"}}},"required":["userId","userAliases"]}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["userId","aliases"],"properties":{"userId":{"type":"string"},"aliases":{"type":"array","items":{"type":"string"}}}}}},"required":true,"description":"Set user aliases"}}}}}
```

## POST /v6/init

> Create/Update Experiment User

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v6/init":{"post":{"description":"Create/Update Experiment User","tags":["Client Side SDK"],"responses":{"200":{"description":"Set Group Membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v6initResponse"}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"group":{"type":"object","properties":{"schoolId":{"type":"array","items":{"type":"string"}},"classId":{"type":"array","items":{"type":"string"}},"instructorId":{"type":"array","items":{"type":"string"}}}},"workingGroup":{"type":"object","properties":{"schoolId":{"type":"string"},"classId":{"type":"string"},"instructorId":{"type":"string"}}}}}}},"required":true,"description":"ExperimentUser"}}}},"components":{"schemas":{"v6initResponse":{"type":"object","properties":{"id":{"type":"string","minLength":1},"group":{"type":"object","properties":{"class":{"type":"array","items":{"type":"string"}}},"required":["class"]},"workingGroup":{"type":"object","properties":{"school":{"type":"string","minLength":1},"class":{"type":"string","minLength":1},"instructor":{"type":"string","minLength":1}},"required":["school","class","instructor"]}},"required":["id","group","workingGroup"]}}}}
```

## PATCH /v6/groupmembership

> Set group membership for a user

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v6/groupmembership":{"patch":{"description":"Set group membership for a user","tags":["Client Side SDK"],"responses":{"200":{"description":"Set Group Membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v6initResponse"}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"group":{"type":"object","properties":{"schoolId":{"type":"array","items":{"type":"string"}},"classId":{"type":"array","items":{"type":"string"}},"instructorId":{"type":"array","items":{"type":"string"}}}}}}}},"required":true,"description":"ExperimentUser"}}}},"components":{"schemas":{"v6initResponse":{"type":"object","properties":{"id":{"type":"string","minLength":1},"group":{"type":"object","properties":{"class":{"type":"array","items":{"type":"string"}}},"required":["class"]},"workingGroup":{"type":"object","properties":{"school":{"type":"string","minLength":1},"class":{"type":"string","minLength":1},"instructor":{"type":"string","minLength":1}},"required":["school","class","instructor"]}},"required":["id","group","workingGroup"]}}}}
```

## PATCH /v6/workinggroup

> Set working group for a user

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v6/workinggroup":{"patch":{"description":"Set working group for a user","tags":["Client Side SDK"],"responses":{"200":{"description":"Set Group Membership","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v6initResponse"}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"workingGroup":{"type":"object","properties":{"schoolId":{"type":"string"},"classId":{"type":"string"},"instructorId":{"type":"string"}}}}}}},"required":true,"description":"ExperimentUser"}}}},"components":{"schemas":{"v6initResponse":{"type":"object","properties":{"id":{"type":"string","minLength":1},"group":{"type":"object","properties":{"class":{"type":"array","items":{"type":"string"}}},"required":["class"]},"workingGroup":{"type":"object","properties":{"school":{"type":"string","minLength":1},"class":{"type":"string","minLength":1},"instructor":{"type":"string","minLength":1}},"required":["school","class","instructor"]}},"required":["id","group","workingGroup"]}}}}
```

## POST /v6/mark

> Mark a Experiment Point

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v6/mark":{"post":{"description":"Mark a Experiment Point","tags":["Client Side SDK"],"responses":{"200":{"description":"Experiment Point is Marked","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"experimentId":{"type":"string","minLength":1},"site":{"type":"string","minLength":1},"target":{"type":"string","minLength":1},"condition":{"type":"string","minLength":1}},"required":["id","experimentId","enrollmentCode","userId","condition"]}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"site":{"type":"string"},"target":{"type":"string"},"assignedCondition":{"type":"object","properties":{"conditionCode":{"type":"string"}}},"experimentId":{"type":"string"}}},"status":{"type":"string"}}}}},"required":true,"description":"ExperimentUser"}}}}}
```

## POST /v6/assign

> Assign a Experiment Point

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v6/assign":{"post":{"description":"Assign a Experiment Point","tags":["Client Side SDK"],"responses":{"200":{"description":"Experiment Point is Assigned","content":{"application/json":{"schema":{"type":"array","description":"","minItems":1,"uniqueItems":true,"items":{"type":"object","required":["site","target","condition"],"properties":{"site":{"type":"string","minLength":1},"target":{"type":"string","minLength":1},"experimentType":{"type":"string","enum":["Simple","Factorial"]},"assignedCondition":{"type":"array","items":{"type":"object","properties":{"conditionCode":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"type":{"type":"string"},"value":{"type":"string"}}},"id":{"type":"string"},"experimentId":{"type":"string"}}}}}}}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"context":{"type":"string"}}}}},"required":true,"description":"User Document"}}}}}
```

## POST /v6/log

> Post log data

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v6/log":{"post":{"description":"Post log data","tags":["Client Side SDK"],"responses":{"200":{"description":"Log data"},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"value":{"type":"array","required":true,"items":{"type":"object","properties":{"timestamp":{"type":"string"},"metrics":{"type":"object","properties":{"attributes":{"type":"object","properties":{"continuousMetricName":{"type":"integer"},"categoricalMetricName":{"type":"string"}}},"groupedMetrics":{"type":"array","items":{"type":"object","properties":{"groupClass":{"type":"string","required":true},"groupKey":{"type":"string","required":true},"groupUniquifier":{"type":"string","required":true},"attributes":{"type":"object","properties":{"continuousMetricName":{"type":"integer"},"categoricalMetricName":{"type":"string"}}}}}}}}}}}}}}},"required":true,"description":"User Document"}}}}}
```

## POST /v6/featureflag

> Get all feature flags using SDK

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v6/featureflag":{"post":{"description":"Get all feature flags using SDK","tags":["Client Side SDK"],"responses":{"200":{"description":"Feature flags list"},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"context":{"type":"string"}},"description":"User Document"}}},"required":true}}}}}
```

## PATCH /v6/useraliases

> Set aliases for current user

```json
{"openapi":"3.1.1","info":{"title":"A/B Testing Backend","version":"6.1.0"},"tags":[{"name":"Client Side SDK","description":"CRUD operations related to experiments points"}],"servers":[{"url":"/api"}],"paths":{"/v6/useraliases":{"patch":{"description":"Set aliases for current user","tags":["Client Side SDK"],"responses":{"200":{"description":"Experiment User aliases added","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"aliases":{"type":"array","items":{"type":"string"}}},"required":["userId","userAliases"]}}}},"400":{"description":"BadRequestError - InvalidParameterValue"},"401":{"description":"AuthorizationRequiredError"},"404":{"description":"Experiment User not defined"},"500":{"description":"Internal Server Error"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["aliases"],"properties":{"aliases":{"type":"array","items":{"type":"string"}}}}}},"required":true,"description":"Set user aliases"}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://upgrade-platform.gitbook.io/upgrade-documentation/developer-guide/reference/api-documentation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
