Cleanup
The numbers for the top of a cleanup page. Nothing is checked when you call this; it reads what the checks found.
bearerAuthorizationBearer <token>Supabase access token (JWT) or personal API key (ga_…). A key gets 403 on a resource it has no access to, and on anything that changes data without write access.
Counts of links, dead links and duplicates
application/json- response
links*integerLive link items
checked*integerOf those, how many have been checked at least once
dead*integerDead links the user has not chosen to keep
suspect*integerLinks that are failing but not yet confirmed dead
duplicate_groups*integerPages saved more than once
duplicate_items*integerCopies beyond the first of each page, so the number a full cleanup would remove
last_checked_at*|The most recent check of any of the user's links
date-timecurl -X GET 'https://example.com/v1/cleanup'{ "links": 0, "checked": 0, "dead": 0, "suspect": 0, "duplicate_groups": 0, "duplicate_items": 0, "last_checked_at": "2019-08-24T14:15:22Z"}Link items whose page is gone, oldest id first. Dead links the user chose to keep are left out.
A link counts as dead only after 3 answers in a row that the page does not exist (a 404, a 410 or a
domain that no longer exists), spread over at least 24 hours. A site that is briefly down is never
reported. Until then the link is counted as suspect in the summary.
Each entry is a short summary. Get GET /v1/items/{id} for the whole item. To archive or delete a dead
link, use the normal item routes.
bearerAuthorizationBearer <token>Supabase access token (JWT) or personal API key (ga_…). A key gets 403 on a resource it has no access to, and on anything that changes data without write access.
cursor?stringSend the next_cursor from the previous page to get the next one
limit?integerHow many entries to return. Anything above 200 is treated as 200.
1 <= value50A page of dead links
application/json- response
items*array<>next_cursor?stringOnly there while more dead links remain
curl -X GET 'https://example.com/v1/cleanup/dead-links'{ "items": [ { "id": "string", "title": "string", "url": "string", "domain": "string", "tags": [ "string" ], "is_favourite": true, "has_note": true, "list_count": 0, "archived_at": "2019-08-24T14:15:22Z", "created_at": "2019-08-24T14:15:22Z", "http_status": 0, "failing_since": "2019-08-24T14:15:22Z", "checked_at": "2019-08-24T14:15:22Z" } ], "next_cursor": "string"}Queues a check of every link that was not checked in the last 6 hours. The checks run in the background,
so the answer comes straight away and the report fills in as they finish. Poll GET /v1/cleanup for the
counts. A user can do this 4 times an hour, and gets a 429 after that.
bearerAuthorizationBearer <token>Supabase access token (JWT) or personal API key (ga_…). A key gets 403 on a resource it has no access to, and on anything that changes data without write access.
The checks are queued
curl -X POST 'https://example.com/v1/cleanup/dead-links/scan'Hides a dead link from the report. It comes back only if the link is found dead again after it has answered once. The item itself is not changed.
bearerAuthorizationBearer <token>Supabase access token (JWT) or personal API key (ga_…). A key gets 403 on a resource it has no access to, and on anything that changes data without write access.
id*stringThe link is hidden from the report
curl -X POST 'https://example.com/v1/cleanup/dead-links/string/keep'Groups of link items that share a normalised URL. The same page counts once with or without tracking
parameters, www., a fragment, a trailing slash, or http instead of https. Notes, quotes and to-dos
that carry a source URL are never grouped.
Each group names a suggested_keep_id: the copy the user put the most into. Lists count 3 each, a note 4,
a favourite 3 and each tag 1. A tie goes to the oldest copy.
bearerAuthorizationBearer <token>Supabase access token (JWT) or personal API key (ga_…). A key gets 403 on a resource it has no access to, and on anything that changes data without write access.
cursor?stringSend the next_cursor from the previous page to get the next one
limit?integerHow many groups to return. Anything above 200 is treated as 200.
1 <= value50A page of duplicate groups
application/json- response
groups*array<>next_cursor?stringOnly there while more groups remain
curl -X GET 'https://example.com/v1/cleanup/duplicates'{ "groups": [ { "url": "string", "items": [ { "id": "string", "title": "string", "url": "string", "domain": "string", "tags": [ "string" ], "is_favourite": true, "has_note": true, "list_count": 0, "archived_at": "2019-08-24T14:15:22Z", "created_at": "2019-08-24T14:15:22Z" } ], "suggested_keep_id": "string" } ], "next_cursor": "string"}Folds copies of one page into the copy that stays, all in one transaction. The copy that stays gets:
- every tag from the other copies
- their notes, joined with a blank line (a note already inside another is not repeated, and if joining would pass 1 MB the kept note stays alone)
- a favourite flag if any copy had one
- a place in every list the other copies were in
The other copies are deleted like any deleted item: a tombstone for sync, an item.deleted webhook
event, and their stored files removed. A refused merge changes nothing.
bearerAuthorizationBearer <token>Supabase access token (JWT) or personal API key (ga_…). A key gets 403 on a resource it has no access to, and on anything that changes data without write access.
application/json- body
keep_id*stringThe copy that stays
26 <= length <= 26remove_ids*array<>The copies to fold into keep_id and delete. All of them must be copies of the same page as keep_id.
1 <= items <= 50Which copy stayed and which were removed
application/json- response
kept_id*stringremoved_ids*array<string>curl -X POST 'https://example.com/v1/cleanup/duplicates/merge' \ -H 'Content-Type: application/json' \ -d '{ "keep_id": "stringstringstringstringst", "remove_ids": [ "stringstringstringstringst" ]}'{ "kept_id": "string", "removed_ids": [ "string" ]}Rules
Rules, as in Karakeep. When an event happens to an item (it is added, a tag is added or removed, it joins or leaves a list, it is favourited or archived), a rule whose condition holds does its actions. A key needs the `rules` resource.
Admin
Operator actions (docs/ADMIN.md), the same as `cmd/admin`. Needs a Supabase access token of a user in the `admins` table, from a session that passed MFA (`aal2`); API keys get 401. Admins are granted and revoked only with `admin grant` / `admin revoke` on the command line. Responses never hold item content.