> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sia.vision/llms.txt
> Use this file to discover all available pages before exploring further.

# Prepare an attached reference image

> reference_image_upload_prepare: permissions and generated input/output contracts.

`reference_image_upload_prepare` · Gateway release **0.8.3**

Prepare one original host attachment without placing image bytes in chat. Inspect the host-provided local file with the reference-file helper, then pass its exact SHA-256, size, MIME and actual source declaration. Requires current Storyworld edit access. The short-lived upload-only ticket goes to the local helper as an Authorization header, never a URL. No generation. Reuse this exact operation ID and manifest after uncertainty; poll reference\_image\_upload\_get before retrying. A reconnect cannot revive an older pending upload.

Required scopes: `account:read`, `studio:write`. Changes saved state or requests work; review the operation’s effects.

Availability depends on runtime configuration and the permissions granted to this connection. Use live MCP discovery as the authority.

## Input

```json theme={null}
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "storyworldId": {
      "type": "string",
      "pattern": "^[a-fA-F0-9]{24}$",
      "description": "ID of an accessible saved Storyworld returned by discovery. Keep this destination fixed for the operation."
    },
    "operationId": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9-]{16,64}$",
      "description": "Persist a client-generated UUID before this mutation. Repeat identical inputs and this same ID after interruption; a new ID is a new request."
    },
    "purpose": {
      "type": "string",
      "enum": [
        "character",
        "location",
        "artifact"
      ]
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "rightsBasis": {
          "type": "string",
          "enum": [
            "creator_owned",
            "licensed",
            "consented",
            "public_domain",
            "other"
          ]
        },
        "rightsConfirmed": {
          "type": "boolean",
          "const": true,
          "description": "True only with a valid creator/rights declaration for the supplied source. Never invent consent."
        },
        "provider": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "modelId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "prompt": {
          "type": "string",
          "minLength": 1,
          "maxLength": 16000
        },
        "rightsStatement": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000
        }
      },
      "required": [
        "provider",
        "rightsStatement",
        "rightsBasis",
        "rightsConfirmed"
      ]
    },
    "mimeType": {
      "type": "string",
      "enum": [
        "image/png",
        "image/jpeg",
        "image/webp"
      ]
    },
    "byteLength": {
      "type": "integer",
      "minimum": 1,
      "maximum": 3145728
    },
    "sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    }
  },
  "required": [
    "storyworldId",
    "operationId",
    "purpose",
    "title",
    "source",
    "mimeType",
    "byteLength",
    "sha256"
  ]
}
```

## Declared output

This is the declared success schema. Error results and binary media blocks are separate MCP protocol results.

```json theme={null}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "1"
    },
    "intentId": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "manifestHash": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "storyworldId": {
      "type": "string",
      "pattern": "^[a-f0-9]{24}$"
    },
    "operationId": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "awaiting_bytes",
        "retryable",
        "dispatching",
        "needs_reconciliation",
        "completed"
      ]
    },
    "manifest": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    },
    "upload": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        },
        "method": {
          "type": "string",
          "const": "PUT"
        },
        "ticket": {
          "type": "string"
        },
        "expiresAt": {
          "type": "string"
        },
        "header": {
          "type": "string",
          "const": "Authorization"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "byteLength": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "mimeType": {
          "type": "string"
        }
      },
      "required": [
        "url",
        "method",
        "ticket",
        "expiresAt",
        "header",
        "sha256",
        "byteLength",
        "mimeType"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "schemaVersion",
    "intentId",
    "manifestHash",
    "storyworldId",
    "operationId",
    "status",
    "manifest"
  ],
  "additionalProperties": {}
}
```

[All tools](https://docs.sia.vision/mcp-reference.md) · [Permissions](https://docs.sia.vision/authentication.md) · [Media and recovery](https://docs.sia.vision/media-and-recovery.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.