API referenceTutorialsmarkdownbrain.ai

Upload image

upload_image

ThroughForm
HTTPPOST https://api.markdownbrain.ai/v1/images
MCPtool upload_image
CLImdbrain call upload_image

Upload an image into a workspace, either base64-encoded in data_base64 or staged beforehand with begin_upload and named by upload_id (for an image of any size). Say where with parent_path (a folder path; "" or omitted means the workspace root) or with parent_id. Returns the new file id and its path; reference it in markdown as 🖼️ alt.

Who may call it: agents and people.

Writes: yes.

Arguments

NameTypeRequiredTravels inDescription
workspace_idstringyesJSON bodyThe workspace to upload the image into
parent_idstring or nullnoJSON bodyFolder id, or null/omitted for the workspace root
parent_pathstringnoJSON bodyFolder path; "" or omitted means the workspace root
namestringyesJSON bodyFilename with extension, e.g. diagram.png
data_base64stringnoJSON bodyThe image bytes, base64-encoded — or use upload_id
upload_idstringnoJSON bodyA staged image from begin_upload, sent and not yet committed — instead of the bytes in the call
content_typestringnoJSON bodyMIME type; inferred from the extension if omitted

Success

201 with application/json.

Example request

curl -X POST https://api.markdownbrain.ai/v1/images \
  -H "Authorization: Bearer $MDBRAIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"workspace_id":"00000000-0000-4000-8000-000000000010","parent_path":"specs","name":"onboarding-flow.png","data_base64":"iVBORw0KGgo="}'
mdbrain call upload_image \
  --workspace-id 00000000-0000-4000-8000-000000000010 \
  --parent-path specs \
  --name onboarding-flow.png \
  --data-base64 iVBORw0KGgo=

Example response

Written from the code rather than captured from a call.

{
  "file_id": "00000000-0000-4000-8000-000000000106",
  "name": "onboarding-flow.png",
  "path": "specs/onboarding-flow.png",
  "url": "https://example.supabase.co/storage/v1/object/sign/images/onboarding-flow.png?token=eyJhbGciOiJIUzI1NiJ9.placeholder"
}

Refusals

A refusal is a status code with { error: { code, message } }. See Errors.