Skip to content
Skip to Content
Full reference

Cleanup

GET
/v1/cleanup

The numbers for the top of a cleanup page. Nothing is checked when you call this; it reads what the checks found.

Authorization

bearer
headerAuthorizationBearer <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.

Response Body

Counts of links, dead links and duplicates

application/json
  1. response
links*integer

Live link items

checked*integer

Of those, how many have been checked at least once

dead*integer

Dead links the user has not chosen to keep

suspect*integer

Links that are failing but not yet confirmed dead

duplicate_groups*integer

Pages saved more than once

duplicate_items*integer

Copies 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

Formatdate-time
Example Request
curl -X GET 'https://example.com/v1/cleanup'
Example Response
{  "links": 0,  "checked": 0,  "dead": 0,  "suspect": 0,  "duplicate_groups": 0,  "duplicate_items": 0,  "last_checked_at": "2019-08-24T14:15:22Z"}
GET
/v1/cleanup/dead-links

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.

Authorization

bearer
headerAuthorizationBearer <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.

Query Parameters

cursor?string

Send the next_cursor from the previous page to get the next one

limit?integer

How many entries to return. Anything above 200 is treated as 200.

Range1 <= value
Default50

Response Body

A page of dead links

application/json
  1. response
items*array<>
next_cursor?string

Only there while more dead links remain

Example Request
curl -X GET 'https://example.com/v1/cleanup/dead-links'
Example Response
{  "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"}
POST
/v1/cleanup/dead-links/scan

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.

Authorization

bearer
headerAuthorizationBearer <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.

Response Body

The checks are queued

Example Request
curl -X POST 'https://example.com/v1/cleanup/dead-links/scan'
Example Response
Empty
POST
/v1/cleanup/dead-links/{id}/keep

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.

Authorization

bearer
headerAuthorizationBearer <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.

Path Parameters

id*string

Response Body

The link is hidden from the report

Example Request
curl -X POST 'https://example.com/v1/cleanup/dead-links/string/keep'
Example Response
Empty
GET
/v1/cleanup/duplicates

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.

Authorization

bearer
headerAuthorizationBearer <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.

Query Parameters

cursor?string

Send the next_cursor from the previous page to get the next one

limit?integer

How many groups to return. Anything above 200 is treated as 200.

Range1 <= value
Default50

Response Body

A page of duplicate groups

application/json
  1. response
groups*array<>
next_cursor?string

Only there while more groups remain

Example Request
curl -X GET 'https://example.com/v1/cleanup/duplicates'
Example Response
{  "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"}

Merge copies of one page

POST
/v1/cleanup/duplicates/merge

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.

Authorization

bearer
headerAuthorizationBearer <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.

Request Body

application/json
  1. body
keep_id*string

The copy that stays

Length26 <= length <= 26
remove_ids*array<>

The copies to fold into keep_id and delete. All of them must be copies of the same page as keep_id.

Items1 <= items <= 50

Response Body

Which copy stayed and which were removed

application/json
  1. response
kept_id*string
removed_ids*array<string>
Example Request
curl -X POST 'https://example.com/v1/cleanup/duplicates/merge' \  -H 'Content-Type: application/json' \  -d '{  "keep_id": "stringstringstringstringst",  "remove_ids": [    "stringstringstringstringst"  ]}'
Example Response
{  "kept_id": "string",  "removed_ids": [    "string"  ]}