---
title: "Create a presigned media upload URL"
method: POST
path: "/v1/media/presign"
tags: ["Media"]
---

# Create a presigned media upload URL

`POST /v1/media/presign`

## Request

- Base URL: `https://api.postzen.dev`
- URL: `https://api.postzen.dev/v1/media/presign`
- Auth: HTTP bearer

Creates a presigned URL for uploading an image, video, GIF, or PDF to PostZen-hosted storage. Upload the file with an HTTP `PUT` to `uploadUrl`, then reference `publicUrl` in post `mediaItems`. This endpoint requires a read-write API key.

## Request body

- MediaPresignRequest
  - `filename` string, required: Original file name. PostZen sanitizes it for storage.
  - `contentType` 'image/jpeg' | 'image/jpg' | 'image/png' | 'image/webp' | 'image/gif' | 'video/mp4' | 'video/mpeg' | 'video/quicktime' | 'video/avi' | 'video/x-msvideo' | 'video/webm' | 'video/x-m4v' | 'application/pdf', required
  - `size` integer: File size in bytes.
  - `profileId` string: Optional profile scope. If provided, the API key must have access to the profile.

## Response `200`

Presigned upload URL created.

- MediaPresignResponse
  - `uploadUrl` string, uri, required: Use this URL for the direct file upload.
  - `publicUrl` string, uri, required: Use this URL in post `mediaItems`.
  - `key` string, required
  - `type` 'image' | 'video' | 'gif' | 'document', required

## Other responses

- `400`: Invalid request.
- `401`: Missing or invalid API key.
- `403`: The API key does not have sufficient permission or profile access.
- `404`: Resource not found.
- `500`: Unexpected server error.

---

[API](https://skmtc.dev/postzen/apis/postzen-public-api.md) · [All operations](https://skmtc.dev/postzen/apis/postzen-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/postzen/apis/postzen-public-api/revisions/40863e3710ec?raw)
