# Setup codes API reference

> Canonical HTML: https://screenrig.ai/docs/api/setup-codes
> Source SHA-256: e0c997a2ab813502f0d99a41d2ed1d3d6b26dbaf1a3d7e514c1cce0278ff8422

Website setup codes. This group has 1 operation, each with its authentication, parameters, request body fields, request template and responses. The [API overview](https://screenrig.ai/docs/api.md) covers services, authentication, requests and retries, problem codes and versioning.

Replace uppercase placeholders. Save a schema-valid JSON body in request.json when required. Cookie examples use a local cookie jar from an authenticated session.

## Website setup codes

### POST /website/setup-codes

**Get the visitor's setup code**

Anonymous same-origin call from the website's agent prompts. Answers the setup code of the request's first-party visitor cookie (sr_vid), minting it the first time: the same visitor gets the same code while it is valid (90 days from minting).

A person pastes it into their agent with the setup prompt and the agent passes it to CLI enrollment, which links the new project to that visit. Requires the website Origin. A request without exactly one well-formed visitor cookie answers 204 and mints nothing. The code grants nothing; it only names a visit.

At most 60 new codes per client IP per hour (IPv6 grouped by /64); all requests share a 120-per-IP-per-minute limit. Retry-After is authoritative.


Operation: createWebsiteSetupCode.

- Authentication: none
- Request body: none

#### Parameters

| Name | Send in | Required? | Description |
| --- | --- | --- | --- |
| Origin | header | required |  |

#### Request template

~~~sh
curl --request POST --header 'Origin: https://screenrig.ai' 'https://screenrig.ai/website/setup-codes'
~~~

#### Responses

| Status | Meaning | Body and headers |
| --- | --- | --- |
| 200 | The visitor's setup code. | WebsiteSetupCode (application/json); headers: Cache-Control |
| 204 | The request carried no visitor cookie, so there is no visit to name. | no body; headers: Cache-Control |
| default | Stable RFC 9457 problem response. A 421 server_draining carries Retry-After of 1 second, a 500 not_ready or dependency_unavailable carries 5, and a 500 manifest_degraded carries 60, unless the handler set a more specific value. | Problem (application/problem+json) |


## Sitemap

See the [public documentation sitemap](https://screenrig.ai/sitemap.md).
