Sifto docs

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.

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.

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.

FieldTypeMeaning
urlstringThe 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.
textstringPlain text to save when there is no link. The first line (up to 120 characters) becomes its title.
notestringYour own note: why you saved it. Optional. Your words are the best clue Sifto has when you search later.
titlestringA title you already know. Optional.
descriptionstringA description you already know. Optional.
selected_textstringText highlighted on the page. Optional.
contextstringWhere on the device it came from, such as share_sheet or widget (up to 40 characters). Optional.
metaobjectAnything else worth keeping about this save, up to 4 KB of JSON. Optional; anything larger is ignored.
deviceobjectApple 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.
sourcestringOne of shortcut, share_ext, web or api. Anything else becomes api. Optional.
clientstringWhich 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_versionstringThe sender's version, such as 1.0 (12), up to 40 characters. Optional.
surfacestringWhere inside the sender: app, share-sheet, menu-bar, widget, siri, popup, context-menu or key-command. Anything else is ignored. Optional.
captureanyIf 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 }
FieldMeaning
item_idThe saved item's id.
statusAlways saved.
newtrue if the link wasn't in your library before. false if you had it already; the save is still recorded against it.
readingtrue 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

FieldTypeMeaning
sourcestringA label for where the rows came from, such as my-script. Required.
rowsarray1 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:

FieldMeaning
links_leftSifts you have left (null on an unlimited plan).
would_siftNew rows that will be read and sifted straight away.
would_holdNew rows that will be saved but kept unsifted until you add sifts.
fitsNew rows that fit in your library.
over_limitNew 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

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.

StatusWhenerror
400No url and no text, or the body isn't JSONurl or text required
400The url is empty, too long, not http or https, or has no dot in its hostURL is empty or too long, Only http and https are supported, Host must be a domain name, Not a URL
400An import without source or rows, or with more than 5,000 rowssource and rows required, at most 5000 rows per import
401A missing, wrong or revoked tokenunauthorized
402A new save, or an import commit, when a free library already holds 1,000 linksfree_limit, with a message
404An import id that isn't in your librarynot found
429Too many requestsrate_limited, with Retry-After
500Something failed inside Siftointernal 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