Upload documents

Upload one or more documents to the project. Send the files as multipart/form-data under the files field (repeat the field for multiple files). Successful uploads return 202 Accepted: the accepted document rows are created immediately and returned in documents, while parsing/conversion continues in the background. Excel workbooks produce one document per accepted sheet; email uploads can also produce attachment documents.

On this page

HTTP request

POST https://api.parsewise.ai/api/v1/projects/{project_id}/documents/

URI Parameters

Name In Required Type Description
project_id path Yes string (uuid)  

Request Header

Name Required Type Description
X-API-Key Yes string API key with the pw_live_ prefix. See Authentication.

Request Body

Supported content types: multipart/form-data.

Name Required Type Description
files Yes array<string (binary)> One or more files to upload. Repeat the files field once per file (standard multipart/form-data multi-file upload). Supported types: PDF, Word, Excel, PPT, Image, Email (.eml), Audio, Text, Website.
skip_sheets No string Optional JSON-encoded object of the form {"filename.xlsx": [{"name": "Sheet1", "estimatedPages": 1500}, ...]} listing Excel sheets the caller chose not to upload because they exceeded size limits. Used for logging and quota accounting only; omit if not applicable.

Responses

Status Type Description
202 V1DocumentUploadResponse Files accepted; document rows created; parsing/conversion queued or started.

Security

  • ApiKeyAuth — apiKey — in X-API-Key header. API key with pw_live_ prefix.

Python example

import os
import requests

API_KEY = os.environ["PARSEWISE_API_KEY"]
BASE_URL = "https://api.parsewise.ai/api/v1"

project_id = "<uuid>"

# Send files as multipart/form-data; repeat the "files" field per file.
with open("example.pdf", "rb") as f:
    files = {"files": f}

resp = requests.post(
    f"{BASE_URL}/projects/{project_id}/documents/",
    headers={"X-API-Key": API_KEY},
    files=files,
)
resp.raise_for_status()
print(resp.json() if resp.content else None)

Definitions

Status61fEnum

Type: string. One of:

  • Pending
  • Processed
  • Failed

TypeEnum

Type: string. One of:

  • PDF
  • Audio
  • Image
  • Text
  • Excel
  • PPT
  • Word Document
  • Website
  • Email

V1DocumentUploadRequest

Name Required Type Description
files Yes array<string (binary)> One or more files to upload. Repeat the files field once per file (standard multipart/form-data multi-file upload). Supported types: PDF, Word, Excel, PPT, Image, Email (.eml), Audio, Text, Website.
skip_sheets No string Optional JSON-encoded object of the form {"filename.xlsx": [{"name": "Sheet1", "estimatedPages": 1500}, ...]} listing Excel sheets the caller chose not to upload because they exceeded size limits. Used for logging and quota accounting only; omit if not applicable.

V1DocumentUploadResponse

Name Required Type Description
excel_count Yes integer Number of top-level Excel files accepted for asynchronous sheet-by-sheet processing. 0 when no top-level Excel files were accepted.
files Yes array<V1DocumentUploadResponseFile> Compatibility field containing stored file locations for accepted non-Excel upload files. Use documents to reconcile uploads with document UUIDs.
documents Yes array<V1DocumentUploadResponseDocument> Created document rows. This is the recommended field for reconciling uploads to UUIDs.

V1DocumentUploadResponseDocument

Name Required Type Description
id Yes string (uuid) Stable identifier for the created document.
file_name Yes string Resulting document filename.
source_file_name Yes string Uploaded file that produced this document.
type Yes TypeEnum Detected document type.
status Yes Status61fEnum Initial document status. Newly uploaded documents are pending while parsing runs.
uploaded_at Yes string (date-time) Timestamp when the document row was created.
page_count Yes integer Number of pages, or 0 until parsing/conversion computes it.
sheet_name No string Original Excel sheet name when this document was created from a workbook sheet.
parent_document_id No string (uuid) Parent email document UUID when this document came from an email attachment.
parent_file_name No string Parent email filename when this document came from an email attachment.

V1DocumentUploadResponseFile

Name Required Type Description
file_url Yes string (uri) Stored location of the uploaded file.
file_name Yes string Original filename of the uploaded file.