> For the complete documentation index, see [llms.txt](https://docs.shoplift.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shoplift.ai/api-reference/public-api/create-test.md).

# Create test

Creates a test in draft state with control and variant configured. An optional plan (startDate, optional endDate, dates only) places the draft on the roadmap on those dates; it cannot be combined with automaticallyStartAt or automaticallyEndAt. A checkout test needs checkout testing access; a store without it is refused with a 403. Its goal must be conversionRate, averageOrderValue or revenuePerSession; any other goal is refused with a 400.

```json
{"openapi":"3.1.1","info":{"title":"Shoplift Public API","version":"1.0.0"},"tags":[{"name":"Public API"}],"servers":[{"url":"https://app.shoplift.ai"}],"security":[{"ApiKey":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"http","description":"All requests require `Authorization: Bearer sl_live_<your_api_key>`. Generate a key from the Shoplift admin's API Keys settings page.","scheme":"bearer"}},"schemas":{"CreateTestRequest":{"required":["title","type","control","variant","goal","device","visitorOption","controlTraffic","hypothesisDescription","defaultAudiences","customAudienceIds","automaticallyStartAt","automaticallyEndAt"],"type":"object","properties":{"title":{"type":"string"},"type":{"type":"string"},"control":{"$ref":"#/components/schemas/CreateTestControlRequest"},"variant":{"$ref":"#/components/schemas/CreateTestVariantRequest"},"goal":{"type":["null","string"]},"device":{"type":["null","string"]},"visitorOption":{"type":["null","string"]},"controlTraffic":{"type":["null","integer"],"format":"int32"},"hypothesisDescription":{"type":["null","string"]},"defaultAudiences":{"type":["null","array"],"items":{"type":"string"}},"customAudienceIds":{"type":["null","array"],"items":{"type":"string","format":"uuid"}},"automaticallyStartAt":{"type":["null","string"],"format":"date-time"},"automaticallyEndAt":{"type":["null","string"],"format":"date-time"},"endWhenSignificant":{"type":"boolean","default":false},"campaignId":{"type":["null","string"],"format":"uuid"},"priority":{"type":["null","string"]},"surfaceArea":{"type":["null","string"]},"impact":{"type":["null","integer"],"format":"int32"},"effort":{"type":["null","integer"],"format":"int32"},"tagIds":{"type":["null","array"],"items":{"type":"string","format":"uuid"}},"plan":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/TestPlanRequest"}]}},"additionalProperties":false},"CreateTestControlRequest":{"required":["type"],"type":"object","properties":{"type":{"type":"string"},"suffix":{"type":"string","default":""},"redirectUrl":{"type":["null","string"]},"themeId":{"type":["null","integer"],"format":"int64"}},"additionalProperties":false},"CreateTestVariantRequest":{"required":["type"],"type":"object","properties":{"type":{"type":"string"},"mode":{"type":["null","string"]},"source":{"type":"string","default":""},"themeId":{"type":["null","integer"],"format":"int64"},"redirectUrl":{"type":["null","string"]},"granular":{"type":"boolean","default":false}},"additionalProperties":false},"TestPlanRequest":{"required":["startDate"],"type":"object","properties":{"startDate":{"type":["null","string"],"format":"date"},"endDate":{"type":["null","string"],"format":"date"}},"additionalProperties":false},"IdResponse":{"required":["id"],"type":"object","properties":{"id":{"type":"string","format":"uuid"}}},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"type":["null","integer"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}},"paths":{"/api/public/v1/tests":{"post":{"tags":["Public API"],"summary":"Create test","description":"Creates a test in draft state with control and variant configured. An optional plan (startDate, optional endDate, dates only) places the draft on the roadmap on those dates; it cannot be combined with automaticallyStartAt or automaticallyEndAt. A checkout test needs checkout testing access; a store without it is refused with a 403. Its goal must be conversionRate, averageOrderValue or revenuePerSession; any other goal is refused with a 400.","operationId":"createTest","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTestRequest"}}},"required":true},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdResponse"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"502":{"description":"Bad Gateway","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}}}
```
