Skip to main content
POST
/
v1
/
files
/
upload
/
{file_id}
/
complete
from retab import Retab
from pathlib import Path

client = Retab()

# Create an upload session, PUT bytes to the signed URL yourself,
# then complete the upload.
invoice_path = Path("invoice.pdf")
session = client.files.create_upload(
    filename=invoice_path.name,
    size_bytes=invoice_path.stat().st_size,
    content_type="application/pdf",
)
mime = client.files.complete_upload(session.file_id)
print(mime.url)  # https://storage.retab.com/...
{
  "filename": "invoice.pdf",
  "url": "https://storage.retab.com/file_a1b2c3d4e5f6"
}

Documentation Index

Fetch the complete documentation index at: https://docs.retab.com/llms.txt

Use this file to discover all available pages before exploring further.

Complete a direct-to-storage upload after the file bytes have been written to the signed uploadUrl. Retab verifies that the object exists, matches the expected size from the upload session, and belongs to the authenticated organization. The response is a MIMEData object that can be passed directly to later document requests.
Use client.files.create_upload(...) to request a signed upload URL, PUT the bytes to that URL, then call client.files.complete_upload(...) to receive the durable MIMEData reference.Reach for this endpoint when you want to drive the PUT yourself (e.g. browser-side upload that bypasses your backend) and need to call complete from your server once the bytes have landed.
from retab import Retab
from pathlib import Path

client = Retab()

# Create an upload session, PUT bytes to the signed URL yourself,
# then complete the upload.
invoice_path = Path("invoice.pdf")
session = client.files.create_upload(
    filename=invoice_path.name,
    size_bytes=invoice_path.stat().st_size,
    content_type="application/pdf",
)
mime = client.files.complete_upload(session.file_id)
print(mime.url)  # https://storage.retab.com/...
{
  "filename": "invoice.pdf",
  "url": "https://storage.retab.com/file_a1b2c3d4e5f6"
}

Authorizations

Api-Key
string
header
required

Path Parameters

file_id
string
required

Body

application/json
sha256
string | null

Optional SHA-256 checksum

Pattern: ^[a-fA-F0-9]{64}$

Response

Successful Response

filename
string
required

The filename of the file

Examples:

"file.pdf"

"image.png"

"data.txt"

url
string
required

The URL of the file in base64 format

Example:

"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..."

mime_type
string
read-only