Skip to content

Upload files

POST
/api/v1/files
curl --request POST \
--url https://api.langparse.dev/api/v1/files \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <X-Api-Key>' \
--data '{ "files": [ { "contents": "JVBERi0xLjQ…", "name": "invoice.pdf" } ] }'

Create one or many files. Each item carries exactly one source: contents (base64), url (server fetches it — SSRF-guarded, public http(s) only), or presign: true (returns a presigned PUT URL to upload to yourself — best for large files). name/contentType are inferred when omitted (filename → url → magic bytes). Results are per-item (partial success).

Media typeapplication/json
object
files
required
Array
One of:
Inline base64
object
contents
required
string
name
string
contentType
string
Examples

Inline base64

{
"files": [
{
"contents": "JVBERi0xLjQ…",
"name": "invoice.pdf"
}
]
}

Per-item results (partial success — inspect each ok).

Media typeapplication/json
object
data
required
Array<object>

Per-item result. On success ok:true + the file; on failure ok:false + error. status:"pending" (presign) also carries uploadUrl.

object
ok
boolean
id
string
name
string
contentType
string
byteSize
integer
nullable
status
string
Allowed values: stored pending
uploadUrl

Presign mode only — PUT the bytes here.

string
method
string
Allowed values: PUT
expiresInSeconds
integer
error
object
code
string
message
string
Example
{
"data": [
{
"ok": true,
"id": "file_mrb1a2c3d4",
"name": "invoice.pdf",
"contentType": "application/pdf",
"byteSize": 48213,
"status": "stored"
},
{
"ok": true,
"id": "file_mrb1a2c3e5",
"name": "big.pdf",
"contentType": "application/pdf",
"status": "pending",
"uploadUrl": "https://…s3…X-Amz-Signature=…",
"method": "PUT",
"expiresInSeconds": 900
}
]
}

Body must be { files: [ … ] }; each item needs exactly one of contents/url/presign.

Media typeapplication/json

Error response. statusCode mirrors the HTTP status; statusMessage is human-readable.

object
statusCode
integer
statusMessage
string
Example
{
"statusCode": 404,
"statusMessage": "Document not found"
}

Missing or invalid API key.

Media typeapplication/json

Error response. statusCode mirrors the HTTP status; statusMessage is human-readable.

object
statusCode
integer
statusMessage
string
Example
{
"statusCode": 404,
"statusMessage": "Document not found"
}