Media uploads
Pre-signed uploads for post images and changelog media.
Set up the SDK client used in the examples
API key or Dashboard session:
import { UpVoiced } from '@upvoiced/sdk';
const apiKey = process.env['UPVOICED_API_KEY']; // uv_live_… (Settings → API keys)
const workspace = process.env['UPVOICED_WORKSPACE_ID']; // sent as X-Workspace
if (!apiKey || !workspace) throw new Error('Set UPVOICED_API_KEY and UPVOICED_WORKSPACE_ID.');
const upvoiced = new UpVoiced({ apiKey, workspace });curl examples read $UPVOICED_API_KEY and $UPVOICED_WORKSPACE_IDfrom your shell. MCP examples are the tools/call request an MCP client sends to the MCP server with the same API key.
POST/v1/media/presign
Presign a bounded R2 upload (logo → branding bucket, image → media bucket)
| Name | Type | Required |
|---|---|---|
x-workspace | string (uuid) | Yes |
idempotency-key | stringpattern ^[A-Za-z0-9_.:-]{8,128}$ | No |
Response 201: 8 fields
| Name | Type | Required |
|---|---|---|
id | string (uuid) | Yes |
method | "PUT" | Yes |
upload_url | string (uri) | Yes |
expires_at | string (date-time) | Yes |
headers | object | Yes |
headers.content-type | "image/png" | "image/jpeg" | "image/webp" | Yes |
headers.content-length | stringpattern ^[1-9][0-9]*$ | Yes |
headers.if-none-match | "*" | Yes |
Errors: 400, 401, 403, 404, 409, 413, 422, 429, 500, 503, all in the standard error shape.
curl -X POST 'https://api.upvoiced.com/v1/media/presign' \
-H "Authorization: Bearer $UPVOICED_API_KEY" \
-H "X-Workspace: $UPVOICED_WORKSPACE_ID" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"kind": "logo",
"mime": "image/png",
"bytes": 1
}'const data = await upvoiced.post('/v1/media/presign', { body: { kind: 'logo', mime: 'image/png', bytes: 1 } });No MCP tool for this operation. The MCP server covers the everyday reads and writes.
POST/v1/media/{id}/complete
Verify the uploaded size, type and magic bytes, then mark ready
| Name | Type | Required |
|---|---|---|
id | string (uuid) | Yes |
| Name | Type | Required |
|---|---|---|
x-workspace | string (uuid) | Yes |
idempotency-key | stringpattern ^[A-Za-z0-9_.:-]{8,128}$ | No |
Response 200: 2 fields
| Name | Type | Required |
|---|---|---|
id | string (uuid) | Yes |
status | "ready" | Yes |
Errors: 400, 401, 403, 404, 409, 413, 422, 429, 500, 503, all in the standard error shape.
curl -X POST 'https://api.upvoiced.com/v1/media/0190f5e2-4c1d-7a3b-8c2d-5e6f7a8b9c0d/complete' \
-H "Authorization: Bearer $UPVOICED_API_KEY" \
-H "X-Workspace: $UPVOICED_WORKSPACE_ID" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'const data = await upvoiced.post('/v1/media/{id}/complete', {
path: { id: '0190f5e2-4c1d-7a3b-8c2d-5e6f7a8b9c0d' },
body: {},
});No MCP tool for this operation. The MCP server covers the everyday reads and writes.