> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revexscanner.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a scan

> Create a scan session and get a PIN and download link.

Creates a scan for your organization. Send the returned `pin` or `downloadUrl` to the player. The scan starts only after the player approves it.

## Request

**Authorization** `string` *required*

`Bearer rvx_YOUR_KEY`

**Content-Type** `string` *required*

`application/json`

**target** `string`

Optional label to help you find the scan later (for example the player's name or ticket number).

```bash cURL theme={null}
curl -X POST https://revexscanner.com/api/v1/scans \
  -H "Authorization: Bearer rvx_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target": "ticket-1042"}'
```

```javascript Node.js theme={null}
const res = await fetch("https://revexscanner.com/api/v1/scans", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.REVEX_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ target: "ticket-1042" }),
});
const scan = await res.json();
console.log(scan.pin, scan.downloadUrl);
```

```python Python theme={null}
import os, requests

r = requests.post(
    "https://revexscanner.com/api/v1/scans",
    headers={"Authorization": f"Bearer {os.environ['REVEX_KEY']}"},
    json={"target": "ticket-1042"},
    timeout=15,
)
scan = r.json()
print(scan["pin"], scan["downloadUrl"])
```

## Response

Status `201 Created`.

**id** `string`

The scan session ID.

**pin** `string`

The PIN the player enters in the scanner.

**downloadUrl** `string`

A link that starts the download for this scan, in the form `https://revexscanner.com/d/<pin>`.

**expiresAt** `number`

Expiry time of the PIN as a Unix timestamp in milliseconds.

```json 201 theme={null}
{
  "id": "0-9b9d5dab-6975-4561-8303-8db8379f9ca5",
  "pin": "482916",
  "downloadUrl": "https://revexscanner.com/d/482916",
  "expiresAt": 1795305600000
}
```

## Errors

| Status | Code | Meaning |
| - | - | - |
| 401 | `INVALID_API_KEY` | The key is missing, wrong or revoked. |
| 429 | `RATE_LIMITED` | Too many requests. Wait a minute. |
| 503 | `PIN_EXHAUSTED` | No free PIN could be allocated right now. Retry shortly. |

> [!NOTE]
>
> Never ask a player to run commands or download files from anywhere except the link returned here.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.