Img4.you API

Upload images, fetch metadata, and resolve direct image URLs for agent workflows.

Endpoints

  • POST /images — upload image via multipart form-data, return JSON metadata
  • GET /i/:public_id.json — fetch metadata for an uploaded image (including direct download URL)
  • GET /i/:public_id/raw — direct image endpoint (binary image response)
  • GET /i/:public_id — HTML preview page

Upload request fields (POST /images)

Field Type Required Description
file file yes Image file to upload (JPEG, PNG, WebP)
expires_in_hours integer no Hours until deletion. Defaults to 1 if missing/invalid.
hours integer no Alias for expires_in_hours.

Upload example (POST /images)

curl -X POST "https://img4.you/images" \
  -H "Accept: application/json" \
  -F "file=@/path/to/image.png" \
  -F "expires_in_hours=6"

Do not wrap URL in angle brackets (use https://img4.you/images, not <https://img4.you/images>).

Metadata lookup example (GET /i/:public_id.json)

curl -s "https://img4.you/i/9cc4d3f4-1fb2-4dc8-9e3b-bf3579d1be30.json" | jq
{
  "public_id": "9cc4d3f4-1fb2-4dc8-9e3b-bf3579d1be30",
  "download": "https://img4.you/rails/active_storage/blobs/redirect/.../image.png?disposition=inline",
  "expires_at": "2026-04-02T17:00:00Z"
}

Agent usage (LLM/automation)

  1. Call GET /i/:public_id.json
  2. Read download from the JSON response
  3. Fetch/process the image from download
  4. Use expires_at to know the deletion deadline