← Receivers

media:upload

media family

chatmcp

Put ONE raster image into a workspace's media library and get back the key and the url that serves it. Name exactly one source: `base64` (bytes you hold) or `url` (a public https address the server fetches under an SSRF guard, no redirects, 5 MiB hard cap). The stored content type comes from the MAGIC BYTES, never from what you declare — SVG is refused deliberately, and video is not accepted here.

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
member
The class of authority the caller must already hold, decided from the attested context with no round trip.
Cost
free
What one call costs, so you can budget before acting.
Reversible
no
This cannot be undone. Dry-run it first where the contract allows.
Idempotent
no
Not safe to blind-retry — dedupe on the envelope idempotencyKey.

Send it with your agent

One click hands your coding agent a prompt that registers the substrate, reads this contract, and makes the call. Launch opens the app; the others copy the prompt.

Claude Code
Codex
Cursor
Gemini CLI
Claude Desktop
ChatGPT
curl -X POST https://one.ie/api/ask/media:upload \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "workspace": "one", "url": "https://example.com/logo.png", "filename": "logo" }}'

The key is never in a link. npx -y @oneie/cli login writes it to ~/.config/oneie/key on your machine.

Request

Validated before dispatch — an invalid payload is refused with the fix, never half-applied.

  • workspace string optional Group slug. Omit for your own. Honoured only if you may read it.
  • url string optional Public https address to fetch. Alternative to `base64`, never both. Private, loopback, link-local and CGNAT addresses are refused, as is any redirect.
  • base64 string optional The image bytes, base64. A `data:` prefix is accepted and stripped. Alternative to `url`, never both.
  • filename string optional A LABEL for the key, not a path — separators are stripped and the extension always comes from the sniffed bytes, so `../` and a `.svg` suffix are both inert. Omit and the key is a bare uuid.
  • contentType string optional A HINT only. The stored value is decided by the magic bytes, because the public reader serves the stored value verbatim under nosniff.

Response

What comes back from the call.

  • ok boolean
  • workspace string
  • key string `{workspace}/media/…` — the handle media:list returns.
  • url string `/api/product-image/{workspace}/{path}` — THE reader.
  • kind "image" Always image. Video is a 5 MiB-cap and multipart-shape decision this door does not make; PUT /api/media/video-upload is the door that does.
  • contentType string Sniffed, not declared.
  • size number Bytes actually stored.
  • error string Named: forbidden · too_large · unsupported_type · blocked_url · fetch_failed · storage_error. A refusal is never a downgrade to your own workspace.

Traffic

Every call to media:upload, counted where it is dispatched — over HTTP or in-process alike. Aggregate only — no actor, no payload, no workspace.

Counting…

Wiring

Every place in the open source that names media:upload, and the file that answers it. Read from the tree at build time — a receiver is reached by NAME through one door, so there is no import edge to follow and a grep is the honest shape of the question. Structure, not volume — the count is in Traffic above.

Called from

API route 1
  • one.ie/web/src/lib/resolvers/media.ts:411
CLI 1
  • packages/cli/src/media.ts:261
SDK 2
  • packages/sdk/src/client.ts:933
  • packages/sdk/src/media.ts:11

Answered by

media:upload one.ie/web/src/lib/resolvers/media.ts:268 Dispatched through POST /api/ask/media:upload, after the envelope validates the payload.

media family · 2 more

JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspace": {
      "description": "Group slug. Omit for your own. Honoured only if you may read it.",
      "type": "string"
    },
    "url": {
      "description": "Public https address to fetch. Alternative to `base64`, never both. Private, loopback, link-local and CGNAT addresses are refused, as is any redirect.",
      "type": "string"
    },
    "base64": {
      "description": "The image bytes, base64. A `data:` prefix is accepted and stripped. Alternative to `url`, never both.",
      "type": "string"
    },
    "filename": {
      "description": "A LABEL for the key, not a path — separators are stripped and the extension always comes from the sniffed bytes, so `../` and a `.svg` suffix are both inert. Omit and the key is a bare uuid.",
      "type": "string"
    },
    "contentType": {
      "description": "A HINT only. The stored value is decided by the magic bytes, because the public reader serves the stored value verbatim under nosniff.",
      "type": "string"
    }
  }
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "workspace": {
      "type": "string"
    },
    "key": {
      "description": "`{workspace}/media/…` — the handle media:list returns.",
      "type": "string"
    },
    "url": {
      "description": "`/api/product-image/{workspace}/{path}` — THE reader.",
      "type": "string"
    },
    "kind": {
      "description": "Always image. Video is a 5 MiB-cap and multipart-shape decision this door does not make; PUT /api/media/video-upload is the door that does.",
      "type": "string",
      "const": "image"
    },
    "contentType": {
      "description": "Sniffed, not declared.",
      "type": "string"
    },
    "size": {
      "description": "Bytes actually stored.",
      "type": "number"
    },
    "error": {
      "description": "Named: forbidden · too_large · unsupported_type · blocked_url · fetch_failed · storage_error. A refusal is never a downgrade to your own workspace.",
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}