# Floppy API for developers and partners

The Floppy API lets your product turn files into share links, give each recipient their own link, and see who read them, page by page. It is a REST API with JSON in and out, on every Floppy plan, and free to start. Webhooks tell your server the moment someone opens a link.

- Base URL: `https://fpy.sh`, with endpoints under `/api/v1`
- OpenAPI 3.1 schema: https://fpy.sh/openapi.json
- API keys: https://fpy.sh/app/keys, or Settings › API in Floppy for Mac
- Rate limit: 120 requests a minute per key
- This guide as Markdown: https://fpy.sh/docs/api.md

## How do I get an API key?

Make a key at https://fpy.sh/app/keys, or in Floppy for Mac under Settings › API. Floppy shows the secret once, so copy it then. Send it on every request:

```bash
curl -H "Authorization: Bearer fpy_live_…" https://fpy.sh/api/v1/me
```

Each key has an access level and a scope:

| Setting | Options | What it means |
|---|---|---|
| Access | `read`, `write`, `read_write` | `GET` needs `read`; every other method needs `write` |
| Scope | `account`, `own` | `account` reaches the whole account. `own` reaches only the links that key made, and the webhooks it made |

Make one key per integration, so you can revoke one without touching the others. A key can never make or list other keys: only a signed-in person can, on the web or in Floppy for Mac.

## How do I make a share link from a file?

Upload the file with one request. The answer has the link to send:

```bash
curl -T proposal.pdf -H "Authorization: Bearer $FLOPPY_KEY" \
  "https://fpy.sh/api/drop/proposal.pdf?expiry=2W&label=Acme%20–%20Dana"
```

```json
{
  "share_url": "https://fpy.sh/k3x9",
  "link": { "id": "5c1e9a7b3d2f4e6a8b0c1d2e", "url": "https://fpy.sh/k3x9", "scan": "scanning" },
  "scan": "scanning",
  "next": "Share https://fpy.sh/k3x9 with Acme – Dana only. It opens once the malware check passes (a few seconds)."
}
```

- One request carries up to 100 MB. `expiry` is `1D`, `2D`, `3D`, `5D`, `1W`, `2W`, `1M`, `3M` or `NEVER`, within your plan. `label` makes a separate link for one recipient. `team` puts the link in a team.
- A file already online: `POST /api/v1/links/from-url` with `{ "url": "https://…/report.pdf" }`, up to 50 MB.
- A bigger file, or several files in one link: `POST /api/v1/links` with `{ "files": [{ "name", "size" }] }`, `PUT` each part to `/api/v1/files/<fileId>/parts/<n>`, then `POST /api/v1/files/<fileId>/complete` with the etags.
- Every file goes through Floppy's safety check before it opens. The `file.ready` webhook says when it's done.

Change a link afterwards with `PATCH /api/v1/links/<id>`: `expiry`, `password`, `downloads_allowed`, `note`, `name` or `slug`.

## How do I give each recipient their own link?

Make a share for each person. Each share has its own URL and its own analytics, so you see what Dana read apart from what Sam read:

```bash
curl -X POST -H "Authorization: Bearer $FLOPPY_KEY" -H "content-type: application/json" \
  -d '{"label":"Acme – Dana"}' https://fpy.sh/api/v1/links/<id>/shares
```

Turn one person's link off with `PATCH /api/v1/shares/<id>` and `{ "active": false }`. The other links keep working.

## How do I see who opened a link?

| Endpoint | What it gives |
|---|---|
| `GET /api/v1/links/<id>/analytics` | Each viewer, the pages they read and for how long |
| `GET /api/v1/shares/<id>/timeline` | One recipient's visits, page by page |
| `GET /api/v1/activity/events?cursor=<cursor>` | Every open, return, read to the end and download across your links, oldest first from the cursor |

Floppy never counts your own visits, bots, email scanners or link previews. To be told instead of asking, use a webhook.

## Webhooks: how do I get told when someone opens a link?

Give Floppy an https URL. It POSTs each event there, signed, within about a minute:

```bash
curl -X POST -H "Authorization: Bearer $FLOPPY_KEY" -H "content-type: application/json" \
  -d '{"url":"https://example.com/floppy-webhook","events":["link.opened","link.completed","file.ready"]}' \
  https://fpy.sh/api/v1/webhooks
```

The answer has the webhook and its signing secret, `whsec_…`. Floppy shows the secret once. Leave `events` out to get all of them:

| Event | When |
|---|---|
| `link.opened` | Someone opened a link and read it |
| `link.returned` | They came back to it |
| `link.completed` | They read every page |
| `link.downloaded` | They downloaded the file |
| `file.ready` | A file passed the safety check and opens |
| `file.blocked` | A file failed the safety check and won't open |

Each delivery looks like this. For `link.*` events, `data` is the same event `GET /api/v1/activity/events` returns:

```json
{
  "id": "del_3f9c2a7e1b4d6c8e0a2b4c6d",
  "type": "link.opened",
  "created_at": "2026-11-20T09:14:02.000Z",
  "data": {
    "link_id": "5c1e9a7b3d2f4e6a8b0c1d2e",
    "link_name": "proposal.pdf",
    "who": "Acme – Dana",
    "city": "Berlin",
    "country": "DE",
    "device": "Mac",
    "browser": "Safari",
    "pages_read": 3,
    "pages_total": 12,
    "active_ms": 94000
  }
}
```

Headers on every delivery:

- `Floppy-Event`: the event type
- `Floppy-Delivery`: the delivery id, the same on every retry, so you can skip duplicates
- `Floppy-Signature`: `t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>" with your secret>`

### How do I check a webhook's signature?

Compute the HMAC over the raw body and compare it. Reject old timestamps so a captured delivery can't be replayed:

```js
import { createHmac, timingSafeEqual } from "node:crypto";

export function verifyFloppy(rawBody, header, secret) {
  const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
  const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return v1.length === expected.length && timingSafeEqual(Buffer.from(v1), Buffer.from(expected));
}
```

### What if my server is down?

Answer any 2xx within 10 seconds and the delivery is done. Anything else is retried after 1, 5 and 15 minutes, then 1, 3, 6 and 12 hours. After 50 failed deliveries in a row, the webhook switches itself off. Turn it back on with `PATCH /api/v1/webhooks/<id>` and `{ "active": true }`.

| Endpoint | What it does |
|---|---|
| `GET /api/v1/webhooks` | Your webhooks, without secrets |
| `GET /api/v1/webhooks/<id>` | One webhook and its last 25 deliveries |
| `PATCH /api/v1/webhooks/<id>` | Change `url`, `events`, `description` or `active` |
| `POST /api/v1/webhooks/<id>/test` | Send a `ping` now and say how your URL answered |
| `POST /api/v1/webhooks/<id>/secret` | A new signing secret; the old one stops at once |
| `DELETE /api/v1/webhooks/<id>` | Stop sending |

An account has up to 10 webhooks. A webhook made with an `own` key hears only that key's links.

## How do I organize links in folders and teams?

Make a folder, then pass its id when you make a link:

```bash
curl -X POST -H "Authorization: Bearer $FLOPPY_KEY" -H "content-type: application/json" \
  -d '{"name":"Q4 proposals"}' https://fpy.sh/api/v1/folders
```

- `GET /api/v1/folders` lists Personal folders; `?team=<id or name>` lists a team's. Each has its `parentId`: folders go inside folders, up to 20 levels deep.
- `POST /api/v1/folders` takes `parent_id` to make a folder inside another (it goes in that folder's space).
- `PATCH /api/v1/folders/<id>` with `name`, `parent_id` (`null` for the top) or both renames or moves one, never into itself or a folder inside it, and never into another space. `DELETE` removes it and moves what was in it, links and folders, up one level.
- `POST /api/v1/links` takes `folderId`, any folder at any depth. Links and folders take `team` to belong to a team you're in.

Keys with scope `own` can't manage folders.

## How do I change a file and keep its link?

Put the new version on the same link. The URL, every recipient's link, the settings and the analytics stay:

```bash
curl -T proposal-v2.pdf -H "Authorization: Bearer $FLOPPY_KEY" https://fpy.sh/api/v1/links/<id>/replace/proposal-v2.pdf
```

A Markdown document keeps every version: `PUT /api/v1/links/<slug>/versions` with the whole text and an `x-note` header.

## How do I show my files as a disk?

`/api/v1/disk` is everything a disk needs: every link you can see as files in folders, the bytes by range, and the calls that save changes back. It's what Floppy Disk in Floppy for Mac uses. Keys need `read` for the GETs and `write` for the rest; an `own` key sees only its links and no folders.

```bash
curl -H "Authorization: Bearer $FLOPPY_KEY" "https://fpy.sh/api/v1/disk?cursor=$CURSOR"
```

- `GET /api/v1/disk` returns `cursor`, `used_bytes`, `limit_bytes`, `max_file_bytes`, `spaces` (`personal`, "My files", then one per team), `folders` (each with its `space_id` and `parent_id`, `null` at the top of the space) and `links`. Each link has its `slug`, `url`, `space_id`, `folder_id`, `name`, `version`, `can_edit` and `files`. Only links that are ready and not expired or deleted are listed. Send the last `cursor` back: the answer is `204` until anything in it changes.
- `GET /api/v1/disk/files/<file_id>` streams a file's bytes, with `Range` for `206`. It never counts as a view or download. An older version's file ids (below) read here too, while Floppy keeps that version.
- `POST /api/v1/disk/links` with `{ space_id, folder_id, name, files: [{ path, size, content_type }] }` makes a link with the longest expiry your plan allows, and returns `uploads`. Send the parts as for any link (`PUT /api/v1/files/<id>/parts/<n>`, then `POST /api/v1/files/<id>/complete`).
- `POST /api/v1/disk/links/<id>/versions` with `{ put, remove, rename: [{ from, to }] }` starts the next version behind the same slug. Upload the `put` files, then `POST /api/v1/disk/links/<id>/versions/<version_id>/complete`. Files you don't touch, and renamed ones, keep their bytes and their `file_id`. The version goes live once its new files pass the malware check, at once if there's nothing to upload.
- `PATCH /api/v1/disk/links/<id>` with `name`, `folder_id` (`null` for no folder) or `space_id` renames or moves it. A Personal link can move into a team; a team link stays in its team.
- `DELETE /api/v1/disk/links/<id>` sends it to Recently deleted.
- `POST /api/v1/disk/folders` with `{ space_id, parent_id, name }` (`parent_id` `null` or left out for the top of the space), `PATCH /api/v1/disk/folders/<id>` with `{ name, parent_id }` (either or both), and `DELETE /api/v1/disk/folders/<id>`, which answers `409` while live links or folders are in it. Folders nest up to 20 levels, stay in their space and never go inside themselves (`400`).

### How do I see and restore earlier versions?

- `GET /api/v1/disk/links/<id>/versions` returns `versions`, newest first: each with its `number`, `live`, `created_at`, `author` (`{ name }` or `null`), `note`, `size` and `files: [{ id, path, size, content_type }]`. A Markdown link lists its numbered versions; any other link lists what it holds now and the earlier files Floppy keeps (30 days, 7 on Free).
- `POST /api/v1/disk/links/<id>/versions/<number>/restore` makes a new live version equal to that one and returns `{ link, live }`. Nothing is removed: the version you replace stays in the list. Only the owner or a team admin can restore.

### How do I duplicate a folder or a file instantly?

- `POST /api/v1/disk/links/<id>/duplicate` with `{ name, folder_id }` (both optional) copies a link you can see and returns `201 { link }`: a new slug and URL, next to the original unless you pass `folder_id` (`null` for the top of its space). A one-file link's copy is named like `deck copy.pdf`.
- `POST /api/v1/disk/folders/<id>/duplicate` with `{ name, parent_id }` (both optional) copies the folder, its folders and the links in them in one go, and returns `201 { folder, folders, links }`. Up to 500 links and 500 folders per call; a private Slack channel's folder can't be duplicated.

No bytes are copied: a copy points at the same stored files, so it's instant at any size, and changing one later never changes the other. Copies stay in their space and count against its storage. They keep the original's note, style and download setting, not its password, email gate, per-person links or analytics.

Only a link's owner, or an admin of its team, can change its files or delete it (`can_edit`).

### How do I hear about changes as they happen?

Open a WebSocket to `GET /api/v1/disk/events` with the same `Authorization: Bearer` header (a key with `read`). It says `{"type":"hello"}` once, then `{"type":"changed"}` whenever anything the listing shows may have changed: a link made, renamed, moved, deleted, recovered or expired, a new version, a folder, someone joining or leaving a team. That's at most one message every 250 ms, whoever made the change (the web, another Mac, an agent over MCP, Slack). On `changed`, fetch `GET /api/v1/disk?cursor=` with your last cursor.

```bash
websocat -H "Authorization: Bearer $FLOPPY_KEY" wss://fpy.sh/api/v1/disk/events
```

Send `{"type":"ping"}` to keep it open; it answers `{"type":"pong"}`. Reconnect with backoff when it closes, and keep polling every minute as a fallback. Without a key, or with one that can't read, the answer is `401` or `403` and nothing is upgraded; a plain request gets `426`.

## How do I send only the part of a file that changed?

Name the file by its chunks instead of uploading it whole. Cut it into content-defined chunks (Floppy for Mac uses FastCDC: 256 KiB to 4 MiB, 1 MiB on average) and name each by its SHA-256 in lowercase hex. Ask which ones fpy.sh doesn't have, send only those, then make the link or the version with the list. A stored chunk is never sent again, and identical chunks are kept once per space: yours for `personal`, the team's for a team. Chunks are never shared between accounts, so nobody can find out whether someone else has a file.

```bash
curl -X POST https://fpy.sh/api/v1/disk/chunks/check -H "Authorization: Bearer $FLOPPY_KEY" \
  -H "Content-Type: application/json" -d '{"space_id":"personal","hashes":["9f86d0…"]}'
curl -X PUT "https://fpy.sh/api/v1/disk/chunks/9f86d0…?space_id=personal" -H "Authorization: Bearer $FLOPPY_KEY" --data-binary @chunk-0
```

- `POST /api/v1/disk/chunks/check` with `{ space_id, hashes }` (up to 10 000) returns `{ missing }`: the hashes to send.
- `PUT /api/v1/disk/chunks/<sha256>?space_id=…` with the chunk's bytes (1 byte to 8 MiB) answers `204`. Bytes whose SHA-256 isn't the one in the path get `400`. A chunk no file uses is deleted after a day.
- In `POST /api/v1/disk/links` (`files`) and `POST /api/v1/disk/links/<id>/versions` (`put`), a file can carry `chunks: [{ hash, size }]` in order, adding up to its `size`. It needs no upload and isn't in `uploads`; a version with nothing else to upload goes live once its new files pass the malware check. When a chunk isn't stored the answer is `409` with `error.missing`: send those and try again.
- A chunked file reads like any other: on the disk, at `/f/<file_id>`, in previews and downloads, with ranges. It counts its full size against your plan, however many of its chunks it shares.

## How do I ask a question about my files?

`POST /api/v1/ask` answers a question from the files on your disk, and says which files it used. It's the Ask tab of Floppy for Mac's launcher. A `read` key is enough.

```bash
curl -X POST -H "Authorization: Bearer $FLOPPY_KEY" -H "content-type: application/json" \
  -d '{"question":"What did the Q3 review say about churn?"}' https://fpy.sh/api/v1/ask
```

- Send `question` (up to 500 characters) and, to ask only about some files, `file_ids` (up to 20, from `GET /api/v1/disk`).
- The answer is `{ answer, sources: [{ file_id, path, link }], remaining }`. `answer` cites its sources as `[1]`, `[2]` in the order of `sources`; `path` is where the file shows on the disk.
- Floppy reads text files: plain text, Markdown, CSV, JSON, HTML, XML and YAML. PDFs, slides and images take part by name only.
- Questions a day: Free 20, Pro 200, Studio 500. Past that, `429` with `limit_reached`.

## Can I use the API from Floppy for Mac?

Yes, from the next Floppy for Mac update. It makes and revokes API keys under Settings › API, with the same rules as https://fpy.sh/app/keys: you see each key's name, access and when it was last used, and a new key's secret once. The keys work for the whole API on the web, and your scripts and the Mac app see the same links.

## Errors and limits

Every error has the same shape, with a `next` that says what to do:

```json
{ "error": { "code": "slow_down", "message": "Too many requests", "retry_after": 12, "next": "Wait 12 seconds.", "docs": "https://fpy.sh/docs/agents#errors" } }
```

| Status | Code | What to do |
|---|---|---|
| 400 | `bad_request` | Fix the field named in `message` |
| 401 | `unauthorized` | Check the key |
| 402 | `limit_reached` | The account is over its plan: storage, file size or expiry |
| 403 | `forbidden` | The key lacks the access or scope |
| 404 | `not_found` | Check the id |
| 409 | `conflict` | Fetch it again and retry |
| 429 | `slow_down` | Wait `retry_after` seconds |

Storage and file size follow the account's plan: Free has 2 GB and 500 MB a file, Pro 250 GB and Studio 1 TB, with 50 GB a file. The full table is at https://fpy.sh/docs/agents#limits.

## FAQ

### Is the Floppy API free?

Yes. The Floppy API is on every plan, Free included. The plan sets storage, file size and how long links can last.

### What's the difference between the API and MCP?

They do the same things. The REST API is for your code. The MCP server at `https://fpy.sh/mcp` is for AI agents like Claude and ChatGPT; see https://fpy.sh/docs/agents.

### Do webhooks report my own visits?

No. The `link.*` events follow the same rules as Floppy's analytics: never your own visits, bots, email scanners, link previews or links you muted.

### Can an integration upload without an account?

Yes. `PUT /api/drop/<filename>` with no key makes an unclaimed account and returns an agent key and a claim link. A person claims it within 72 hours to keep the files; see https://fpy.sh/docs/agents#claiming.

## Related

- [Agent docs](https://fpy.sh/docs/agents): MCP, one-call uploads, claiming and every endpoint
- [OpenAPI schema](https://fpy.sh/openapi.json): every endpoint and field
- [Floppy for Mac guide](https://fpy.sh/docs/mac): the menu bar app, and Settings › API
