# Prepare OCR evidence

Prepare a retained OCR representation for later quote matching.

Documentation index: https://webcite.co/llms.txt
Canonical page: https://webcite.co/api-docs/ocr
API origin: https://api.webcite.co
Authentication: x-api-key header. Keep keys on your server.

## When to use it

Requires an existing, account-owned source version and parser representation. An upload asset ID is not a replacement for either ID. This endpoint does not ingest a new document.

Preparation can be disabled for the deployment. A prepared artifact lets batch verification or source preview attempt a derived body reading; it does not turn an OCR match into a verified quotation. [OCR provenance example](/api-docs/evidence#ocr-readings).

## Request

POST /api/v2/sources/{versionId}/representations/{representationId}/prepare-ocr-rescue

Availability and metering depend on the configured OCR workflow; no fixed public credit price is specified.

### curl

```curl
curl --fail-with-body -X POST 'https://api.webcite.co/api/v2/sources/YOUR_VERSIONID/representations/YOUR_REPRESENTATIONID/prepare-ocr-rescue' \
  -H "x-api-key: $WEBCITE_API_KEY"
```

### Node.js

```javascript
const response = await fetch("https://api.webcite.co/api/v2/sources/YOUR_VERSIONID/representations/YOUR_REPRESENTATIONID/prepare-ocr-rescue", {
  method: "POST",
  headers: {
    "x-api-key": process.env.WEBCITE_API_KEY,
  },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.json());
```

### python

```python
import os
import requests

response = requests.post(
    "https://api.webcite.co/api/v2/sources/YOUR_VERSIONID/representations/YOUR_REPRESENTATIONID/prepare-ocr-rescue",
    headers={"x-api-key": os.environ["WEBCITE_API_KEY"]},
    timeout=(10, 300),
)
response.raise_for_status()
print(response.json())
```

## Response

Returns preparation metadata, or attempted: false with code disabled or not_ocr. The current public OpenAPI has no complete response schema for this operation.

## Errors

For 400, check the request fields and source identifiers. For 401, check your API key. For 429, wait for the retry interval. See the errors guide before retrying a billable request.

## OpenAPI operation

```json
{
  "path": "/api/v2/sources/{versionId}/representations/{representationId}/prepare-ocr-rescue",
  "method": "POST",
  "operation": {
    "operationId": "OcrRescueController_prepare",
    "parameters": [
      {
        "in": "path",
        "name": "versionId",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      {
        "in": "path",
        "name": "representationId",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    ],
    "responses": {
      "201": {
        "description": ""
      }
    },
    "security": [
      {
        "x-api-key": []
      },
      {
        "bearer": []
      }
    ],
    "tags": [
      "Versioned evidence"
    ]
  },
  "schemas": {}
}
```
