Get document (GET)

Retrieve a single document by its ID.


GET/api/v1/documents/:id

Get an indexed document by ID.


Path parameters

ParameterTypeDescription
idrequiredstringThe document ID.

Example

const response = await fetch(
"https://etoile.dev/api/v1/documents/starry-night",
{
  headers: {
    Authorization: `Bearer ${process.env.ETOILE_SECRET_KEY}`,
  },
},
);

const { document } = await response.json();

Response

{
"document": {
  "id": 1,
  "external_id": "starry-night",
  "collection": "paintings",
  "title": "The Starry Night",
  "type": "text",
  "metadata": { "artist": "Vincent van Gogh", "year": 1889 },
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-01-01T00:00:00.000Z"
}
}

Returns 404 if the document does not exist.


Auth

Requires secret key.