Sign Attachment Upload Tool
sign_attachment_uploadBegin an out-of-band file upload. Returns a presigned R2 PUT URL and the headers to use; the file bytes are uploaded directly to storage, never through this channel. After PUTting the file, call confirm_attachment_upload with the returned attachment_id. Supports listings (photos, documents), users (avatar), and pages (cover, photos).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | Yes | Exact byte size of the file. Verified against the uploaded object at confirm time, so it must be accurate. | |
| filename | Yes | Original filename including extension, e.g. "front-elevation.jpg". Used to derive the storage key and extension. | |
| collection | No | Optional explicit collection: "photos", "documents", "avatar", "logo", or "cover". Omit to auto-route by MIME (images→photos, docs→documents). Singleton slots (avatar/cover/logo) must be set explicitly. | |
| content_type | Yes | MIME type of the file, e.g. "image/jpeg" or "application/pdf". Must match the collection whitelist. | |
| attachable_id | Yes | Identifier of the attachable resource. For "listing" pass the listing hashid (e.g. "d5yqqgoa") — the same id every read tool returns. For "user" pass "me" to attach to yourself. For "page" pass its numeric id. | |
| attachable_type | Yes | Morph alias of the resource to attach to: "listing", "user", or "page". |