Replace a document with a new version
replace_documentChanges data: replaces one document with a new file (a PDF, a JPEG, PNG or TIFF image, or an Excel or CSV spreadsheet, 50 MB at most), as the person who connected this app, and records it in the organization's audit log. The old document is kept as an older version that restore_document can bring back, but it stops counting: the new file is read (an AI extraction) and what it says takes the old one's place, so the data imported from the old one is replaced. Replacing a bill of lading or other transport document also lets the new one change the shipment's B/L number, which can change which shipment is tracked and where. Use it only when the user asks to replace or correct a document, and say which document and which file before calling. Give the file in exactly one way. In ChatGPT, pass the attached file as file. Otherwise give file_url, a public HTTPS link that Trackberry downloads once with no credentials. A link that needs a sign-in cannot be fetched (Microsoft 365, SharePoint and OneDrive links, Google Drive and Docs links that ask for a login, and similar share pages) and is refused with file_url_needs_sign_in; a direct download link that is public works. file_base64 with filename is a last resort for small files, 256 KB at most. When you have no public URL and the file is not small, or you only hold such a sign-in link or an attachment you cannot pass (a Claude.ai or Microsoft Copilot chat attachment, say), call request_upload_link instead (with replace_document_id set to this document) and give the user that link; pass replace_document_id with this document's id and the file the user chooses replaces it, exactly as this tool would. Only a current document can be replaced. Sending the same file again for a document it already replaced comes back as that replacement, with created false; a different file is a second replacement. Answers with the new document (replaces names the old one).
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": {
"document_id": "<document_id>"
},
"name": "replace_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | ChatGPT's attached-file object. Pass the file the user attached as it is given to you. | |
| file_url | No | A public HTTPS link to the file. Trackberry downloads it without credentials, so a link that needs a sign-in (SharePoint, OneDrive, Google Drive) does not work: use request_upload_link for those. | |
| filename | No | The file's name with its extension, such as "invoice.pdf". Required with file_base64; optional with file_url. | |
| document_id | Yes | A document id such as "doc_45", as returned by list_documents. | |
| file_base64 | No | The file's bytes, base64 encoded, 256 KB at most when decoded. A last resort for small files: it costs you the whole file as output. |