Preview link of a PDF, an audio or a video
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.
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}$Unauthorized: missing or invalid credentials.
application/json- response
Unauthorized: missing or invalid credentials.
error*stringcurl -X GET 'http://localhost:3000/api/v1/attachments/string/preview'{ "error": "string"}Download an attachment GET
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.
Text of a text, code, markdown, CSV or JSON file GET
For the in-app viewer (fazer-ai/projects#294): checks that the caller sees the task now and answers the file's text from the app's own origin as `text/plain; charset=utf-8` with `nosniff` and `no-store`, never a redirect. At most the first 1 MiB, cut on a character boundary: `X-Attachment-Size` is the whole file's size in bytes, `X-Attachment-Shown` the bytes returned and `X-Attachment-Truncated` is `1` when the text stops before the file does. A file that is not UTF-8 text is a 422, as is any type without a text preview (`previewKind` text, markdown, csv, tsv or json has one); a file the caller cannot see is the same 404 as the content route. Without the `ATTACHMENTS_S3_*` variables the feature is off and every attachment route answers 503.