Developer docs
Guide: upload media to Beplan through the API
Put files in a workspace's media library: send the bytes yourself with an upload ticket, or let Beplan fetch them from a public address.
On this page
Both need media:write and a role that can add media to the workspace. A file in the library can then be attached to posts by its id.
| Upload | Import from a URL | |
|---|---|---|
| You send | The bytes, straight to storage | An https address |
| Steps | Start, PUT the parts, complete |
One call, then poll |
| Best for | Files you have locally | Assistants and no-code tools that can't send bytes |
| Limits | Images up to 20 MB, audio up to 50 MB and 15 minutes, videos up to 10 GB, within the organization's storage | Images and videos only, with the same limits |
Upload, step by step
1. Start
POST …/media-library/uploads with the file's name, MIME type and exact size in bytes (optionally a folderId and formatIds). It answers a ticket: the new mediaId, a versionId, and a plan telling you how to send the bytes.
curl -X POST "https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/uploads" \
-H "Authorization: Bearer beplan_pat_…" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"file": {
"filename": "launch-teaser.jpg",
"mimeType": "image/jpeg",
"size": 482133
}
}' const response = await fetch("https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/uploads", {
method: "POST",
headers: {
Authorization: "Bearer beplan_pat_…",
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"file": {
"filename": "launch-teaser.jpg",
"mimeType": "image/jpeg",
"size": 482133
}
}),
});
if (!response.ok) throw new Error((await response.json()).error.code);
const { data } = await response.json(); import uuid
import requests
response = requests.post(
"https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/uploads",
headers={"Authorization": "Bearer beplan_pat_…", "Idempotency-Key": str(uuid.uuid4())},
json={
"file": {
"filename": "launch-teaser.jpg",
"mimeType": "image/jpeg",
"size": 482133,
},
},
)
response.raise_for_status()
data = response.json()["data"] Answers 201
{
"data": {
"mediaId": "0b6f5a52-7f4e-4c55-9d6f-2f0a6a1c3e11",
"versionId": null,
"plan": {
"mode": "single",
"url": "https://storage.beplan.io/org-media/…?X-Amz-Signature=…"
}
}
} 2. Send the bytes
The URLs in plan are signed for an hour and go straight to storage: send no Authorization header to them.
plan.mode: "single"(images): onePUTof the whole file toplan.url, withContent-Typeequal to the MIME type you declared.plan.mode: "multipart"(videos, GIFs): split the file into parts ofplan.partSizebytes (the last one shorter) andPUTpartntoplan.parts[n - 1].url, in any order, in parallel if you like.
curl -X PUT "SIGNED_URL_FROM_PLAN" \
-H "Content-Type: image/jpeg" \
--data-binary @launch-teaser.jpg A long multipart upload whose URLs expired can have parts signed again with POST …/media-library/items/{mediaId}/upload/parts (up to 100 at a time), which also keeps the upload from being cleaned up as abandoned.
3. Complete
POST …/media-library/items/{mediaId}/upload/complete with the ticket's versionId, from the same token that started it. Beplan checks every byte arrived (409 MEDIA_UPLOAD_INCOMPLETE otherwise: send the missing parts and call again), then queues processing. It answers 204; calling it again after success changes nothing.
curl -X POST "https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/items/0b6f5a52-7f4e-4c55-9d6f-2f0a6a1c3e11/upload/complete" \
-H "Authorization: Bearer beplan_pat_…" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"versionId": null
}' const response = await fetch("https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/items/0b6f5a52-7f4e-4c55-9d6f-2f0a6a1c3e11/upload/complete", {
method: "POST",
headers: {
Authorization: "Bearer beplan_pat_…",
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"versionId": null
}),
});
if (!response.ok) throw new Error((await response.json()).error.code); import uuid
import requests
response = requests.post(
"https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/items/0b6f5a52-7f4e-4c55-9d6f-2f0a6a1c3e11/upload/complete",
headers={"Authorization": "Bearer beplan_pat_…", "Idempotency-Key": str(uuid.uuid4())},
json={
"versionId": None,
},
)
response.raise_for_status() Answers 204 with no content.
The media stays hidden until completed. To give up, POST …/media-library/items/{mediaId}/upload/abort removes what the upload created. An upload left unfinished is cleaned up after a while.
4. Wait until it is ready
Videos are transcoded. Read GET …/media-library/items/{mediaId} until processing.state is ready (or failed). A post can't be scheduled with media still processing.
curl -X GET "https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/items/0b6f5a52-7f4e-4c55-9d6f-2f0a6a1c3e11" \
-H "Authorization: Bearer beplan_pat_…" const response = await fetch("https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/items/0b6f5a52-7f4e-4c55-9d6f-2f0a6a1c3e11", {
method: "GET",
headers: {
Authorization: "Bearer beplan_pat_…",
},
});
if (!response.ok) throw new Error((await response.json()).error.code);
const { data } = await response.json(); import requests
response = requests.get(
"https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/items/0b6f5a52-7f4e-4c55-9d6f-2f0a6a1c3e11",
headers={"Authorization": "Bearer beplan_pat_…"},
)
response.raise_for_status()
data = response.json()["data"] Answers 200
{
"data": {
"id": "0b6f5a52-7f4e-4c55-9d6f-2f0a6a1c3e11",
"folderId": null,
"filename": "launch-teaser.jpg",
"altText": "Our new studio at sunrise",
"mediaType": "image",
"mimeType": "image/jpeg",
"size": 482133,
"width": 1080,
"height": 1350,
"aspectRatio": 0.8,
"duration": null,
"waveform": null,
"createdAt": "2026-11-18T09:30:00.000Z",
"formats": [],
"usage": "unused",
"processing": {
"state": "ready",
"error": null
},
"previewUrl": "https://storage.beplan.io/org-media/…/preview?X-Amz-Signature=…",
"mediaUrl": "https://storage.beplan.io/org-media/…?X-Amz-Signature=…",
"playback": null,
"publishCopy": null,
"reviewStatus": null
}
} Through the API, playback is always null: video playback is for the Beplan app. Use mediaUrl or the download link to get a file, and fetch those again rather than storing them: they are signed for about an hour.
Review
With the Team Collaboration add-on, an upload goes to review instead of straight to the library when you set sendToReview, and always for members whose role requires their uploads to be reviewed.
Import from a URL
POST …/media-library/imports takes an address and fetches it in the background. It answers 202 at once with the mediaId:
curl -X POST "https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/imports" \
-H "Authorization: Bearer beplan_pat_…" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"url": "https://cdn.example.com/campaign/launch-teaser.jpg"
}' const response = await fetch("https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/imports", {
method: "POST",
headers: {
Authorization: "Bearer beplan_pat_…",
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"url": "https://cdn.example.com/campaign/launch-teaser.jpg"
}),
});
if (!response.ok) throw new Error((await response.json()).error.code);
const { data } = await response.json(); import uuid
import requests
response = requests.post(
"https://api.beplan.io/v1/organizations/ORGANIZATION_ID/workspaces/WORKSPACE_ID/media-library/imports",
headers={"Authorization": "Bearer beplan_pat_…", "Idempotency-Key": str(uuid.uuid4())},
json={
"url": "https://cdn.example.com/campaign/launch-teaser.jpg",
},
)
response.raise_for_status()
data = response.json()["data"] Answers 202
{
"data": {
"mediaId": "0b6f5a52-7f4e-4c55-9d6f-2f0a6a1c3e11",
"versionId": null,
"state": "importing"
}
} The address must be https on the default port, with no user or password in it, and not a local name (localhost, .local, .internal) or an IP address outside the public internet. Otherwise it is refused at once with 422 MEDIA_IMPORT_URL_INVALID and nothing is created. The host name is resolved when the file is fetched: if it points to an address outside the public internet, the import fails with import_unreachable. Up to three redirects are followed, each checked the same way. The file type comes from mimeType or the address's extension (an address without a known extension needs mimeType), and the file must really be of that type.
Then poll GET …/media-library/items/{mediaId} with that id, every few seconds at first, then less often. While processing.state is processing the media has no file and is not in lists yet. It ends ready, or failed with processing.error:
processing.error |
Why |
|---|---|
import_unreachable |
The server could not be reached, answered an error, or redirected too often or to an address that isn't allowed |
import_not_public |
The address itself is not a public https address |
import_too_large |
Over the size limit or the organization's storage left |
import_wrong_type |
The file is not of the declared type (an HTML page, say) |
import_timeout |
The server sent nothing for 30 seconds, or was too slow overall |
import_failed |
Something failed on Beplan's side: try again |
Short outages are retried before an import fails. A failed import stays in the library as a failed item; delete it with POST …/media-library/items/delete.
Good to know
413MEDIA_STORAGE_FULL: the organization's storage can't hold the file.POST …/media-library/uploadsandPOST …/media-library/items/{mediaId}/upload/partsreturn signed URLs, so their answers are never stored for idempotent replays: the sameIdempotency-Keyonly stops a second start while the first runs, and a repeat afterwards gets fresh URLs (idempotency).- Videos uploaded or imported are transcribed by Beplan, as in the app; the transcript is readable with
GET …/media-library/items/{mediaId}/transcript.