Skip to main content

GET /api/data/:collectionName/:id

Fetches one document by its _id. Returns 404 if no document with that ID exists in the collection.

Required header

x-api-key: your pk_live_… or sk_live_… key.

Path parameters

string
required
The name of the collection (e.g., posts, products).
string
required
The MongoDB ObjectId string of the document to retrieve (e.g., 64fd1234abcd5678ef901234).

Query parameters

boolean
If true, allows retrieval of a soft-deleted document. Defaults to false. Without this parameter, requesting a soft-deleted document by ID will return 404 Not Found.

Response fields

The endpoint returns the document object directly.
string
The unique MongoDB ObjectId string for the document.
boolean
true if the document is in the trash.
string
ISO date string of when the document was soft-deleted, or null.
string
ISO date string of when the document was created.
string
ISO date string of when the document was last updated.
Other fields returned depend on your collection schema.

Code examples

Success response

Errors