Outcome
Initialize an R2 multipart upload in the selected storage scope and return the scoped key, uploadId and suggested partSize.
Before you start
- Verify identity, pin environment and organization, and discover a granted Bytes workspace before choosing file keys.
- The action requires files:write. Select a verified workspace resource separately from action input; a body field cannot supply a workspace grant.
- Scope org uses the verified workspace shared root; private uses the caller’s private subtree. The accepted legacy all value resolves to org and does not grant cross-organization browsing. The bucket input cannot switch the configured R2 binding.
- Authorize the described effect or private-data export before passing CLI --confirm or MCP confirm:true. GET listing/search can persist derived data; HTTP method alone does not establish a read-only action.
Discover the target
topolo whoami --json
topolo actions get app_topolo_bytes.uploads.multipart.create --detail --json
topolo resources topolo-bytes --json
topolo workspaces list topolo-bytes --json
- File keys are paths returned by files.list/search in the selected workspace and scope. Discover the granted workspace id; do not derive access from fixture ids.
- Reuse both key and uploadId from multipart.create; preserve each uploaded partNumber and ETag for completion.
Request
POST /api/multipart/create
Save action input as payload.json. The reviewed plan separates path identifiers, query fields and the HTTP body. Set BYTES_WORKSPACE_ID from granted resource discovery.
Inspect and test this action in the signed action console. A test response still requires the verification below.
Input fields
| Field | Required | Type | Constraints |
|---|---|---|---|
key | Required | string | {"minLength":1} |
contentType | Optional | string | {} |
scope | Optional | string | {"enum":["org","private","all"]} |
Exact input schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"key": {
"type": "string",
"minLength": 1
},
"contentType": {
"type": "string"
},
"scope": {
"type": "string",
"enum": [
"org",
"private",
"all"
]
}
},
"required": [
"key"
],
"additionalProperties": false
}
Effects
- Starts a multipart session through the configured R2 integration. No completed file is established yet.
Interpret the response
The response identifier path is $.uploadId for upload. An empty list does not discover a target.
Preserve both key and uploadId exactly. Sign parts using those values; the initialization response is not proof that any part or completed object exists.
The schema describes supported success fields; optional metadata and integration-dependent values may vary. Errors have the exact shapes shown in refused examples.
Success schema:
{
"type": "object",
"required": [
"success",
"key",
"displayKey",
"uploadId",
"partSize"
],
"properties": {
"success": {
"type": "boolean"
},
"key": {
"type": "string"
},
"displayKey": {
"type": "string"
},
"uploadId": {
"type": "string"
},
"partSize": {
"type": "number"
}
}
}
Worked examples
Actual exported Worker handlers with local Miniflare R2/KV. Auth, workspace grants, R2 multipart, notification, usage and semantic integrations are simulated at their configured test boundaries. Synthetic ids, timestamps and signed URLs confer no live access. No deployed provider outcome, external delivery or live grant is established. Upload-session credential values are explicitly redacted; binary responses use the tested SDK transport envelope. Replace synthetic identifiers through credential-scoped discovery. Refused scenarios document failure boundaries; they are not successful workflows.
Successful request
Actual worker response with local Miniflare R2/KV and simulated Auth, workspace grants and outbound integration boundaries. No authorization header is captured.
Input · payload.json:
{
"key": "big.bin",
"contentType": "application/octet-stream"
}
CLI:
topolo actions validate app_topolo_bytes.uploads.multipart.create --data @payload.json --json
topolo actions plan app_topolo_bytes.uploads.multipart.create --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_bytes.uploads.multipart.create --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --confirm --json
MCP tool and arguments:
{
"tool": "topolo_call_action",
"arguments": {
"actionId": "app_topolo_bytes.uploads.multipart.create",
"input": {
"key": "big.bin",
"contentType": "application/octet-stream"
},
"resourceType": "workspace",
"resourceId": "<identifier returned by granted resource discovery>",
"confirm": true
}
}
Captured local response · HTTP 200:
{
"success": true,
"key": "organizations/org_acme/workspaces/workspace_acme/big.bin",
"displayKey": "big.bin",
"uploadId": "upload-id-xyz",
"partSize": 16777216
}
HTTP 200. Preserve both key and uploadId exactly. Sign parts using those values; the initialization response is not proof that any part or completed object exists.
Refused request · HTTP 403
Actual worker response with local Miniflare R2/KV and simulated Auth, workspace grants and outbound integration boundaries. No authorization header is captured.
Input · payload.json:
{
"key": "big.bin"
}
CLI:
topolo actions validate app_topolo_bytes.uploads.multipart.create --data @payload.json --json
topolo actions plan app_topolo_bytes.uploads.multipart.create --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
Captured local response · HTTP 403:
{
"error": "Forbidden",
"message": "Insufficient permissions",
"required": [
"files:write",
"folders:write",
"sharing:write"
],
"available": [
"files:read"
]
}
HTTP 403. This request was refused; preserve the exact response and correct its cause before retrying.
Refused request · HTTP 400
Actual worker response with local Miniflare R2/KV and simulated Auth, workspace grants and outbound integration boundaries. No authorization header is captured.
Input · payload.json:
{}
CLI:
topolo actions validate app_topolo_bytes.uploads.multipart.create --data @payload.json --json
topolo actions plan app_topolo_bytes.uploads.multipart.create --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
Captured local response · HTTP 400:
{
"success": false,
"error": {
"code": "invalid_action_input",
"message": "Invalid action input for \"uploads.multipart.create\".",
"action": "uploads.multipart.create",
"issues": [
{
"path": "key",
"message": "Invalid input: expected string, received undefined",
"code": "invalid_type"
}
]
}
}
HTTP 400. This request was refused; preserve the exact response and correct its cause before retrying.
Refused request · HTTP 500
Actual worker response with local Miniflare R2/KV and simulated Auth, workspace grants and outbound integration boundaries. No authorization header is captured.
Input · payload.json:
{
"key": "big.bin"
}
CLI:
topolo actions validate app_topolo_bytes.uploads.multipart.create --data @payload.json --json
topolo actions plan app_topolo_bytes.uploads.multipart.create --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
Captured local response · HTTP 500:
{
"error": "R2 S3 credentials missing — set R2_S3_ACCESS_KEY_ID, R2_S3_SECRET_ACCESS_KEY, and R2_ACCOUNT_ID as wrangler secrets"
}
HTTP 500. This request was refused; preserve the exact response and correct its cause before retrying.
Verify the result
- Preserve both key and uploadId exactly. Sign parts using those values; the initialization response is not proof that any part or completed object exists.
Errors and recovery
Forbidden(HTTP 403): Verify the pinned organization, granted workspace resource and required application permission. Inspect the exact refusal before requesting narrower access; never switch scope to bypass the denial.invalid_action_input(HTTP 400): Correct the exact fields using the discovered input schema and prerequisites. Refused input examples demonstrate errors and must not be executed as successful workflows.R2 S3 credentials missing — set R2_S3_ACCESS_KEY_ID, R2_S3_SECRET_ACCESS_KEY, and R2_ACCOUNT_ID as wrangler secrets(HTTP 500): Inspect the named provider or service configuration through an authorized operational action. Preserve the failure and request id; a local mocked provider response proves no live outcome.
Authentication, the action-input validator or resource middleware can refuse a request before this handler. Preserve the exact request id, error and selected credential context. The fixtures establish no live credentials or configured provider.
Recovery boundary
Abort the active session with uploads.multipart.abort before abandoning it.
Related actions
- Sign multipart parts: Create presigned PUT URLs for selected part numbers in an existing multipart session; accepted part numbers are integers from 1 to 10000.
- Abort multipart upload: Ask R2 to abandon an existing multipart upload using its scoped key and uploadId; completed objects are separate from unfinished parts.
Evidence
Actual exported Worker handlers with local Miniflare R2/KV. Auth, workspace grants, R2 multipart, notification, usage and semantic integrations are simulated at their configured test boundaries. Synthetic ids, timestamps and signed URLs confer no live access. No deployed provider outcome, external delivery or live grant is established. Upload-session credential values are explicitly redacted; binary responses use the tested SDK transport envelope. Capture digests and test scenarios are retained in the source fixture records.