> 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.

# Upload a standalone document

POST https://api.withverifa.com/api/v1/documents
Content-Type: multipart/form-data

Upload a document outside the context of a capture session. Optionally
attach it to an existing session or identity. The document is stored and
available for classification, extraction, and verification via the
sub-resource action endpoints.

**Required scope:** `documents:write`


Reference: https://docs.withverifa.com/api-reference/documents/upload-document

## Authentication

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

## Request

### 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.

### Body (multipart/form-data)

This endpoint expects a multipart form containing a file.

- `file` (file, required) — The document image file (JPEG, PNG, WebP, or PDF). Max 10 MB.
- `document_type` (enum, required) — The type of document being uploaded.
- `session_id` (string, optional) — Optional session ID to attach the document to.
- `identity_id` (string, optional) — Optional identity ID to attach the document to.
- `classification` (string, optional) — Optional document classification (e.g. passport, drivers_license).
- `original_filename` (string, optional) — Original filename of the uploaded document.

## Response

### 201

Document uploaded successfully.

- `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

### 400 Bad Request Error

Invalid request parameters.

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

### 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.

### 422 Unprocessable Entity Error

Request validation failed.

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

## Examples

**Request**

```json
{
  "file": "<file: string>",
  "document_type": "id_front"
}
```

**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"

files = { "file": "open('string', 'rb')" }
payload = {
    "document_type": "id_front",
    "session_id": ,
    "identity_id": ,
    "classification": ,
    "original_filename": 
}
headers = {"X-API-Key": "<apiKey>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.withverifa.com/api/v1/documents';
const form = new FormData();
form.append('file', 'string');
form.append('document_type', 'id_front');
form.append('session_id', '');
form.append('identity_id', '');
form.append('classification', '');
form.append('original_filename', '');

const options = {method: 'POST', headers: {'X-API-Key': '<apiKey>'}};

options.body = form;

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"
	"strings"
	"net/http"
	"io"
)

func main() {

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

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_type\"\r\n\r\nid_front\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"session_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"identity_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"classification\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"original_filename\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	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")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_type\"\r\n\r\nid_front\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"session_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"identity_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"classification\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"original_filename\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

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.post("https://api.withverifa.com/api/v1/documents")
  .header("X-API-Key", "<apiKey>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_type\"\r\n\r\nid_front\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"session_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"identity_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"classification\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"original_filename\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.withverifa.com/api/v1/documents', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => 'string',
        'contents' => null
    ],
    [
        'name' => 'document_type',
        'contents' => 'id_front'
    ]
  ]
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.withverifa.com/api/v1/documents");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_type\"\r\n\r\nid_front\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"session_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"identity_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"classification\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"original_filename\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-Key": "<apiKey>"]
let parameters = [
  [
    "name": "file",
    "fileName": "string"
  ],
  [
    "name": "document_type",
    "value": "id_front"
  ],
  [
    "name": "session_id",
    "value": 
  ],
  [
    "name": "identity_id",
    "value": 
  ],
  [
    "name": "classification",
    "value": 
  ],
  [
    "name": "original_filename",
    "value": 
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

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

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()
```