Skip to content

Highlight a passage

Finds the quote in the card’s saved article and highlights it: the first match, unless prefix or suffix points at another. A passage that overlaps a highlight merges with it, keeping the older note. A card holds up to 200 highlights, and a highlighted link keeps its saved copy and article: Refresh details and saving it again no longer replace them.

POST/v1/cards/{cardId}/highlights
Authorization
AuthorizationBearer token (OAuth access token or teakapi_ API key) · headerrequired

Bearer token. Accepts either an OAuth 2.0 access token (obtained via browser sign-in; expires after 1 hour and is refreshable) or a teakapi_ API key.

Path parameters
cardIdstringrequired
Request body
requiredapplication/json
quotestringrequired

Text from the card's article, at most 5,000 characters. Whitespace, curly quotes, dash styles and case don't need to match.

notestring

At most 2,000 characters.

prefixstring

Text just before the quote, to pick one of its repeats. Without it, or suffix, the first match is highlighted.

suffixstring

Text just after the quote, to pick one of its repeats.

Responses
200

The passage was highlighted already, or the new highlight merged with one it overlapped

idstringrequired
cardIdstringrequired
quotestringrequired

The highlighted text.

notestring | nullrequired
anchoredbooleanrequired

False while Teak hasn't found the quote in the card's saved article: an imported highlight waiting for the article, or one the article doesn't have.

sourcestringrequired

Where it was made: in Teak's reader, through this API, or by an import. Clients should accept values they don't know.

Allowed:readerapiimport
createdAtnumberrequired
updatedAtnumberrequired
201

Highlight created

idstringrequired
cardIdstringrequired
quotestringrequired

The highlighted text.

notestring | nullrequired
anchoredbooleanrequired

False while Teak hasn't found the quote in the card's saved article: an imported highlight waiting for the article, or one the article doesn't have.

sourcestringrequired

Where it was made: in Teak's reader, through this API, or by an import. Clients should accept values they don't know.

Allowed:readerapiimport
createdAtnumberrequired
updatedAtnumberrequired
400

INVALID_INPUT: no quote, or a quote or note too long

codestringrequired
errorstringrequired
retryAtnumber | null
404

Card not found

codestringrequired
errorstringrequired
retryAtnumber | null
409

NO_ARTICLE: the card isn't a link with a saved article, or is in Trash. HIGHLIGHT_LIMIT: the card has 200 highlights. CONFLICT: the card's saved article changed while the quote was being found; try again

codestringrequired
errorstringrequired
retryAtnumber | null
422

QUOTE_NOT_FOUND: the article doesn't have the quote

codestringrequired
errorstringrequired
retryAtnumber | null
429

RATE_LIMITED

codestringrequired
errorstringrequired
retryAtnumber | null
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST 'https://teakvault.com/api/v1/cards/string/highlights' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "quote": "string",
  "note": "string",
  "prefix": "string",
  "suffix": "string"
}'
Response
{
  "id": "string",
  "cardId": "string",
  "quote": "string",
  "note": "string",
  "anchored": true,
  "source": "reader",
  "createdAt": 0,
  "updatedAt": 0
}

Was this page helpful?