Skip to main content
POST
/
v1
/
files
/
upload
from retab import Retab
from pathlib import Path

client = Retab()

# Upload from a file path
response = client.files.upload(Path("invoice.pdf"))
print(f"File ID: {response.file_id}")
print(f"Filename: {response.filename}")
{
  "file_id": "file_a1b2c3d4e5f6",
  "filename": "invoice.pdf"
}
Upload a document to Retab. The file is stored persistently and can be referenced by file_id in extractions, workflows, and other operations.
from retab import Retab
from pathlib import Path

client = Retab()

# Upload from a file path
response = client.files.upload(Path("invoice.pdf"))
print(f"File ID: {response.file_id}")
print(f"Filename: {response.filename}")
{
  "file_id": "file_a1b2c3d4e5f6",
  "filename": "invoice.pdf"
}

Request Parameters

mimeData
object
required
The document to upload.

Response Fields

file_id
string
Unique identifier for the uploaded file, prefixed with file_.
filename
string
The filename of the uploaded document.

Authorizations

Api-Key
string
header
required

Query Parameters

access_token
string | null

Body

application/json
mimeData
MIMEData · object
required

File data to upload

Response

Successful Response

fileId
string
required

Underlying file ID

filename
string
required

Filename