# Prepare a Deal Application answer file upload

`deal_applications.prepare_answer_file_upload`

Prepare a five-minute upload to a file question in a Deal Application; preparation attaches nothing. Read contract/answers first. POST multipart field file to the returned URL with transfer_token as Bearer credential; no separate API key. Read the HTTP receipt, then list files to verify. Retry the same bytes at the returned URL while its credential is valid. After completion, do not prepare the upload again with the old answers revision. Use a new idempotency_key for a new upload. Keep tokens/bytes private. Limit: 25 MiB per file; room limits and current permissions apply.

[Deal applications guide](https://docs.levr.ai/mcp/resources/deal_applications.md)

Availability depends on live discovery and your access to the record. Do not infer MCP calls from REST paths.

Operation: write. Required OAuth scopes: mcp.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "application_id": {
      "description": "Deal Application id returned by deals.get or deals.create. Prefix: dapp_.",
      "maxLength": 255,
      "minLength": 1,
      "type": "string"
    },
    "block_key": {
      "description": "Copy block_key from the owning application’s get_contract question blocks; projects use get_matchmaking_application_contract.",
      "maxLength": 255,
      "minLength": 1,
      "type": "string"
    },
    "content_sha256": {
      "description": "SHA-256 of the exact file bytes to POST; not a document config digest.",
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
    },
    "expected_answers_revision": {
      "minimum": 0,
      "type": "integer"
    },
    "filename": {
      "maxLength": 255,
      "minLength": 1,
      "type": "string"
    },
    "idempotency_key": {
      "format": "uuid",
      "type": "string"
    },
    "item_id": {
      "anyOf": [
        {
          "description": "Stable public identifier for the referenced resource.",
          "maxLength": 255,
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Copy item_id from the owning application’s repeatable-item list; omit/null for a non-repeatable file question."
    },
    "provider_slug": {
      "description": "Portal workspace where the Deal Application is available. Copy provider_slug from providers.list; named slugs are valid.",
      "maxLength": 255,
      "minLength": 1,
      "type": "string"
    },
    "size_bytes": {
      "maximum": 26214400,
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "provider_slug",
    "application_id",
    "block_key",
    "expected_answers_revision",
    "idempotency_key",
    "filename",
    "content_sha256",
    "size_bytes"
  ],
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "oneOf": [
    {
      "not": {
        "required": [
          "error"
        ]
      },
      "properties": {
        "ok": {
          "const": true
        }
      },
      "required": [
        "data"
      ]
    },
    {
      "not": {
        "required": [
          "data"
        ]
      },
      "properties": {
        "ok": {
          "const": false
        }
      },
      "required": [
        "error"
      ]
    }
  ],
  "properties": {
    "data": {
      "additionalProperties": false,
      "properties": {
        "expires_in_seconds": {
          "type": "integer"
        },
        "instructions": {
          "type": "string"
        },
        "method": {
          "const": "POST",
          "type": "string"
        },
        "transfer_token": {
          "type": "string"
        },
        "url": {
          "format": "uri",
          "type": "string"
        }
      },
      "required": [
        "url",
        "method",
        "transfer_token",
        "expires_in_seconds",
        "instructions"
      ],
      "type": "object"
    },
    "error": {
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "details": {
          "additionalProperties": true,
          "description": "Optional bounded, agent-safe correction or recovery facts.",
          "type": "object"
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        }
      },
      "required": [
        "code",
        "message",
        "retryable"
      ],
      "type": "object"
    },
    "meta": {
      "additionalProperties": false,
      "properties": {
        "request_id": {
          "type": "string"
        }
      },
      "required": [
        "request_id"
      ],
      "type": "object"
    },
    "ok": {
      "description": "Whether the tool completed successfully.",
      "type": "boolean"
    }
  },
  "required": [
    "ok",
    "meta"
  ],
  "type": "object"
}
```

Check the result, then read the affected record to confirm your change.
