Knowledge

Get knowledge generations

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

Retrieves knowledge generations in the given time range.

Request body

KeyTypeDescription
fromstring

The start of the range, as an ISO 8601 string.

tostring

The end of the range, as an ISO 8601 string.

limitnumber

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

pagenumber

The page index. Default: 0.

expandstring

If set to data.sources.reviews, expand the knowledge object to include source reviews that led to this knowledge generation.

projectKeystring

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

Example request

1curl "https://api.markprompt.com/knowledge?from=2024-10-09T00%3A00%3A00&to=2024-10-10T00%3A00%3A00&limit=3&page=1" \
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  "object": "list",
3  "data": [
4    {
5      "id": "knowledge-id-1",
6      "title": "Add Information about Payment Resolution",
7      "originalContent": "## Payment resolution...",
8      "newContent": "## Payment resolution...\n\n@@++\n* If you are using Stripe for payment processing\n++@@\n...",
9      "reason": "It is to explicitly inform users that...",
10      "sourceName": "File Source 1",
11      "filePath": "file-path-1",
12      "createdAt": "2024-10-09T22:35:49.000000+00:00",
13      "sources": [
14        {
15          "threadId": "thread-id-1"
16        },
17        {
18          "reviewId": "review-id-1"
19        }
20      ]
21    }
22    // ...
23  ]
24}

Expanded knowledge

When adding expand=data.sources.reviews to the request body, knowledge generations are returned together with associated source reviews, including review assignees and comments.

1curl "https://api.markprompt.com/knowledge?from=2024-10-09T00%3A00%3A00&to=2024-10-10T00%3A00%3A00&limit=3&page=1&expand=data.sources.reviews" \
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"

The response looks like this:

1{
2  "object": "list",
3  "data": [
4    {
5      "id": "knowledge-id-1",
6      "title": "Add Information about Payment Resolution",
7      "originalContent": "## Payment resolution...",
8      "newContent": "## Payment resolution...\n\n@@++\n* If you are using Stripe for payment processing\n++@@\n...",
9      "reason": "It is important to explicitly inform users that...",
10      "sourceName": "File Source 1",
11      "filePath": "file-path-1",
12      "createdAt": "2024-10-09T22:35:49.000000+00:00",
13      "sources": [
14        {
15          "review": {
16            "id": "review-id-1",
17            "createdAt": "2024-10-09T22:35:52.000000+00:00",
18            "createdBy": {
19              "id": "user-id-1",
20              "email": "jane@acme.com"
21            },
22            "comments": [
23              {
24                "id": "comment-id-1",
25                "comment": "this should have told the user...",
26                "createdAt": "2024-10-09T22:35:52.000000+00:00",
27                "createdBy": {
28                  "id": "user-id-2",
29                  "email": "joe@acme.com"
30                }
31              }
32            ]
33          }
34        }
35      ]
36    }
37    // ...
38  ]
39}