> For the complete documentation index, see [llms.txt](https://docs.thewalletcrew.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thewalletcrew.io/developers-guides/integration-guides/scan-api.md).

# Scan API

Record barcode and QR code scans with The Wallet Crew Scan API to validate passes and trigger downstream events such as redemption or attendance.

The Scan API records a barcode or QR scan, then correlates it to a pass. This creates a reliable “in-store / at-venue” signal that downstream systems can use for redemption flows, attendance tracking, or CRM automation. A scan does not change the pass. The platform records a `Pass:Scanned` event, which downstream systems and automations can use.

<details>

<summary><strong>Real-world examples</strong></summary>

* **Retail loyalty**: record a scan at checkout to trigger post-visit automation.
* **Event entry**: record gate scans to track attendance and prevent reuse.
* **Voucher redemption**: record scans to mark an offer as consumed.

</details>

## When Scan API is needed

Barcode/QR hardware can read the value displayed on a pass. The Scan API is the piece that makes that scan actionable in The Wallet Crew.

{% hint style="info" %}
The Scan API does not replace operational validation logic. It provides a scan record and correlation. Redemption rules, anti-fraud, and benefit consumption depend on the chosen workflow.
{% endhint %}

## Endpoint

The Scan API is available through this tenant-scoped operation:

## Record a pass scan

> Finds the pass whose barcode value equals \`data\` (the most recently updated wins) and records a \`Pass:Scanned\` event with the data and type, which automations can react to. The pass is not changed. Requires \`tenant.scan:scan\`.

```json
{"openapi":"3.1.1","info":{"title":"The Wallet Crew internal API","version":"v1"},"tags":[{"name":"Scan"}],"servers":[{"url":"https://api.thewalletcrew.io","description":"Production Server"},{"url":"https://api-qa.thewalletcrew.io","description":"Staging Server"}],"security":[{"admin-bearer":["tenant.scan:scan"]},{"apiKey":[]}],"components":{"securitySchemes":{"admin-bearer":{"type":"oauth2","flows":{"implicit":{"authorizationUrl":"https://auth.neostore.cloud/authorize?audience=https://app.neostore.cloud/api/","scopes":{}}}},"apiKey":{"type":"apiKey","name":"X-API-KEY","in":"header"}},"schemas":{"AddScanRequest":{"required":["data","type"],"type":"object","properties":{"data":{"maxLength":2048,"minLength":3,"type":"string","description":"The decoded content, exactly as read. It must equal, character for character, one of the barcode\nvalues rendered on a pass (trimmed)."},"type":{"description":"How `data` was captured. Recorded on the scan event as `scannedType`, in PascalCase (for\nexample `QRCode` for `qrcode`).","$ref":"#/components/schemas/TypeEnum"}},"additionalProperties":false,"description":"A value read from a pass by a scanner, a camera or a keyboard."},"TypeEnum":{"enum":["manual","text","qrcode","pdf417","aztec","code128","code39","codabar","ean8","ean13","itf14","upca","datamatrix","nfc"],"type":"string","description":"How the value was captured. Recorded on the scan event only; it does not affect matching."},"AddScanResponse":{"required":["passId"],"type":"object","properties":{"passId":{"type":"string","description":"The pass carrying the scanned value. When several passes carry it, the most recently updated one."}},"additionalProperties":false,"description":"The pass the scanned value resolved to."},"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"]}},"additionalProperties":{}},"HttpValidationProblemDetails":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProblemDetails"}],"properties":{"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"additionalProperties":{}}}},"paths":{"/api/{tenantId}/scans":{"post":{"tags":["Scan"],"summary":"Record a pass scan","description":"Finds the pass whose barcode value equals `data` (the most recently updated wins) and records a `Pass:Scanned` event with the data and type, which automations can react to. The pass is not changed. Requires `tenant.scan:scan`.","parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"The scanned value and how it was captured.","content":{"application/json":{"schema":{"description":"A value read from a pass by a scanner, a camera or a keyboard.","$ref":"#/components/schemas/AddScanRequest"}},"text/json":{"schema":{"description":"A value read from a pass by a scanner, a camera or a keyboard.","$ref":"#/components/schemas/AddScanRequest"}},"application/*+json":{"schema":{"description":"A value read from a pass by a scanner, a camera or a keyboard.","$ref":"#/components/schemas/AddScanRequest"}}}},"responses":{"201":{"description":"Scan recorded; the body names the pass.","content":{"text/plain":{"schema":{"description":"The pass the scanned value resolved to.","$ref":"#/components/schemas/AddScanResponse"}},"application/json":{"schema":{"description":"The pass the scanned value resolved to.","$ref":"#/components/schemas/AddScanResponse"}},"text/json":{"schema":{"description":"The pass the scanned value resolved to.","$ref":"#/components/schemas/AddScanResponse"}}}},"400":{"description":"`data` is missing or outside 3 to 2048 characters, or `type` is missing or unknown.","content":{"text/plain":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"text/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"401":{"description":"The caller is not authenticated.","content":{"application/problem+json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"403":{"description":"The caller lacks the `tenant.scan:scan` scope, or the endpoint is not enabled for the tenant.","content":{"application/problem+json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"404":{"description":"No pass carries the scanned value, or the tenant does not exist.","content":{"text/plain":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"text/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"429":{"description":"Over 1200 requests per minute to this endpoint for the tenant (default limit); retry after `Retry-After`.","headers":{"Retry-After":{"description":"Seconds to wait before retrying. Sent when the limiter knows it.","schema":{"type":"integer"}}},"content":{"application/problem+json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}}}}}}}
```

## Authentication and authorization

Send the tenant API key in the `X-API-KEY` header. The key needs the scope `tenant.scan:scan` (shown as **Scan passes** in the role editor). Call it from a backend relay: the key stays on the server, and the relay can add enrichment, logging and retries.

The Pass Scanner app is separate: it runs as a registered device. This API is for your own scanners.

## Request fields

The operation accepts two fields:

* `data`: the raw decoded value read by the scanner. It must be 3 to 2048 characters. It is compared character for character with a barcode value rendered on the pass (the rendered value is trimmed). When several passes match, the most recently updated pass wins.
* `type`: the scan input type (symbology). It is recorded with the scan and does not affect matching.

### `type` values

`type` is an enum with these values: `manual` (when staff types a code), `text`, `qrcode`, `pdf417`, `aztec`, `code128`, `code39`, `codabar`, `ean8`, `ean13`, `itf14`, `upca`, `datamatrix`, `nfc`.

Google Wallet supports only some symbologies: `code39`, `codabar`, `ean8`, `ean13`, `itf14`, `upca` and `datamatrix` are Google Wallet only.

{% hint style="warning" %}
`data` is treated as an opaque identifier. Keeping it stable matters more than keeping it human-readable. Formatting changes (trim, leading zeros, separators) are common causes of correlation failures.
{% endhint %}

## Response

The operation returns `201` and the correlated pass identifier. It returns `404` when correlation fails. The endpoint returns `429` above its rate limit, 1200 requests per minute by default.

## Validate the integration

A minimal validation sequence is:

1. Use a real pass issued by The Wallet Crew.
2. Scan its barcode/QR and capture the decoded value.
3. Use the Scan API operation with `data` and `type`.
4. Confirm a `201` response and a non-null `passId`.
5. Optional: confirm the downstream signal is received, for example a `Pass:Scanned` event in the pass history, or `wallet_scanned` in Bloomreach if that connector is configured.

## Troubleshooting

### `404 Not Found`

The scanned value did not match any pass.

Common causes are barcode formatting differences, missing prefixes/suffixes, or a mismatch between template barcode configuration and scanner decoding.

### `400 Bad Request`

The payload failed validation.

Common causes are missing fields, `data` length outside limits, or an invalid `type`.

### `401 Unauthorized`

The credentials are missing or invalid. A valid key without `tenant.scan:scan` returns `403`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.thewalletcrew.io/developers-guides/integration-guides/scan-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
