Media
POST /v1/media uploads a local file for use in a notification. The backend stores media in Azure Blob when media storage is configured and returns a kind-aware media object accepted by POST /v1/messages as attachment. It also returns blob_url, image_url, and content_type for older clients.
Rendering depends on the uploaded file type:
- Image content types (
image/png,image/jpeg,image/gif,image/webp) returnkind: "image". Send the returnedattachmentto/v1/messages; the backend also backfills legacyimage_urlfor older clients. iOS feed cards render approved images inline and APNs can attach them as rich notification media when the URL passes the approved-host policy. - Audio/video uploads return
kind: "audio"orkind: "video"; callers may includeduration_msin the multipart form, and the hook runner probes it when local metadata is available. - PDFs, Markdown files, logs, archives, and other documents return
kind: "file". Send the returnedattachment; optionally mirrorblob_urlintourl+url_titlefor compatibility with older clients. file_pathson/v1/messagesis metadata/context only. It does not upload file bytes.
The media API is intentionally blob-centric: it never needs to know the sender's local absolute path. Customer-facing wrappers should upload the bytes, use the returned attachment fields, and send local path strings only when the user explicitly opts into metadata context.
Production URL:
POST https://notifier.aicrew.in/api/v1/media
Required auth:
X-API-Key: an_key_REPLACE_WITH_YOUR_KEY
Upload example
curl -sS -X POST https://notifier.aicrew.in/api/v1/media \
-H "X-API-Key: $AGENT_NOTIFIER_API_KEY" \
-F "file=@screenshot.png"
Response
{
"id": "media_000000000000",
"blob_name": "uploads/project/screenshot.png",
"blob_url": "https://example.blob.core.windows.net/...",
"image_url": "https://example.blob.core.windows.net/...",
"content_type": "image/png",
"kind": "image",
"mime_type": "image/png",
"size_bytes": 123456
}
Use the returned structured attachment fields in a message:
{
"type": "file",
"title": "Screenshot ready",
"message": "Tap to inspect the latest run output.",
"attachment": {
"id": "media_000000000000",
"kind": "image",
"url": "https://example.blob.core.windows.net/...",
"mime_type": "image/png",
"size_bytes": 123456,
"file_name": "screenshot.png"
}
}
For non-image files, use the returned attachment and optionally mirror the blob as a link for older clients:
{
"type": "file",
"title": "Report ready",
"message": "Open the uploaded Markdown report.",
"attachment": {
"id": "media_000000000001",
"kind": "file",
"url": "https://example.blob.core.windows.net/...",
"mime_type": "text/markdown",
"size_bytes": 8192,
"file_name": "report.md"
},
"url": "https://example.blob.core.windows.net/...",
"url_title": "report.md"
}
Notes
- Multipart uploads have a hard 50 MiB request cap. Images, audio, and generic files are capped at 25 MiB; video uploads may use up to 50 MiB.
- APNs rich media display has tighter practical image limits; keep notification images small when possible.
- The current
/v1/messagesschema stores one primary structuredattachment. Compatibility clients may also populate legacyimage_urlfor the first image andurl/url_titlefor the first non-image file. True multi-attachment rendering should be treated as a future API/client expansion. - Local hook uploads are explicit opt-in via fields/env vars such as
media_file_path,upload_file_path,attachment_path,AGENT_NOTIFIER_MEDIA_FILE_PATH(S), orAGENT_NOTIFIER_UPLOAD_FILE_PATH(S). Ordinary toolfile_pathvalues remain metadata-only to avoid accidental source-file uploads. - If Azure Blob is not configured, the endpoint returns
503. - Free-tier clients may use externally hosted
image_urlvalues; Pro unlocks server-side blob uploads per the product plan.