> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.withverifa.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withverifa.com/_mcp/server.

# Get document metadata

GET https://api.withverifa.com/api/v1/documents/{document_id}

Returns full metadata for a single document. The response includes
`preview_url` and `download_url` fields with short-lived HMAC-signed
URLs for accessing the document file.

**Required scope:** `documents:read`


Reference: https://docs.withverifa.com/api-reference/documents/get-document-by-id

## Authentication

- `X-API-Key` header (required) — Organization API key. Keys are prefixed with `vk_live_` (production) or `vk_sandbox_` (sandbox).

## Request

### Path parameters

- `document_id` (string, required) — Document ID (`doc_*`).

### Headers

- `Verifa-Version` (date, optional) — API version date string (e.g. `2026-02-01`). If omitted, the version pinned to your API key is used.

## Response

### 200

Document metadata.

- `id` (string, required) — Document ID (`doc_*`).
- `document_type` (enum, required)
  - Allowed values: `id_front`, `id_back`, `selfie`, `proof_of_address`, `other`
- `status` (enum, required)
  - Allowed values: `pending`, `processing`, `completed`, `failed`, `redacted`
- `created_at` (datetime, required)
- `org_id` (string, optional) — Organization ID.
- `session_id` (string, optional, nullable) — Associated session ID, if any.
- `identity_id` (string, optional, nullable) — Associated identity ID, if any.
- `classification` (string, optional, nullable) — Detected or assigned document classification (e.g. passport, drivers_license).
- `mime_type` (string, optional, nullable) — MIME type of the uploaded file.
- `file_size_bytes` (integer, optional, nullable) — File size in bytes.
- `original_filename` (string, optional, nullable) — Original filename at upload time.
- `page_count` (integer, optional, nullable) — Number of pages (for multi-page documents).
- `metadata` (map from string to any, optional) — Arbitrary key-value metadata.
- `upload_source` (string, optional, nullable) — How the document was uploaded (api, capture, dashboard).
- `download_url` (string, optional, nullable) — HMAC-signed download URL (when available).
- `preview_url` (string, optional, nullable) — Server-side JPEG preview URL for page 1. Works for both PDFs (rendered via PyMuPDF) and images. Same HMAC signature as download_url. Null for redacted documents.
- `extracted_fields` (map from string to any, optional, nullable) — Structured field extraction produced by Verifa's document extractor. Populated when the document's matched `document_type` has non-empty `extraction_hints`. Each key is one of the field names from the type's `extraction_hints`, and each value is either the extracted string or `null` if the field was not visible in the document. `null` until the verification pipeline has run.
- `extracted_fields_confidence` (map from string to double, optional, nullable) — Per-field token-presence confidence (0.0-1.0) for the corresponding entries in `extracted_fields`. Computed by checking whether each extracted value's tokens actually appear in the underlying OCR text. Values below ~0.5 are likely hallucinations and should be flagged for reviewer attention. `null` until extraction has run.
- `updated_at` (datetime, optional, nullable)

## Errors

### 401 Unauthorized Error

Missing or invalid API key.

- `error` (string, required) — Short error code.
- `status_code` (integer, required) — HTTP status code.
- `detail` (string, optional) — Human-readable error description.

### 404 Not Found Error

Resource not found.

- `error` (string, required) — Short error code.
- `status_code` (integer, required) — HTTP status code.
- `detail` (string, optional) — Human-readable error description.

## Examples

**Response**

```json
{
  "id": "string",
  "document_type": "id_front",
  "status": "pending",
  "created_at": "2024-01-15T09:30:00Z",
  "org_id": "string",
  "session_id": "string",
  "identity_id": "string",
  "classification": "string",
  "mime_type": "string",
  "file_size_bytes": 1,
  "original_filename": "string",
  "page_count": 1,
  "metadata": {},
  "upload_source": "string",
  "download_url": "string",
  "preview_url": "string",
  "extracted_fields": {
    "insurer_name": "Acme Insurance",
    "policy_number": "POL-12345678",
    "vin": "1HGBH41JXMN109186",
    "expiry_date": "2027-01-15"
  },
  "extracted_fields_confidence": {
    "insurer_name": 0.997,
    "policy_number": 0.981,
    "vin": 0.95,
    "expiry_date": 0.997
  },
  "updated_at": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.withverifa.com/api/v1/documents/document_id"

headers = {"X-API-Key": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.withverifa.com/api/v1/documents/document_id';
const options = {method: 'GET', headers: {'X-API-Key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.withverifa.com/api/v1/documents/document_id"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-API-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.withverifa.com/api/v1/documents/document_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.withverifa.com/api/v1/documents/document_id")
  .header("X-API-Key", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.withverifa.com/api/v1/documents/document_id', [
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.withverifa.com/api/v1/documents/document_id");
var request = new RestRequest(Method.GET);
request.AddHeader("X-API-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-Key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.withverifa.com/api/v1/documents/document_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```