---
title: "Upload media"
method: POST
path: "/v1/media"
tags: ["Media"]
---

# Upload media

`POST /v1/media`

## Request

- Base URL: `https://api.postlake.dev`
- URL: `https://api.postlake.dev/v1/media`
- Auth: `bearerAuth` (a scheme the document does not define)

Upload media, either as raw binary with Content-Type set, or as multipart/form-data with a file part. For images the response includes the pixel dimensions, which are checked against each network's limits at publish time.

## Response `201`

Created

- MediaAsset
  - `deletionState` 'deleting': Cleanup is incomplete and can be retried. This upload cannot be used in new posts.
  - `retention` object: Minimum 90 days from upload on every plan while the account is open. Scheduled references remain protected until terminal state plus 30 days if later. No automatic expiry currently. Account deletion, verified erasure requests and legal/security removal are exceptions. Source URLs are public, not private storage.
    - `version` string
    - `minimumDays` integer
    - `minimumUntil` string, date-time
    - `scheduledProtection` string
    - `automaticExpiry` boolean
    - `exceptions` string[]
    - `scope` string
    - `accountRequirement` string
    - `publicUrls` boolean
    - `postRemovalDeletesMedia` boolean
    - `backupService` boolean
  - `id` string, required
  - `url` string, uri, required
  - `contentType` string, required
  - `size` integer, required
  - `createdAt` string, date-time, required
  - `width` integer: Pixel width. Images only, and absent when the header could not be read.
  - `height` integer: Pixel height. Images only, and absent when the header could not be read.

## Other responses

- `400`: Empty body, missing Content-Type, no file part, or an unsupported media type
- `401`: Unauthorized

---

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