Topolo Docs Topolo Platform
Open workspace

Create sharing link

Create a view or download link for selected accessible file keys. View links require a configured session-signing secret; creation does not send the link to recipients.

Outcome

Create a view or download link for selected accessible file keys. View links require a configured session-signing secret; creation does not send the link to recipients.

Before you start

  • Verify identity, pin environment and organization, and discover a granted Bytes workspace before choosing file keys.
  • The action requires sharing: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.shares.create --detail --json
topolo resources topolo-bytes --json
topolo workspaces list topolo-bytes --json
topolo actions get app_topolo_bytes.shares.list --detail --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.

Request

POST /api/shares/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

FieldRequiredTypeConstraints
fileKeysRequiredarray{"minItems":1}
permissionsRequiredstring{"enum":["view","download"]}
shareTypeRequiredstring{"enum":["single","multiple","zip"]}
passwordOptionalstring{}
expirationDaysOptionalnumber{}
scopeOptionalstring{"enum":["org","private","all"]}

Exact input schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "fileKeys": {
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "permissions": {
      "type": "string",
      "enum": [
        "view",
        "download"
      ]
    },
    "shareType": {
      "type": "string",
      "enum": [
        "single",
        "multiple",
        "zip"
      ]
    },
    "password": {
      "type": "string"
    },
    "expirationDays": {
      "type": "number"
    },
    "scope": {
      "type": "string",
      "enum": [
        "org",
        "private",
        "all"
      ]
    }
  },
  "required": [
    "fileKeys",
    "permissions",
    "shareType"
  ],
  "additionalProperties": false
}

Effects

  • Writes a sharing record and schedules Notify and usage-meter integrations. The link exposes only the access described by its terms.

Interpret the response

The response identifier path is $.shareLink.id for share. An empty list does not discover a target.

Read shares.list and inspect id, permissions, fileKeys and expiresAt. A created record is not proof of notification delivery.

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",
    "shareLink"
  ],
  "properties": {
    "success": {
      "type": "boolean"
    },
    "shareLink": {
      "type": "object",
      "required": [
        "id",
        "url",
        "permissions",
        "views",
        "downloads",
        "createdAt",
        "fileKeys",
        "shareType",
        "createdBy",
        "organizationId",
        "workspaceId"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "permissions": {
          "type": "string"
        },
        "views": {
          "type": "number"
        },
        "downloads": {
          "type": "number"
        },
        "createdAt": {
          "type": "string"
        },
        "fileKeys": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "shareType": {
          "type": "string"
        },
        "createdBy": {
          "type": "string"
        },
        "organizationId": {
          "type": "string"
        },
        "workspaceId": {
          "type": "string"
        }
      }
    }
  }
}

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:

{
  "fileKeys": [
    "v.png"
  ],
  "permissions": "view",
  "shareType": "single"
}

CLI:

topolo actions validate app_topolo_bytes.shares.create --data @payload.json --json
topolo actions plan app_topolo_bytes.shares.create --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_bytes.shares.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.shares.create",
    "input": {
      "fileKeys": [
        "v.png"
      ],
      "permissions": "view",
      "shareType": "single"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by granted resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 200:

{
  "success": true,
  "shareLink": {
    "id": "e7895fe5ef2a4455aefa7fbd31842879",
    "url": "https://bytes-api.test.local/share/single/e7895fe5ef2a4455aefa7fbd31842879",
    "permissions": "view",
    "views": 0,
    "downloads": 0,
    "createdAt": "2026-10-04T01:57:55.876Z",
    "fileKeys": [
      "v.png"
    ],
    "shareType": "single",
    "createdBy": "user_alice",
    "organizationId": "org_acme",
    "workspaceId": "workspace_acme"
  }
}

HTTP 200. Read shares.list and inspect id, permissions, fileKeys and expiresAt. A created record is not proof of notification delivery.

Another supported 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:

{
  "fileKeys": [
    "agent.png"
  ],
  "permissions": "view",
  "shareType": "single"
}

CLI:

topolo actions validate app_topolo_bytes.shares.create --data @payload.json --json
topolo actions plan app_topolo_bytes.shares.create --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_bytes.shares.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.shares.create",
    "input": {
      "fileKeys": [
        "agent.png"
      ],
      "permissions": "view",
      "shareType": "single"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by granted resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 200:

{
  "success": true,
  "shareLink": {
    "id": "3ff3aa1a775d488286a23602383e5e67",
    "url": "https://bytes-api.test.local/share/single/3ff3aa1a775d488286a23602383e5e67",
    "permissions": "view",
    "views": 0,
    "downloads": 0,
    "createdAt": "2026-10-04T01:57:55.395Z",
    "fileKeys": [
      "agent.png"
    ],
    "shareType": "single",
    "createdBy": "user_alice",
    "organizationId": "org_acme",
    "workspaceId": "workspace_acme"
  }
}

HTTP 200. Read shares.list and inspect id, permissions, fileKeys and expiresAt. A created record is not proof of notification delivery.

Another supported 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:

{
  "fileKeys": [
    "forge.png"
  ],
  "permissions": "view",
  "shareType": "single"
}

CLI:

topolo actions validate app_topolo_bytes.shares.create --data @payload.json --json
topolo actions plan app_topolo_bytes.shares.create --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_bytes.shares.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.shares.create",
    "input": {
      "fileKeys": [
        "forge.png"
      ],
      "permissions": "view",
      "shareType": "single"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by granted resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 200:

{
  "success": true,
  "shareLink": {
    "id": "1bb46c7f2b2a4ecfa5cf0d297453b99a",
    "url": "https://bytes-api.test.local/share/single/1bb46c7f2b2a4ecfa5cf0d297453b99a",
    "permissions": "view",
    "views": 0,
    "downloads": 0,
    "createdAt": "2026-10-04T01:57:55.403Z",
    "fileKeys": [
      "forge.png"
    ],
    "shareType": "single",
    "createdBy": "user_alice",
    "organizationId": "org_acme",
    "workspaceId": "workspace_acme"
  }
}

HTTP 200. Read shares.list and inspect id, permissions, fileKeys and expiresAt. A created record is not proof of notification delivery.

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:

{
  "fileKeys": [],
  "permissions": "download",
  "shareType": "single"
}

CLI:

topolo actions validate app_topolo_bytes.shares.create --data @payload.json --json
topolo actions plan app_topolo_bytes.shares.create --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json

Captured local response · HTTP 400:

{
  "success": false,
  "error": "No files provided"
}

HTTP 400. 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:

{
  "fileKeys": [
    "shared.pdf"
  ],
  "permissions": "full",
  "shareType": "single"
}

CLI:

topolo actions validate app_topolo_bytes.shares.create --data @payload.json --json
topolo actions plan app_topolo_bytes.shares.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 \"shares.create\".",
    "action": "shares.create",
    "issues": [
      {
        "path": "permissions",
        "message": "Invalid option: expected one of \"view\"|\"download\"",
        "code": "invalid_value"
      }
    ]
  }
}

HTTP 400. This request was refused; preserve the exact response and correct its cause before retrying.

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:

{
  "fileKeys": [
    "x.png"
  ],
  "permissions": "download",
  "shareType": "single",
  "scope": "private"
}

CLI:

topolo actions validate app_topolo_bytes.shares.create --data @payload.json --json
topolo actions plan app_topolo_bytes.shares.create --resource-type workspace --resource-id "$BYTES_WORKSPACE_ID" --data @payload.json --json

Captured local response · HTTP 403:

{
  "error": "Forbidden",
  "message": "You do not have permission to share one or more of these files"
}

HTTP 403. This request was refused; preserve the exact response and correct its cause before retrying.

Verify the result

  • Read shares.list and inspect id, permissions, fileKeys and expiresAt. A created record is not proof of notification delivery.

Errors and recovery

  • No files provided (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.
  • 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.
  • 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.

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

Revoke the newly created link with shares.delete. Downloads made before revocation cannot be recalled.

  • List sharing links: Read a page of sharing records visible in the selected workspace. Only accessible stored records appear; the response redacts stored passwords.
  • Revoke sharing link: Remove one sharing record that the caller may mutate. A missing record is refused; previously downloaded bytes remain outside this operation.

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.