Sections

Get matching sections

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

Retrieves a list of sections that match a prompt.

The /sections endpoint is available as part of the Enterprise plan.

Request body

Key Type Description Default
prompt string

The input prompt.

sectionsMatchCount number

The number of sections to retrieve.

15
sectionsMatchThreshold number

The similarity threshold between the input prompt and selected sections. The higher the threshold, the more relevant the sections. If it's too high, it can potentially miss some sections.

0.75
maxContextTokens number

The maximum number of tokens that the returned sections fill.

10000
projectKey string

Instead of the API token, use a project key, for instance for client-facing requests.

Example request

1curl "https://api.markprompt.com/sections?prompt=what%20is%20a%20component%3F&sectionsMatchCount=20&sectionsMatchThreshold=0.4" \
2  -X GET \
3  -H "Authorization: Bearer <TOKEN>" \
4  -H "Content-type: application/json" \
5  -H "Accept: application/json" \
6  -H "X-Markprompt-API-Version: 2024-05-21"

Response

The response is of the form:

1{
2  "data": [
3    {
4      "path": "/path/to/section/1",
5      "anchor": "heading-1",
6      "content": "Section 1 content…",
7      "similarity": 0.89,
8      "reference": {
9        "file": {
10          "title": "Title 1",
11          "path": "/path/to/section/1",
12          "meta": {
13            "title": "Title 1"
14          }
15        },
16        "meta": {
17          "leadHeading": {
18            "value": "Heading 1",
19            "slug": "heading-1",
20            "depth": 1
21          }
22        }
23      }
24    },
25    {
26      "path": "/path/to/section/2",
27      "anchor": "heading-2",
28      "content": "Section 2 content…",
29      "similarity": 0.77,
30      "…": "…"
31    }
32  ]
33}