Skip to content
STIMSMITH

REST API Content Retrieval

Technique WIKI v1 · 7/5/2026

REST API content retrieval is a technique for fetching document or page contents by sending a structured HTTP request to a content endpoint, typically using POST with a JSON body identifying the target resources. The Exa API implements this pattern through its `/contents` endpoint, where clients pass one or more resource identifiers to receive the corresponding content.

REST API Content Retrieval

Overview

REST API content retrieval is a technique for obtaining the body or full contents of one or more resources (such as documents, URLs, or publications) by calling a dedicated REST endpoint on a web API. Instead of returning search results or metadata, the endpoint resolves the supplied identifiers and returns the actual content associated with each one.

Mechanism

The technique typically follows these steps:

  1. The client prepares an HTTP POST request to a dedicated contents endpoint.
  2. The request includes authentication credentials (commonly an API key supplied via a custom header such as x-api-key).
  3. The request body is JSON-encoded and contains an ids field listing one or more resource identifiers (for example, canonical URLs of the desired pages or publications).
  4. The server responds with the resolved content for each requested identifier.

Example: Exa API /contents Endpoint

The Exa API implements REST API content retrieval through its /contents endpoint. A request is sent as POST https://api.exa.ai/contents with the resource identifiers passed in a JSON ids array:

bash curl -X POST "https://api.exa.ai/contents"
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{ "ids": ["https://exa.ai/library/publication/ymvqpsm8045"] }'

In this pattern, the caller supplies a single URL (or a list of URLs) inside ids, and the Exa service returns the corresponding document contents. Because the endpoint accepts multiple identifiers in one request, it can be used to batch-fetch contents for several resources in a single call.

Characteristics

  • Stateless: Like other REST interactions, each request is self-contained and authenticated independently.
  • Identifier-driven: Retrieval is keyed by resource IDs supplied by the client, rather than by a free-text query.
  • Batch-friendly: Multiple identifiers can typically be supplied in a single ids array to retrieve many contents at once.
  • Auth via header: API access is usually gated by an x-api-key header rather than query-string credentials.

Implementations

  • Exa API — exposes a /contents POST endpoint that takes an ids array of URLs and returns their contents.

LINKED ENTITIES

1 links

CITATIONS

3 sources
3 citations
[1] The Exa API implements REST API content retrieval via a POST https://api.exa.ai/contents endpoint. Program Generation Through a Probabilistic Constrained Grammar
[2] Requests to the Exa contents endpoint include x-api-key authentication and Content-Type application/json headers. Program Generation Through a Probabilistic Constrained Grammar
[3] The request body uses an ids array containing one or more resource URLs whose contents should be returned. Program Generation Through a Probabilistic Constrained Grammar