Developer guide: the Sifto API
How to send links to Sifto from a script, a phone shortcut or anything that can send a web request. You don't need to be signed in to read this page.
Sifto has a small HTTP API. With a token you can save a link or a piece of text, and import many links at once. Everything here describes the API that is live at https://sifto.nihil.codes.
Tokens
The token is the only thing that decides where a save goes. A token looks like sft_xxxxxxxx_…. You make one in Sifto under Settings → Devices: choose what it is for (Apple Shortcut, Chrome or Firefox extension, or Custom for your own scripts), then press Create token.
- Make one token per device or script. Each can be revoked on its own.
- A token is shown once, when you create it. Sifto keeps only a hash, so it can't show it again. Lost it? Revoke it and make a new one.
- Settings → Devices shows each token's name, its first part (after
sft_), when it was made and when it was last used. - Tokens can save and import. They can't read, search or delete anything in your library.
- There is no account, library or user field in any request. The token picks the library.
Send the token in a header on every request, and send JSON bodies with a Content-Type:
Authorization: Bearer sft_xxxxxxxx_…
Content-Type: application/json
The base address is https://sifto.nihil.codes. Always use https.
Save a link or text
POST /v1/saves
Send url or text. If you send both, the link is saved and text is ignored. If you send neither, you get a 400.
Only url (or text) is required. Every other field is used when it has a usable value and ignored when it's missing, empty, null or the wrong type, so a request is never refused because of an optional field. url and text may also be a list (as Apple Shortcuts sends them): the first one is used. If url is empty and text contains a link, the link is saved.
| Field | Type | Meaning |
|---|---|---|
url | string | The link. Only http and https, up to 8,192 characters. A bare domain like example.com gets https:// added. The host needs a dot in it. Tracking parameters are cleaned to spot duplicates, but your link is kept exactly as sent. |
text | string | Plain text to save when there is no link. The first line (up to 120 characters) becomes its title. |
note | string | Your own note: why you saved it. Optional. Your words are the best clue Sifto has when you search later. |
title | string | A title you already know. Optional. |
description | string | A description you already know. Optional. |
selected_text | string | Text highlighted on the page. Optional. |
context | string | Where on the device it came from, such as share_sheet or widget (up to 40 characters). Optional. |
meta | object | Anything else worth keeping about this save, up to 4 KB of JSON. Optional; anything larger is ignored. |
device | object | Apple Shortcut tokens only: {"name": "…", "model": "…"} from the Shortcuts action Get Device Details. Sifto finds or adds that device, so one token can serve your iPhone, iPad and Mac. Optional. |
source | string | One of shortcut, share_ext, web or api. Anything else becomes api. Optional. |
client | string | Which Sifto software sent it: web, mac, iphone, ipad, safari-ext, chrome-ext, firefox-ext, shortcut, api or import. Any other value is kept as a note. With a token, the token's kind (Apple Shortcut, extension or Custom) decides the client. Optional. |
client_version | string | The sender's version, such as 1.0 (12), up to 40 characters. Optional. |
surface | string | Where inside the sender: app, share-sheet, menu-bar, widget, siri, popup, context-menu or key-command. Anything else is ignored. Optional. |
capture | any | If present, the whole request body is kept as a backup copy with the save. It isn't used to read the page today. Optional. |
Any other field is ignored.
Example
curl -X POST https://sifto.nihil.codes/v1/saves \
-H "Authorization: Bearer sft_xxxxxxxx_…" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/article", "note": "for the trip"}'
Response
HTTP/1.1 202 Accepted
Content-Type: application/json
{ "item_id": "01K…", "status": "saved", "new": true, "reading": true }
| Field | Meaning |
|---|---|
item_id | The saved item's id. |
status | Always saved. |
new | true if the link wasn't in your library before. false if you had it already; the save is still recorded against it. |
reading | true if Sifto queued the page to be read and sifted. For a link you already have, this is false unless the last read failed or was partial, in which case it tries again. |
The answer is 202 because the reading happens afterwards. The item shows up in your library straight away, and its title, summary and topics fill in over the next minute or so.
Saving text
curl -X POST https://sifto.nihil.codes/v1/saves \
-H "Authorization: Bearer sft_xxxxxxxx_…" \
-H "Content-Type: application/json" \
-d '{"text": "Ask Ravi about the brass lamp shop in Mysuru"}'
Text is saved as a new item every time, even if you send the same text twice.
Import in bulk
Importing is two steps: a preview that saves nothing, then a commit. A token or a signed-in session works for all three routes. Most people don't need the API for this: the import guide shows how to bring in bookmarks, Reading List or chat links from the website.
1. Preview
POST /v1/imports
| Field | Type | Meaning |
|---|---|---|
source | string | A label for where the rows came from, such as my-script. Required. |
rows | array | 1 to 5,000 rows. Required. |
Each row needs a url or a non-empty text, or it counts as invalid. Rows can also carry title, description, folder (a path like Travel/Japan), note, added_at (an ISO date, only if the source really knows it), image_url, site_name and adult (true keeps the row as a bookmark only; Sifto never opens it).
curl -X POST https://sifto.nihil.codes/v1/imports \
-H "Authorization: Bearer sft_xxxxxxxx_…" \
-H "Content-Type: application/json" \
-d '{"source": "my-script", "rows": [
{"url": "https://example.com/a", "title": "A", "folder": "Travel/Japan"},
{"text": "a loose note", "note": "from my notes app"}
]}'
HTTP/1.1 201 Created
{ "import_id": "01K…",
"counts": { "new": 2, "duplicate": 0, "invalid": 0, "total": 2 },
"billing": { "links_left": 100, "would_sift": 2, "would_hold": 0, "fits": 2, "over_limit": 0 } }
counts says how many rows are new, duplicate (already in your library, or repeated in the same import) or invalid (no usable link or text). billing says what will happen to the new ones:
| Field | Meaning |
|---|---|
links_left | Sifts you have left (null on an unlimited plan). |
would_sift | New rows that will be read and sifted straight away. |
would_hold | New rows that will be saved but kept unsifted until you add sifts. |
fits | New rows that fit in your library. |
over_limit | New rows that won't be saved, because a free library holds at most 1,000 links. |
2. Commit
POST /v1/imports/:id/commit
No body. Use the import_id from the preview.
curl -X POST https://sifto.nihil.codes/v1/imports/01K…/commit \
-H "Authorization: Bearer sft_xxxxxxxx_…"
HTTP/1.1 202 Accepted
{ "import_id": "01K…", "status": "committing" }
Saving and reading happen in the background. Committing twice is safe: an import that is already past the preview answers 200 with its current status.
3. Check on it
GET /v1/imports/:id
curl https://sifto.nihil.codes/v1/imports/01K… \
-H "Authorization: Bearer sft_xxxxxxxx_…"
The answer has the import's id, source, status, counts_json (the counts as a JSON string), created_at, committed_at and stages, which counts the usable rows by how far they have got.
Limits
- 120 requests a minute for each token. A signed-in session is limited the same way, per account.
- 5,000 rows in one import through the API.
- 1,000 links in a free library. A Sift Pack or Sift Yearly lifts it.
- A token can save and import only.
Over the rate limit, Sifto answers 429 with a Retry-After header giving the seconds to wait:
{ "error": "rate_limited", "message": "Too many requests. Try again in a minute." }
Errors
Errors are JSON with an error field.
| Status | When | error |
|---|---|---|
| 400 | No url and no text, or the body isn't JSON | url or text required |
| 400 | The url is empty, too long, not http or https, or has no dot in its host | URL is empty or too long, Only http and https are supported, Host must be a domain name, Not a URL |
| 400 | An import without source or rows, or with more than 5,000 rows | source and rows required, at most 5000 rows per import |
| 401 | A missing, wrong or revoked token | unauthorized |
| 402 | A new save, or an import commit, when a free library already holds 1,000 links | free_limit, with a message |
| 404 | An import id that isn't in your library | not found |
| 429 | Too many requests | rate_limited, with Retry-After |
| 500 | Something failed inside Sifto | internal error |
A wrong token and a revoked one both give 401, on purpose. Check Settings → Devices to see whether the token is still active. Saving a link you already have is never refused, even at the free limit.
Apple Shortcuts and Android
On iPhone, iPad and Mac, an Apple Shortcut can call POST /v1/saves from the Share menu. Follow Set up an Apple Shortcut to save to Sifto, step by step.
On Android, an app that can send a web request from the share menu, such as HTTP Shortcuts, can do the same: a POST to https://sifto.nihil.codes/v1/saves with the two headers above and a JSON body with url set to the shared text.
The API doesn't send cross-origin (CORS) headers, so a script on another website can't call it from a browser. Use curl, a script, a shortcut or the Sifto app.
Keep your token safe
- Treat a token like a password. Anyone who has it can add links to your library. Don't paste it into chats, screenshots or public code.
- Revoke a lost or leaked token in Settings → Devices. It stops working at once. Then make a new one.
- Questions: support@nihil.codes.