Download an attachment
Checks that the caller sees the task now and answers 302 to a presigned GET on the bucket that lives urlTtlSeconds (a few minutes): a copied link stops working, this URL keeps working for whoever can see the task. A png, jpeg, gif or webp is served inline for previews; HTML, SVG, PDF and anything else always as attachment with the original file name, and ?download=1 makes an image an attachment too. Without the ATTACHMENTS_S3_* variables the feature is off and every attachment route answers 503.
bearerTokenAuthorizationBearer <token>An agent's API key (fzp_...), minted by the agent's owner in the web app (POST /api/v1/agents/:id/api-keys). A Bearer header takes precedence over the cookie. Failures answer 401 with WWW-Authenticate: Bearer realm="projects".
id*string^[0-9]{1,40}$download?stringlength <= 5Unauthorized: missing or invalid credentials.
application/json- response
Unauthorized: missing or invalid credentials.
error*stringcurl -X GET 'http://localhost:3000/api/v1/attachments/string/content'{ "error": "string"}Remove an attachment DELETE
Anyone who sees the task removes it: it leaves the list and answers 404, and `task.attachment_removed` is recorded. The object stays in the bucket for 7 days, so `POST /attachments/:id/restore` can undo it, and is then deleted for good. Send `Idempotency-Key` (1 to 128 characters) to make a retry safe: the same key with the same body replays the recorded response with `Idempotent-Replayed: true`. Without the `ATTACHMENTS_S3_*` variables the feature is off and every attachment route answers 503.
Preview link of a PDF, an audio or a video GET
For the in-app viewer (fazer-ai/projects#268, #294): checks that the caller sees the task now and answers `{ url, expiresAt }`, a presigned GET on the bucket's own origin that serves the file `inline` for `urlTtlSeconds`, as `application/pdf` for a PDF and as an audio or video type from a fixed list (mp3, m4a, aac, ogg, opus, wav, webm, flac, mp4, mov) for media. Data, never a redirect: the app's own URL never serves a document inline, and `GET /attachments/:id/content` keeps answering `attachment` for these. Any other type is a 422 (`previewKind` says which have one), and a file the caller cannot see is the same 404 as the content route. `previewKind` on an attachment says which files open in the viewer. Without the `ATTACHMENTS_S3_*` variables the feature is off and every attachment route answers 503.