Media
Get Media
Returns one media asset. status turns ready once the upload has arrived.
BearerAuthorizationBearer <op_>Workspace API key, sent as Authorization: Bearer op_... Keys are created in the dashboard.
id*string1 <= lengthMedia asset
application/json- response
id*stringPass it in a post's media as { id }.
url*stringPublic URL of the file. It never changes, and serves the file once status is ready.
uricontentType*stringMIME type of the file.
sizeBytes*|File size in bytes. Null until status is ready.
filename*|The filename sent to Create Media. Null for a file added without one.
status*|pending until the file has been uploaded to uploadUrl and checked, usually within seconds. New values can be added, so handle a value you do not know.
createdAt*stringdate-timeimport { Configuration, MediaApi } from "@onepostly/sdk";const mediaApi = new MediaApi( new Configuration({ accessToken: process.env.ONEPOSTLY_API_KEY }));const response = await mediaApi.getMedia({ id: "med_7f3a9c2e1b4d4e8f9a6b5c4d3e2f1a0b",});console.log(response);{ "id": "med_7f3a9c2e1b4d4e8f9a6b5c4d3e2f1a0b", "url": "https://cdn.onepostly.com/media/5b0e7c1a-2f4d-4c8e-9a3b-6d1f0e2c4a7b/7f3a9c2e-1b4d-4e8f-9a6b-5c4d3e2f1a0b.mp4", "contentType": "video/mp4", "sizeBytes": 48203776, "filename": "launch.mp4", "status": "ready", "createdAt": "2027-03-15T09:00:00.000Z"}Create Media
Creates a media asset and returns uploadUrl. PUT the file to uploadUrl with the declared Content-Type and exactly size bytes, then use the asset's id in a post. Files are kept for 7 days until a post uses them.
Delete Media
Deletes a media asset and its file. Posts already published with it stay on the platform.