Files API
Every receipt Versa attaches to one of your transactions is a file. The receipt_retrieval.completed webhook lists those files, each with a signed download URL that expires after 15 minutes. The Files API lets you come back to them later (except receipts collected from your corporate card provider): fetch a fresh download URL for a file, or the receipt data Versa extracted from it, in the Versa receipt schema.
The Files API is served at https://api.versa.org/files and uses the same client credentials as the Events API and the Flags API. To list every receipt on a transaction, use the Transactions API.
Quick Example: Fetch a fresh download URL
curl https://api.versa.org/files/file_01kxb5d7qve00a78ns2gqj6xqs \
-H 'Authorization: Basic CLIENT_ID:CLIENT_SECRET'
The file_id is the one a receipt_retrieval.completed event carried in receipts[]. Download the file from the returned url within 15 minutes, or ask again.
Authentication
Every request carries your client credentials in an Authorization header using the Basic scheme, either as the raw pair or base64-encoded:
Authorization: Basic CLIENT_ID:CLIENT_SECRET
Use a production client credential of your organization to reach your receipts. A test credential never reads them: it gets fixed example responses instead (see Testing with a test credential). A missing or incorrect credential answers 401 with the body {"error": "Invalid client credentials"}. If Versa cannot complete the credential check, the request answers 503 with the body {"error": "Credential check unavailable"}; this applies to both routes of this API.
Every error on this API is a JSON object with a single error message. A file that is not yours, or that does not exist, answers 404 with {"error": "Not found"}; the two cases are deliberately indistinguishable.
Testing with a test credential
With a test credential, both routes answer from a fixed example instead of your organization's files, so you can build against the real response shapes before you hold a production credential. Nothing of yours is read, and no download URL is signed.
file_id | GET /files/{file_id} | GET /files/{file_id}/extracted_data |
|---|---|---|
good_file_id | 200 with the example receipt, a PDF at https://cdn.versa.org/examples/tdg.pdf | 200 with an example two-night hotel stay as a Versa receipt in the current schema version |
missing_file_id | 404 with {"error": "Not found"} | 404 with {"error": "Not found"} |
Any other file_id, including the id of one of your real files, answers 404 the same way. The example URL is public and does not expire. The schema_version checks still apply first: a missing or unsupported schema_version answers 400 as in production. The example transaction on the Transactions API lists good_file_id in its receipts[], so you can follow it from there.
API Reference
Get a file
GET https://api.versa.org/files/{file_id}
Returns the file with a freshly signed download URL. The response is the same object the webhook carries in receipts[].
Example Request
curl https://api.versa.org/files/file_01kxb5d7qve00a78ns2gqj6xqs \
-H 'Authorization: Basic CLIENT_ID:CLIENT_SECRET'
Response
{
"file_id": "file_01kxb5d7qve00a78ns2gqj6xqs",
"url": "https://storage.googleapis.com/...",
"size": 55555,
"content_type": "application/pdf",
"created": 1789776000
}
File fields
| Field | Type | Description |
|---|---|---|
file_id | string | The file's id. |
url | string | A signed download URL, valid for 15 minutes from the response. |
size | integer | File size in bytes. |
content_type | string | The file's MIME type, for example application/pdf. |
created | integer | When the file was stored, in Unix seconds. |
| Status | Meaning |
|---|---|
404 | No file of your organization has that id. |
503 | Versa could not read the file or reach file storage; retry shortly. |
Get a file's extracted data
GET https://api.versa.org/files/{file_id}/extracted_data?schema_version=2.3.0
Returns the receipt Versa extracted from the file, as a Versa receipt in the schema version you ask for.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
schema_version | string | Required. The Versa receipt schema version to return. Currently 2.3.0 is the only supported value. |
Example Request
curl 'https://api.versa.org/files/file_01kxb5d7qve00a78ns2gqj6xqs/extracted_data?schema_version=2.3.0' \
-H 'Authorization: Basic CLIENT_ID:CLIENT_SECRET'
Response
{
"file_id": "file_01kxb5d7qve00a78ns2gqj6xqs",
"extracted": 1789776120,
"extraction_task_id": "agt_01kxb5dhwff00a78ns2gqj6xqs",
"data": {
"schema_version": "2.3.0",
"header": {
"currency": "usd",
"total": 39488,
"subtotal": 34000,
"paid": 39488,
"invoice_number": "H2513284",
"invoiced_at": 1789776000
},
"itemization": {
"lodging": {
"check_in": 1789776000,
"check_out": 1789948800,
"location": {
"name": "Courtland Grand Hotel"
},
"items": [
{
"description": "Room 1204",
"amount": 34000,
"quantity": 2.0,
"unit_cost": 17000,
"date": "2026-09-19"
}
]
}
},
"payments": [],
"footer": {}
}
}
The example is abridged: it shows one line item and leaves out the optional fields a receipt may carry.
Response fields
| Field | Type | Description |
|---|---|---|
file_id | string | The file's id. |
extracted | integer | When the extraction ran, in Unix seconds. |
extraction_task_id | string | The id of the extraction job, for support requests. |
data | object | The receipt, a Versa receipt object whose schema_version is the version you asked for. See the schema. |
| Status | Meaning |
|---|---|
400 | schema_version is missing ("schema_version is required") or not supported ("Unsupported schema_version; supported: 2.3.0"). |
404 | No file of your organization has that id, or Versa has not extracted data from it. |
503 | Versa could not read the data; retry shortly. |
The extracted data is Versa's reading of the document and may be incomplete for an unusual layout. The file itself remains the record; the Flags API is the way to tell Versa a receipt is wrong.