Media Storage

Upload media

Upload an image, audio, or video file via multipart/form-data (field file), application/json (base64 data), or a raw file body with its media MIME type and Content-Length headers. Multipart and raw uploads stream to storage up to 400 MiB; JSON uploads remain limited to 100 MiB because base64 decoding buffers in Worker memory. Raw uploads receive a random, unlisted ID. Returns an id and its retrieval URL. Omit id for a new random ID, or supply a case-sensitive ID scoped to your account. Custom IDs require a user-owned API key; the returned id includes an opaque account prefix. Existing files or gallery entries return 409 without being replaced, including on retries. Untagged files cannot be deleted. Files expire after 30 days; GET refreshes retention once a file is at least 15 days old.

Tags publish. An optional tags field publishes the upload into each tag's public gallery (GET /media?tag=…), where anyone can see it. Untagged uploads stay unlisted, but all retrieval URLs are public. Knowing one custom URL makes other predictable names in that account guessable. Alpha: the publish tagging is new and may still change.

post/upload

Request

  • Base URL: https://media.pollinations.ai
  • URL: https://media.pollinations.ai/upload
  • Auth: HTTP bearer

Request body

idstring

Optional case-sensitive ID, scoped to your account. The returned id includes an opaque account prefix. Existing IDs return 409; omit for a random ID.

datastring required

Base64-encoded file bytes (with or without a data: prefix).

contentTypestring

MIME type; defaults to application/octet-stream.

namestring

Filename; used for the download Content-Disposition.

Response

Upload successful

idstring required

Unique media id (also the retrieval id)

urlstring required

Public retrieval URL

contentTypestring required
sizeinteger required

File size in bytes

tagsstring[]

Tags the upload was published with; present only when tagged

Changes

No recorded changes to this operation across all 1 revision of this API.