Uploads
Upload a file with a developer key and get its file id.
An upload takes three steps: ask for a link, PUT the file to it, then finish.
POST /v1/uploadswith the file'sfilename,content_typeandsizeanswers anuploadwith itsid, a one-timeput_url, when it expires (expires_at, two hours) and the size limit (max_bytes, 50 MB).PUTthe raw bytes toput_urlwith the sameContent-Type. The bytes go straight to storage, so send noAuthorizationheader. Anyone who holds the link can use it, once: keep it private.POST /v1/uploads/{id}/finish, with no body, answers thefile: itsid,name,sizeandmime_type.
curl -X POST https://api.pantheon.run/v1/uploads \
-H "Authorization: Bearer $PANTHEON_API_KEY" -H "Content-Type: application/json" \
-d '{"filename":"report.pdf","content_type":"application/pdf","size":48213}'
curl -X PUT "$PUT_URL" -H "Content-Type: application/pdf" --data-binary @report.pdf
curl -X POST https://api.pantheon.run/v1/uploads/$UPLOAD_ID/finish \
-H "Authorization: Bearer $PANTHEON_API_KEY"Access. The key needs its sending switch on: the send scope ("Send messages & email" in Settings, Developer), since a file is uploaded to be sent: pass its id in the attachments of POST /v1/messages/send. A key without it is refused with 403 sending_off. The workspace needs Developer access and a paid plan.
Whose file it is. The key holder's, in the key's workspace. Teammates cannot read it or send it, and it can be sent only from this workspace. Its text is not extracted, so GET /v1/files/search does not find it and GET /v1/files/{id}/text has no text for it.
What is accepted. JPEG, PNG, WebP, GIF and HEIC images; PDF, DOCX, DOC and PPTX; plain text, CSV and Markdown; OGG, MP4 and M4A audio; MP4 and QuickTime video; and application/octet-stream for anything else. An executable, a disk image or an archive (RAR, 7z, tar, gzip, bzip2, xz, deb, rpm) is refused whatever it is called, and a script passes only as plain text. A ZIP container is the one exception: an XLSX is one, so ZIP bytes pass as application/octet-stream, though a name ending in .zip does not. Text must not contain NUL bytes, unless it is UTF-16 with a byte order mark; send any other text as application/octet-stream. The finish checks the real bytes: they must be exactly size bytes and really be content_type, and they are scanned for viruses.
Refusals, at create:
invalid_filename,invalid_content_type,invalid_size,unknown_field(400):details.fieldnames the field.file_too_large(413) andunsupported_media_type(415): refused before you send a byte.too_many_pending_uploads(429): 50 uploads are started and not finished. Finish them, or wait for their links to expire.upload_url_unavailable(502): no link could be made. Try again.
At finish:
-
upload_not_found(404): no such upload for this key's holder in this workspace. -
upload_not_received(409,details.retryable: true): nothing was PUT to the link yet. -
upload_expired(410): the link expired before the file was sent. Start a new upload. -
size_mismatch(422),content_type_mismatch(415),file_too_large(413),unsupported_media_type(415),file_infected(422): the file was refused and not kept in your files. Start a new upload. -
upload_spent(410): this upload was already refused. -
not_a_member(403): the key's holder is no longer a member of the workspace. -
uploads_busy(503,details.retryable: true): too many files are being stored at once. Your bytes are kept; finish again in a moment.
Retries. Finishing again answers the same file, so retry a 502, 503 or 504 outcome_unknown with the same id. An upload that is never finished is deleted within three days. Neither call takes an Idempotency-Key: asking for a link again makes another link.
Price and limits. One upload costs one data call, charged when the link is made; finishing is free. Each of the two calls is limited to 60 a minute per key.
Authorization
apiKeyAuth Developer API key — Authorization: Bearer pk_live_...
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.pantheon.run/v1/uploads" \ -H "Content-Type: application/json" \ -d '{}'{
"upload": {
"expires_at": "string",
"id": "string",
"max_bytes": 0,
"put_url": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}Authorization
apiKeyAuth Developer API key — Authorization: Bearer pk_live_...
In: header
Path Parameters
The upload id POST /v1/uploads answered.
length <= 64Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.pantheon.run/v1/uploads/string/finish"{
"file": {
"id": "string",
"mime_type": "string",
"name": "string",
"size": 0
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}{
"error": {
"code": "string",
"details": {},
"message": "string"
}
}