Skip to main content

Indexing API

The indexing API provides endpoints for manipulating the article index: add new articles and retrieve or remove indexed ones. It is possible to add or remove several articles at once.

Article Object

The Article object is the same structure as the one used by the Research API.

Article Object and Metadata Fields

Both the Article and ParaSpec objects support an optional metadata field. Metadata can be used to attach additional information that is not processed by Geneea but is returned in API responses (e.g., internal paragraph IDs). Metadata fields that should be indexed must be configured in advance. These settings can be customized separately for each API key.

Endpoints

DescriptionRequest200 OK Response
POST /v1/articles/addAdds articles to the RAG index.List[Article]MessageResponse
POST /v1/articles/removeRemoves articles from the RAG index.List[String]MessageResponse
GET /v1/articles/idsLists IDs of all indexed articles.ArticleIds
GET /v1/articles/{article-id}Returns an indexed article.Article
PUT /v1/articles/{article-id}Adds or replaces an article.ArticleMessageResponse
DELETE /v1/articles/{article-id}Removes an article from the RAG index.MessageResponse

POST /v1/articles/add

Adds articles to the RAG index.

Example

Request

[
{
"id": "a17",
"paraSpecs": [
{
"type": "title",
"text": "Emmanuel Macron in Germany."
},
{
"type": "text",
"text": "Mr. Macron visited a trade show in Munich."
},
{
"type": "text",
"text": "Munich is a city in Bavaria. Bavaria is in Germany."
}
],
"language": "en",
"metadata": {
"publishDate": "2024-01-07T20:30:00Z",
"section": ["Europe"]
}
}
]

Response

{
"message": "1 article indexed."
}

POST /v1/articles/remove

Removes articles from the RAG index.

Example

Request

[
"<article-id-1>",
"<article-id-2>",
...
]

Response

{
"message": "123 articles removed."
}

GET /v1/articles/ids

Lists IDs of all articles in the RAG index.

Example response
{
"ids": [
"<article-id-1>",
"<article-id-2>",
...
]
}

GET /v1/articles/{article-id}

Retrieves a single article from the RAG index.

Example response
{
"id": "a17",
"paraSpecs": [
{
"type": "title",
"text": "Emmanuel Macron in Germany."
},
{
"type": "text",
"text": "Mr. Macron visited a trade show in Munich."
},
{
"type": "text",
"text": "Munich is a city in Bavaria. Bavaria is in Germany."
}
],
"language": "en",
"metadata": {
"publishDate": "2024-01-07T20:30:00Z",
"section": [
"Europe"
]
}
}

PUT /v1/articles/{article-id}

Adds or replaces a single article in the RAG index.

DELETE /v1/articles/{article-id}

Removes a single article from the RAG index.