Upload a small base64-encoded image, video, or document with POST /api/v1/media/inline. Requires an API key with the read scope or a signed-in workspace member.
Request
JSON upload for small files (maximum 8 MiB after base64 decoding). Uses the same workspace storage and returns the shared MediaIntake result.
The decoded file must be 1 byte to 8 MiB, otherwise upload-too-large; send larger files with POST /api/v1/media. The bytes must start with the signature of the declared mimeType, otherwise bad-request.
| Parameter | In | Type | Required |
|---|---|---|---|
workspaceId |
query | UUID | Yes |
| Body field | Type | Required |
|---|---|---|
data |
string | Yes |
mimeType |
one of 8 strings | Yes |
filename |
string | No |
Response
- HTTP 201:
MediaIntakewithmediaId,status,asset,issue,upload,idempotencyKey,retryAfterSeconds.status:awaiting_upload,processing,ready,failed
The OpenAPI document has each field’s type.
Examples
The TypeScript SDK has no method for this operation yet; send it over HTTP as the cURL tab shows.
result = workspace.media.upload_inline(
data="iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==",
mime_type="image/png",
filename="pixel.png",
)curl -X POST "https://pubnio.com/api/v1/media/inline?workspaceId=$WORKSPACE_ID" \
-H "Authorization: Bearer $PUBNIO_API_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H "Content-Type: application/json" \
-d '{"data":"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==","mimeType":"image/png","filename":"pixel.png"}'No pnio command calls this operation.
async () => {
// One key per intent; reuse it only to retry this same request.
const idempotencyKey = crypto.randomUUID();
const response = await codemode.request({
method: "POST",
path: "/api/v1/media/inline",
query: { workspaceId: codemode.workspaceId },
headers: { "Idempotency-Key": idempotencyKey },
body: {
data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==",
mimeType: "image/png",
filename: "pixel.png",
},
});
return response.data;
};Errors
idempotency-conflict: HTTP 409, Idempotency key already usedmedia-upload-conflict: HTTP 409, Media upload conflictupload-too-large: HTTP 413, Content Too Large
It also declares the problems most operations declare.
Idempotency
Optional. A retry with the same Idempotency-Key returns the first result for 24 hours. Make one key per intent, such as crypto.randomUUID() or Python’s uuid4(), and reuse it only to retry the same request. See Idempotency.
Limits
- Field lengths and ranges are in the OpenAPI document.