Get documents by IDs

Fetches one or more specific documents by their IDs and datatype directly from the search index.

Requires authentication.

Request

POST /documents/byId

Headers

HeaderValue
AuthorizationBearer <token>
Content-Typeapplication/json

Request Body

FieldTypeRequiredDescription
datatypestringYesThe document type. Common values: product, category, manufacturer.
idsarrayYesArray of document IDs to fetch.
constraintsobjectYesQuery constraints.
constraints.query.languagestringYesLanguage identifier for the index to search in.

Example Request

POST /documents/byId
Authorization: Bearer <token>
Content-Type: application/json

{
  "datatype": "category",
  "ids": ["cat-123", "cat-456"],
  "constraints": {
    "query.language": "de"
  }
}

Response

Returns a JSON array of matching document objects. Documents that are not found are omitted from the response.

Response Body

Each object in the array contains:

FieldTypeDescription
idstringDocument identifier.
es_idstringElasticsearch document ID.
titlestringDisplay title of the document.
urlstringURL of the document.
typestringDocument type.
manufacturer_titlestringManufacturer name (for products).
category_titlestringCategory name (for products).
eanstringEAN/barcode (for products).

Example Response

[
  {
    "id": "cat-123",
    "es_id": "category_cat-123",
    "title": "Men's Shoes",
    "url": "/men/shoes",
    "type": "category",
    "manufacturer_title": null,
    "category_title": null,
    "ean": null
  }
]