Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /media | Upload a file (multipart) |
| GET | /media?site=…&kind=… | List library items, filterable |
| DELETE | /media/:mid | Delete a file |
| POST | /media/import | Fetch an image from a URL into the library |
| POST | /media/screenshot | Queue an automated page screenshot (async) |
| GET | /media/jobs/:jid | Check a screenshot job's result |
Requires the media_library plan feature.
Kinds
Every upload carries a kind so the library stays organized and the right images surface in the right pickers:
| Kind | Used for |
|---|---|
site_logo | Site header logo |
offer_logo | Offer card logos |
offer_shot | Offer gallery images (see Offers & galleries) |
banner | Category banners |
article_image | Featured article images |
misc | Everything else (default) |
Upload
Multipart form with file, kind and site_id. The response gives you the public URL and the media id for attaching elsewhere.
curl -X POST $API/media \
-H "Authorization: Bearer $KEY" \
-F "[email protected]" -F "kind=offer_logo" -F "site_id=$SITE_ID"
# → {"media": {"id": "…", "url": "https://media.vouchdock.com/…/logo.png", …}}
Dimensions and size are detected server-side; the response includes width, height, size_bytes, mime and any generated variants.
Import from URL
Hand us a URL, we fetch and host it — the migration-friendly way to move image assets off an old platform without downloading anything yourself.
curl -X POST $API/media/import \
-H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \
-d '{"url": "https://old-site.com/assets/hero.png", "kind": "banner", "site_id": "'$SITE_ID'"}'
Automated screenshots
We render the page with headless Chromium and store the result in your library. Async: queue a job, poll until done, then attach the resulting media id (e.g. as an offer logo or gallery image).
# 1. queue
JOB=$(curl -s -X POST $API/media/screenshot \
-H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \
-d '{"url": "https://acmevpn.example.com", "offer_id": "'$OFFER_ID'", "site_id": "'$SITE_ID'"}' \
| jq -r .job_id)
# 2. poll (usually done in a few seconds)
curl -s $API/media/jobs/$JOB -H "Authorization: Bearer $KEY"
# → {"status": "done", "media_id": "…"} (pending | running | done | failed)