Media
Save a file from a URL or inline base64 without knowing what it is. Built for AI output that expires (Replicate, OpenAI, Runway, fal, Gemini): PixelVault reads the first bytes, stores the file as an image, PDF, MP4 or audio asset, and returns that asset's object with a permanent URL.
Save media from a URL or base64, any type
POST /v1/media
Save an image, PDF, MP4 video or audio file as a permanent asset without choosing the endpoint first. Send a public https url (for example a Replicate, fal, OpenAI or Runway result link that will expire) or inline data (base64 or a data: URL, up to 10 MB decoded, for providers that return bytes, such as Gemini or ElevenLabs).
PixelVault identifies the file from its first bytes, not from the URL or Content-Type (provider CDNs often send application/octet-stream), then stores it exactly as upload_image, upload_video or upload_audio would: the same validation, plan limits, quotas, posters, webhooks and Idempotency-Key replays. The response is that endpoint's object, so check kind (image, document, video or audio). URL imports record the host they came from as source_host.
A URL is requested twice: a short probe that reads the first 4 KB, then the import. Act within the link's lifetime; Replicate deletes outputs after an hour.
Auth: a secret API key. Images and PDFs follow the unverified-account allowance of upload_image (5 files); video and audio need a verified email.
Supported: JPEG, PNG, GIF, WebP, AVIF, SVG, PDF, MP4 (QuickTime files that declare MP4 compatibility count), MP3, WAV, M4A and OGG. MOV and WebM are converted to MP4 on ingest (up to 60 seconds and 100 MB, using the monthly video-optimization allowance; see upload_video); a GIF stays an image here (send it to upload_video to get an MP4). HEIC, FLAC, AAC and AVI return 415 with detected_format and a hint about what to convert to.
Options apply only to the types they belong to: describe and dedupe to images, social_ready and normalize to video, collection_id to video and audio.
Authentication
API key, sent as Authorization: Bearer <key>.
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Idempotency-Key | string | Optional | Retry safety, up to 255 non-space printable ASCII characters. A repeat returns the asset the first request stored ( |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
url | string (uri) | Optional | Public https URL of the file (up to 3 redirects). Video and audio sources must send |
data | string | Optional | The file as base64 or a base64 |
filename | string | Optional | Original filename. Defaults to the URL's last path segment, or |
visibility | string | Optional |
|
sign_expires_in | integer | Optional | Lifetime in seconds of the returned private URLs. |
expires_in | integer | Optional | Delete the asset after this many seconds. Omit to keep it permanently. |
folder | string | Optional | Folder (part of the CDN path for public images). |
collection_id | string | Optional | Video and audio: an existing collection with the same visibility. |
metadata | object | Optional | Custom metadata (max 50 top-level keys, 4 KB). |
describe | boolean | Optional | Images: generate an AI description in the background (see |
dedupe | boolean | Optional | Images: return an existing image with identical bytes instead of storing a copy. Cannot be combined with |
social_ready | boolean | Optional | Video: also create a social-ready H.264/AAC copy (see |
transcribe | boolean | Optional | Audio: start transcription as soon as it is stored (see |
normalize | boolean | Optional | MP4 video: make the stored file play everywhere (see |
Responses
- 200
Nothing new was stored: an
Idempotency-Keyreplay (replayed: true) or an imagededupematch (deduplicated: true). - 201
Stored.
datais an Image (also for PDFs,kind: "document"), Video or Audio object. - 400
invalid_json: the body is not a JSON object.validation_error: not exactly one ofurlanddata, or a bad option.invalid_data:datais not base64.invalid_url,unsupported_scheme(not https),blocked_host(private or internal address),url_fetch_failed(network error, timeout, too many redirects or a non-2xx response, such as an expired link),url_length_required(a video or audio source sent noContent-Length): the URL could not be imported.invalid_file,invalid_audio,unsupported_audio_codec,invalid_upload: the bytes failed the type's validation. - 401
missing_api_key: noAuthorizationheader.invalid_api_key: the key is unknown or revoked. - 402
upload_limit_reached,storage_limit_reached,private_limit_reached: a plan quota is full. - 403
publishable_key_forbidden: use a secret key.email_verification_required: an unverified account has used its image allowance, or the file is video or audio.account_suspended: the account is suspended. - 404
collection_not_found: no such collection in the project. - 409
idempotency_in_progress: a video or audio import with thisIdempotency-Keyis still running. Retry later. - 410
idempotency_result_deleted: the asset created with thisIdempotency-Keywas deleted; use a new key. - 413
file_too_large: over the plan's limit for the type, ordataover 10 MB.url_too_large: the remote file declares a size over the limit.optimization_source_too_large:social_readywith a video over 100 MB.conversion_source_too_large: a MOV or WebM over 100 MB. - 415
unsupported_media_type: the bytes are not a supported format.detected_formatnames it when recognized (heic,flac,aac,avi,3gp), otherwiseunknown. - 422
idempotency_key_reuse: theIdempotency-Keywas already used for a different file or options.collection_visibility_mismatch: the collection's visibility differs from the asset's.conversion_duration_too_long/conversion_failed: a MOV or WebM over 60 seconds, or one that could not be converted; nothing was stored. - 429
rate_limit_exceeded: more than 60 requests per minute for this key (or dashboard session) or 300 per minute for the project. HonourRetry-After. - 503
temporarily_unavailable: storage did not accept the file after several retries; nothing was saved. Safe to retry afterRetry-After(10 seconds).
curl -X POST https://api.pixelvault.dev/v1/media \
-H "Authorization: Bearer $PIXELVAULT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://replicate.delivery/xezq/abc123/out-0.webp",
"data": "data:image/png;base64,iVBORw0KGgo...",
"filename": "hero.webp",
"folder": "generations",
"metadata": {
"model": "flux-schnell",
"prompt_id": "42"
}
}' {
"data": {
"id": "img_abc123",
"kind": "image",
"url": "https://img.pixelvault.dev/proj_xyz789/img_abc123.jpg",
"branded_url": "https://media.example.com/img_abc123.jpg",
"optimized_url": "https://img.pixelvault.dev/proj_xyz789/img_abc123.jpg?fmt=auto&q=85",
"mime_type": "image/jpeg",
"size": 245782,
"width": 1920,
"height": 1080,
"filename": "photo.jpg",
"folder": "blog",
"metadata": {
"env": "prod",
"run": "42"
},
"source_host": "replicate.delivery",
"description": {
"status": "done",
"alt": "A red fishing boat moored in a small harbour at sunset",
"caption": "A small red fishing boat rests at a stone quay while the sun sets behind the harbour wall.",
"ocr_text": "HARBOUR MASTER",
"tags": [
"boat",
"harbour",
"sunset"
],
"model": "@cf/mistralai/mistral-small-3.1-24b-instruct",
"described_at": "2026-11-16T12:00:04.000Z",
"cached": false,
"error": "describe_timeout"
},
"describe_skipped": "unsupported_type",
"created_at": "2026-11-16T12:00:00.000Z",
"expires_in": 86400,
"temporary": true,
"delete_token": "pv_del_3xQm9TzR1aB7cD2eF4gH6jK8lN0pS5uV",
"deduplicated": true,
"replayed": true
}
}