Skip to main content

File Upload API

The File Upload API is the entry point for supplying supporting files (PowerPoint, PDF, images, etc.) to downstream jobs such as AutoGenerator and Template Converter.

Three endpoints cover the three patterns:

  • POST /api/v1/upload — single, small files (base64-encoded inline).
  • POST /api/v1/preprocess — chunked upload for larger files.
  • POST /api/v1/validate — validate previously uploaded files and/or web links.

Full schemas and try-it-out forms live in the interactive API Reference.

Authentication

All endpoints require a Bearer token:

Authorization: Bearer YOUR_API_KEY

See Getting Started → Authentication.

Response envelope

Every endpoint returns the canonical envelope: { "success": true, "data": { ... } } on success or the standard error envelope on error.

Endpoint summary

MethodPathDescriptionSync/Async
POST/api/v1/uploadUpload a single file (base64-encoded)Sync
POST/api/v1/preprocessPreprocess a file in chunksSync
POST/api/v1/validateValidate uploaded files and/or web linksSync

All endpoints are in the auto_generator rate-limit category. See Developer Guide → Usage quotas and rate limits.


POST /api/v1/upload — Upload a single file

Accepts a single file as a base64 string or data: URL in the request body. Use this for small files (typically under a few MB).

Request body

FieldTypeRequiredDescription
fileContentstringyesFile content as a base64 string or data: URL.
fileNamestringyesOriginal filename including extension.

Example

curl -X POST https://api.prezent.ai/api/v1/upload \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fileName": "context.pdf",
"fileContent": "data:application/pdf;base64,JVBERi0xLjQK..."
}'

Success response (200)

{
"success": true,
"data": {
"file": {
"file_id": "file_abc123",
"file_name": "context.pdf",
"file_type": "application/pdf",
"s3_path": "uploads/co_xyz/file_abc123/context.pdf",
"s3_bucket": "prezent-uploads"
},
"message": "File uploaded."
}
}

data.file.file_id is what you reference in downstream jobs (for example as an entry in files for the AutoGenerator start endpoint).


POST /api/v1/preprocess — Chunked upload

Accepts one chunk of a multi-chunk file upload. The caller drives chunking via chunkIndex and totalChunks; chunks for the same upload share a requestIdentifier. Once all chunks for a requestIdentifier arrive, the file is assembled and made available to downstream operations.

A parallel chunked-upload endpoint exists for Template Converter specifically (POST /api/v1/template-converter/preprocess) and uses the same request shape; only .pptx files are accepted there.

Request body

FieldTypeRequiredDescription
fileContentstringyesChunk content as base64 / data: URL.
fileNamestringyesOriginal filename including extension.
chunkIndexinteger ≥ 0yesZero-based index of this chunk.
totalChunksinteger ≥ 1yesTotal number of chunks for this upload.
requestIdentifierstringyesCaller-supplied identifier that groups chunks of the same upload.

Example (one chunk)

curl -X POST https://api.prezent.ai/api/v1/preprocess \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fileName": "big-deck.pptx",
"fileContent": "UEsDBBQAAAAIAA...",
"chunkIndex": 0,
"totalChunks": 4,
"requestIdentifier": "upload-2026-05-18-001"
}'

Success response (200)

{
"success": true,
"data": {
"request_identifier": "upload-2026-05-18-001",
"file_name": "big-deck.pptx",
"message": "Chunk received."
}
}

POST /api/v1/validate — Validate files / links

Validates a set of previously uploaded files (referenced by fileIdentifiers) and/or a list of web links. At least one of fileIdentifiers or webLinks must be non-empty.

Request body

FieldTypeRequiredDescription
fileIdentifiersobjectconditionalMap of uuidfileName for previously uploaded files.
webLinksarray of URIconditionalList of URLs to validate.

Example

curl -X POST https://api.prezent.ai/api/v1/validate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fileIdentifiers": { "file_abc123": "context.pdf" },
"webLinks": ["https://example.com/whitepaper"]
}'

Success response (200)

{
"success": true,
"data": {
"files": [
{ "uuid": "file_abc123", "file_name": "context.pdf", "valid": true }
],
"web_links": [
{ "url": "https://example.com/whitepaper", "valid": true }
],
"message": "Validation complete."
}
}

If validation fails, the entry includes a reason field:

{ "uuid": "file_zzz999", "file_name": "broken.docx", "valid": false, "reason": "Unsupported file type." }

Errors

Common error codes:

  • 400MISSING_FILE_CONTENT, MISSING_REQUIRED_FIELD, INVALID_PAYLOAD, FILE_UPLOAD_FAILED.
  • 401INVALID_API_KEY, EXPIRED_API_KEY, UNAUTHORIZED.
  • 404ENDPOINT_NOT_FOUND, RESOURCE_NOT_FOUND.
  • 415UNSUPPORTED_FILE_TYPE.
  • 422INVALID_INPUT, UNPROCESSABLE_ENTITY.
  • 429RATE_LIMIT_EXCEEDED, THROTTLED.
  • 500 / 503 / 504 — standard server-side codes.

See the full catalog in Developer Guide → Error codes.