Get an attachment download link
get_attachment_fileGet temporary download URLs for attachments by media_id from list_attachments (or the id in a /media/ URL). Pass one ID as a string, or a list of 1–100 IDs. A string returns one download; a list returns results, even with one item. Duplicate IDs appear once, in input order. Each result has the download fields or media_id and error; an unavailable or inaccessible attachment does not block the others. Call only for the files the user requests. The URL downloads the original bytes without an Authorization header or browser session. Anyone holding the URL can download that file until expires_at; do not publish it or include it in shared documents. Request a new URL if it expires. No OAuth bearer is exposed. Only accessible, stored media is available. This returns a download URL, not a ChatGPT file_id; another tool must support fetching the URL to use or transfer the file.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"media_id": "<media_id>"
},
"name": "get_attachment_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| media_id | Yes | One media_id from list_attachments (or a /media/<id> URL), or a list of 1–100 IDs. A list returns results per distinct ID in input order. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Temporary URL for the original file. GET without Authorization or cookies. Grants anyone holding it access to this file until expires_at; do not publish it. | |
| results | No | List input only: one download or error per distinct media_id, in input order. | |
| media_id | No | The requested attachment's id. | |
| file_name | No | The original file name. | |
| expires_at | No | UTC expiry in ISO 8601; request a new link after this. | |
| size_bytes | No | The file size in bytes. |