跳转到内容
EN

Create a download URL

Code Mode: praxis.file.files.contentUrl.create

HTTP: POST /file/v1/files/{file_id}/content_url

Download a file’s bytes to a local disk from a coding agent without sending them through the model. Use file_id from file creation or listing, then run curl -fsSL -o <filename> ‘<url>’ locally with the returned URL; GET needs no Authorization header. The link is reusable until expiry and supports a single byte Range (for example Range: bytes=0-9 returns 206). Revoke it with files.contentLinks.revoke, passing the token after /c/ in the URL. Expired, revoked, invalid or cross-organization URLs return 404. Lifetime defaults to 900 seconds and is at most 604800 seconds. Issuance requires the same credential and file-read access as files.retrieveContent; a processing file returns 409 FILE_NOT_READY, so poll files.retrieve until active before retrying. A missing, expired or other-organization file returns 404. Each issuance creates a new link. OpenAI Files has no signed download URL; this follows S3 presigned GET semantics. Example body: {“ttl_seconds”:3600}.

签名

praxis.file.files.contentUrl.create(args:{path:{/** pattern: ^file-[0-9A-Za-z]{24}$ e.g. "file-0123456789ABCDEFGHIJKLMN" */ file_id:string};body?:{/** Download link lifetime in seconds, from 1 through 604800; omitted means 900. */ ttl_seconds?:number}}):Promise<{/** Bearer GET URL for the file bytes. */ url:string;/** UTC timestamp when this download URL expires. */ expires_at:string}>;

参数

名称位置类型必填说明
file_idpathstring是Tenant-owned live file identifier from file creation or listing; the file must be active to issue a download URL.

请求体

必填内容类型说明
否application/json

响应

状态码内容类型说明
200application/jsonReusable bearer download URL and its expiry; fetch the bytes locally without Authorization.
400INVALID_PARAMS: ttl_seconds must be an integer from 1 through 604800; correct the lifetime or omit the body for the default.
401UNAUTHENTICATED: supply a valid organization API key or signed-in session.
403PERMISSION_DENIED: use a credential with the same file-read access required by files.retrieveContent.
404FILE_NOT_FOUND: the file is missing, expired or belongs to another organization; verify file_id and obtain an active file in your organization.
409FILE_NOT_READY: the file is still being assembled; poll files.retrieve until its state is active before requesting a URL again.