Search

Search

1GET https://api.markprompt.com/search

Retrieves a list of searchs result that match a query.

Request body

KeyTypeDescription
querystring

The search query string.

projectKeystring

Optional, if not using a bearer token. The project key associated to your project. If shared publicly, use the production key from a whitelisted domain. If not, for instance on localhost, use the development key.

limitnumber

The maximum number of results to return. Default: 10.

includeSectionContentboolean

Whether to return the full content of matching sections, in addition to snippets. Default: false.

Example request

1curl "https://api.markprompt.com/search?query=react&limit=4" \
2  -X GET \
3  -H "Authorization: Bearer <TOKEN>"
4  -H "Content-type: application/json" \
5  -H "Accept: application/json"

Response

The response is of the form:

1{
2  data: [
3    searchResult1,
4    searchResult2,
5    ...
6  ]
7}

A search result is similar to a reference object used in completions references, with an additional field describing the match type:

1type SearchResult = {
2  matchType: 'title' | 'leadHeading' | 'content';
3  file: {
4    title?: string;
5    path: string;
6    meta?: any;
7    source: Source;
8  };
9  meta?: {
10    leadHeading?: {
11      id?: string;
12      depth?: number;
13      value?: string;
14      slug?: string;
15    };
16  };
17};

Search results are ranked depending on the match type: higher weights are put on title matches, then section lead headings, and finally on content.