Search an index
curl --request POST \ --url 'https://api.grepvine.ai/v1/organizations/example/indexes/example/query?amount=50' \ --header 'Content-Type: application/json' \ --cookie __Host-grepvine-session=<__Host-grepvine-session> \ --data '{ "pattern": "example", "mode": "regex", "case_sensitive": true, "whole_word": false, "multiline": false, "filter": "example", "lines_before": 0, "lines_after": 0 }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”An account or organization name. Accounts and organizations share one namespace. A name keeps the case it was created with, and any spelling that differs only in case refers to it; no other account or organization can take such a spelling.
An index name, unique in its organization. A name keeps the case it was created with, and any spelling that differs only in case refers to it; no other index in the organization can take such a spelling.
Query Parameters
Section titled “Query Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Let a match span lines. Without it a pattern matches within one line, ^ and $ mark the line’s edges, and a character class never matches a line break; a pattern that contains a line break is rejected. With it the pattern is matched against the whole document, ^ and $ still mark line edges, \A and \z mark the document’s edges, and a match may contain line breaks.
How many lines before each result to return with it, from the same document.
How many lines after each result to return with it, from the same document.
Responses
Section titled “Responses”A page of results. Each result is one match, or several matches that share lines, together with the lines it covers.
object
One match, or several matches that share lines, together with the lines it covers. A result covers one line unless the query set multiline and a match spans lines.
object
One-based number of the first line the result covers.
One-based number of the last line the result covers. Equal to line_number unless a match spans lines.
Byte offset of the first covered line’s start within the document.
Byte offset just past the last covered line, excluding its line break.
Byte offset of the first byte of text within the document.
One-based number of the line text begins on. Equal to line_number unless text was cut at its start.
The covered lines, up to 64 KiB, centered on the first match when they are longer. Line breaks between covered lines are kept; the last line’s break is not.
Every match on the covered lines that lies at least partly within text, with byte offsets and lengths relative to the document. A match that consumed the last line’s break extends one byte past text.
object
Whether text was cut at either end.
Whether matches were left out, because there were more than 4096 or because they lie outside text.
The requested lines before the result, in document order, ending at the line just above its first line. Fewer are returned at the start of the document, and the field is omitted when there are none.
One line near a result. Text is returned whole up to 64 KiB, and up to 64 KiB away from the result; a line that extends past either bound is returned in part and marked truncated.
object
The requested lines after the result, in document order, starting at the line just below its last line. Fewer are returned at the end of the document, and the field is omitted when there are none.
One line near a result. Text is returned whole up to 64 KiB, and up to 64 KiB away from the result; a line that extends past either bound is returned in part and marked truncated.
object
A page may hold fewer results than the requested amount, possibly none, while has_next is true; a query page stops at the server’s soft time budget and next_page_id resumes exactly after the last candidate it examined. Clients continue while has_next is true.
object
Example generated
{ "results": [ { "key": "example", "revision": "example", "line_number": 1, "last_line_number": 1, "line_start_offset": 1, "line_end_offset": 1, "text_start_offset": 1, "text_line_number": 1, "text": "example", "matches": [ { "offset": 1, "length": 1 } ], "text_truncated": true, "matches_truncated": true, "lines_before": [ { "line_number": 1, "text": "example", "text_truncated": true } ], "lines_after": [ { "line_number": 1, "text": "example", "text_truncated": true } ] } ], "pagination": { "next_page_id": "example", "has_next": true }}default
Section titled “default”The request failed. A 429 carries Retry-After; the index is busy absorbing recent writes or is out of request capacity, and clients must slow down and retry after the interval. A 403 with code organization_suspended refuses every operation on a suspended organization’s members, indexes, documents and searches; reading the organization itself still answers and reports suspended, and the client should contact support.
object
Example generated
{ "code": "example", "reason": "example", "error": "example"}Headers
Section titled “Headers”The request identifier used for support and audit correlation.
Seconds to wait before retrying. Sent with every 429 so a client slows down instead of failing.