Skip to main content
highlights returns the passages of a page that best match a query. Use it to give a model only the part of a long page that matters.

Make a request

Get an API key in the Quickstart. Send highlights as an object with your query. This request asks for the three best passages.

Read the response

data.highlights is one string. The passages are separated by a blank line, and a table row keeps its header.

Options

The top-level query field of the request is a different option. It shortens the Markdown of a long page. See Content filtering.

Limits and errors

  • A page with no matching text returns an empty string, "", and costs only the page.
  • Highlights are chosen from the page’s Markdown after content filtering. With redactPII, they come from the redacted text.
  • A call without query returns 400 invalidRequest.

Price

$4 per 1,000 pages: $1 for the page and $3 for highlights. When nothing matches, the $3 is not charged.