Create a one-time upload URL
Code Mode: praxis.file.uploads.createSigned
HTTP: POST /file/v1/uploads/signed
Upload a local file of up to 20 GiB from a coding agent without sending bytes through the model. Provide filename (the stored basename), exact byte count and MIME type. Up to 104857600 bytes, PUT the file to url with curl -T photo.png -H ‘Content-Type: image/png’ ‘<url>’; success returns 201 with the file object, and reuse returns 410 CAPABILITY_USED. Above that threshold, split the file into part_size chunks (default 64000000 bytes) and PUT each chunk to its numbered parts[].url in any order; an interrupted client GETs status_url to see the received parts and resends only what is missing, then POSTs complete_url without a body. Part PUTs return 200; completion returns 201 with the file object, including its state, or 400 if a part is missing. A processing file can be polled with files.retrieve until active. Identical part bytes may be retried; changed bytes at the same number return 400. Completion reuse returns 201 with the same file, because a lost answer must not cost the file. Each PUT requires the exact signed Content-Length; single-PUT Content-Type must match content_type or be omitted. An expired upload answers 410 UPLOAD_EXPIRED on its status_url and complete_url while the upload still exists in the caller’s organization; revoked, invalid, cross-organization or unknown URLs return 404, including a link whose upload record no longer exists. A signed URL used for another action answers 403 CAPABILITY_MISMATCH, judged before expiry, so a status link posted to complete_url answers it and so does a completion link fetched as status_url. URL lifetime defaults to 900 seconds for single PUT or 604800 (7 days) for multipart, at most 604800; all multipart URLs, including status_url, share an expiry. Multipart creation reserves storage quota. Issuance requires the same unscoped credential as direct file creation. Each issuance creates a new upload and is not idempotent. Example body: {“filename”:“photo.png”,“bytes”:2048,“content_type”:“image/png”}.
Signature
praxis.file.uploads.createSigned(args:{body:{/** Stored basename, 1–255 UTF-8 bytes without control characters or path separators. e.g. "photo.png" */ filename:string;/** Exact local file size in bytes, from 1 through 21474836480 (20 GiB). e.g. 2048 */ bytes:number;/** Declared MIME type, such as image/png. e.g. "image/png" */ content_type:string;/** user_data and assistants store ordinary files and conversation images with their original purpose label; vision accepts PNG, JPEG, GIF or WebP images only. e.g. "user_data" */ purpose?:"user_data"|"assistants"|"vision";/** Lifetime in seconds, from 1 through 604800: defaults to 900 for single PUT or 604800 (7 days) for multipart. */ expires_in?:number;/** Fixed multipart chunk size in bytes, from 5242880 through 64000000; defaults to 64000000. */ part_size?:number}}):Promise<{/** One-time bearer URL on the files content domain. */ url:string;/** Opaque pending upload identifier bound to this URL; it is not a multipart Upload or a File ID. */ upload_id:string;/** UTC timestamp when the URL stops accepting uploads. */ expires_at:string}|{/** Pending multipart Upload identifier. */ upload_id:string;/** Shared UTC expiry of every part URL and the completion URL; unfinished uploads expire and release their reserved quota. */ expires_at:string;/** Fixed chunk length in bytes, except for the final remainder. */ part_size:number;/** One entry per chunk, numbered from 1 through ceil(bytes / part_size). */ parts:Array<{/** One-based chunk position in the original local file; its offset is (part_number - 1) times part_size. */ part_number:number;/** Bearer PUT URL for this chunk, without Authorization. */ url:string}>;/** Bearer URL to POST without a body after every chunk is acknowledged. */ complete_url:string;/** Read-only bearer URL for GET that answers the same body as GET /file/v1/uploads/{upload_id}: status, part_size and the received_parts. */ status_url:string}>;Request body
| Required | Content types | Description |
|---|---|---|
| yes | application/json |
Responses
| Status | Content types | Description |
|---|---|---|
| 200 | application/json | Single PUT URL, or numbered multipart PUT URLs and a completion URL, with expiry. Upload bytes locally to create the file. |
| 400 | INVALID_PARAMS: correct the filename, byte count, MIME type, purpose or lifetime named by the error before retrying. | |
| 401 | UNAUTHENTICATED: supply a valid organization API key or signed-in session. | |
| 403 | PERMISSION_DENIED, BINDING_READ_ONLY or CAPABILITY_MISMATCH: the credential lacks create authority, or a signed upload URL was used for another action than the one it names. |