home / skills / merit-systems / x402scan-skills / upload-and-share

upload-and-share skill

/skills/upload-and-share

This skill uploads a file to cloud storage via agentupload.dev, returns a public URL, and ensures a downloadable link is ready.

npx playbooks add skill merit-systems/x402scan-skills --skill upload-and-share

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.4 KB
---
name: upload-and-share
description: Upload files to the cloud and get shareable public URLs using agentupload.dev (x402 micropayments). Use when the user asks to upload a file, share a file via URL, host a file, make a file publicly accessible, or needs a download link for any file. Triggers on phrases like "upload this", "share this file", "get me a link", "host this file", "make this downloadable", or any request to put a local file on the internet.
---

# Upload and Share via agentupload.dev

Upload any local file to S3-backed cloud storage via x402 micropayments. Returns a permanent public URL. No API keys needed.

## Workflow

### 1. Check wallet balance

```mcp
x402.get_wallet_info()
```

Ensure sufficient USDC balance for the chosen tier. If balance is low, show the deposit link.

### 2. Determine the tier

Pick the smallest tier that fits the file. Check file size first with `ls -la` or `wc -c`.

| Tier | Max Size | Cost |
|------|----------|------|
| `10mb` | 10 MB | $0.10 |
| `100mb` | 100 MB | $1.00 |
| `1gb` | 1 GB | $10.00 |

### 3. Buy the upload slot

```mcp
x402.fetch(
  url: "https://agentupload.dev/api/x402/upload",
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: {"filename": "<name>", "contentType": "<mime>", "tier": "<tier>"}
)
```

**Content type guidance:** Use the correct MIME type for the file. Common types:
- `text/csv`, `application/json`, `text/plain` for data files
- `application/pdf` for PDFs
- `image/png`, `image/jpeg` for images
- `application/zip` for archives
- `application/octet-stream` as a fallback for unknown types

The response contains `uploadUrl` (temporary, 1hr TTL) and `publicUrl` (permanent for 6 months).

### 4. Upload the file via curl

Use Bash to PUT the file to the returned `uploadUrl`:

```bash
curl -s -X PUT "<uploadUrl>" -H "Content-Type: <mime>" --data-binary @/absolute/path/to/file
```

**Critical:** Use `--data-binary` (not `-d`) to preserve binary content. Use the absolute path.

### 5. Share the public URL

Present the `publicUrl` to the user. This URL is publicly accessible immediately and remains live for 6 months.

## Listing Previous Uploads

To list uploads for the current wallet:

```mcp
x402.fetch_with_auth(
  url: "https://agentupload.dev/api/x402/uploads",
  method: "GET"
)
```

This uses SIWX (Sign-In With X) authentication, not x402 payment.

## Key Details

- **No API keys required** - payment is the authentication
- **Upload URLs expire in 1 hour** - upload promptly after buying the slot
- **Public URLs last 6 months** from purchase date
- **Any file type accepted** - contentType is advisory for the browser, not a restriction
- **Discovery endpoint**: `x402.discover_api_endpoints(url: "https://agentupload.dev")` if you need to verify endpoints

## Common Patterns

**Upload a file the user just created:**
Skip discovery, go straight to wallet check + buy slot + upload.

**Upload multiple files:**
Buy separate slots for each file. Slots can be purchased in parallel but uploads must use the correct uploadUrl for each.

**User asks to "share" or "send" a file:**
Upload it and present the public URL. The URL can be shared anywhere.

## Error Handling

- **Insufficient balance**: Show the deposit link from `get_wallet_info`
- **File too large for tier**: Suggest the next tier up
- **Upload URL expired**: Buy a new slot (the previous payment is non-refundable)
- **curl fails**: Verify the file path exists and the uploadUrl is correctly quoted

Overview

This skill uploads local files to S3-backed cloud storage via agentupload.dev and returns a permanent public URL. It uses x402 micropayments (no API keys) to buy an upload slot, performs the file PUT to a temporary upload URL, and hands back a public download link valid for six months. It is optimized for quick, single-step sharing of files of any type.

How this skill works

The skill checks your x402 wallet balance, selects the smallest paid tier that fits the file size, and purchases an upload slot via the agentupload.dev API. The API returns a short-lived uploadUrl (1 hour) and a publicUrl (public for 6 months); the skill uploads the file to uploadUrl using a binary PUT and then returns the publicUrl for sharing. It can also list prior uploads for the current wallet using SIWX-authenticated endpoints.

When to use it

  • You want a quick public download link for a local file.
  • Share a file in chat, email, or documentation without hosting infrastructure.
  • Make a file immediately publicly accessible for up to six months.
  • Upload and share images, archives, PDFs, or data files without API keys.
  • Get a safe, paid upload slot when direct hosting isn’t available.

Best practices

  • Check the wallet balance first and show the deposit link if funds are low.
  • Determine the correct tier by file size: 10MB, 100MB, or 1GB to avoid wasted cost.
  • Use the correct MIME Content-Type; fallback to application/octet-stream for unknown types.
  • Upload promptly after buying a slot — uploadUrl expires in 1 hour.
  • When uploading binaries, use curl --data-binary and absolute file paths to avoid corruption.

Example use cases

  • User asks “upload this” for a generated report: buy slot, PUT the file, return publicUrl.
  • Share a large archive with a collaborator: pick 1gb or 100mb tier, upload, and provide a link.
  • Host an image for a forum post: choose 10mb tier, set image mime, upload, and paste publicUrl.
  • Provide a download link for a CSV export from a tool where you cannot host files.
  • Batch uploads: buy slots per file (can be parallel), upload each to its uploadUrl, then share links.

FAQ

How long does the public URL stay active?

Public URLs are permanent for six months from purchase date.

What if the uploadUrl expires before I upload?

Buy a new slot and retry; payments for expired slots are non-refundable.

Do I need an API key or account?

No API key is required; x402 micropayment is the authentication. Listing uploads uses SIWX authentication.