Skip to content
Readsmith

Operation embeds

<Operation> renders one operation from your OpenAPI spec inside a prose page: the method bar, parameters, request body, responses, and the request console, generated from the same spec that powers your API reference. It exists for narrative pages that walk through an API while keeping every contract detail generated rather than hand-copied.

Usage

Configure your spec once:

docs.yamlyaml
apiReference:
  spec: openapi.json

Then embed an operation anywhere prose needs it:

Creating a sandbox is one call:

<Operation op="POST /sandboxes" />

The response arrives when the guest agent reports healthy.

The op value is the method and path exactly as they appear in your spec. A reference that matches nothing renders a visible danger callout in place, so a renamed endpoint cannot silently ship stale docs.

A live embed

This site configures its own spec, so here is a real one: the capabilities endpoint every Readsmith site serves, embedded in this prose page:

GET/docs/_readsmith/api/ai/capabilities
Responses
200 OKCurrent capabilities.
Capabilities
searchbooleanrequired

Search is answering (a database is connected).

vectorSearchbooleanrequired

The semantic arm is configured (an embedding key resolves).

askAibooleanrequired

Ask AI is enabled and a chat key resolves.

Request
GET/docs/_readsmith/api/ai/capabilities
cURL
curl 'https://readsmith.dev/docs/_readsmith/api/ai/capabilities'
GET/_readsmith/api/ai/capabilities
Request
Authorization
curl 'https://readsmith.dev/docs/_readsmith/api/ai/capabilities'
Response
Send a request to see the response.
Response
200 OK
{
  "search": false,
  "vectorSearch": false,
  "askAi": false
}

Props

Prop Type Effect
op string METHOD /path of the operation to embed

When to embed, when not to

Embeds shine on site-only narrative pages: a walkthrough that interleaves prose with three or four fully specified calls. Two cautions from real use:

  • A repository whose docs also render on GitHub should prefer plain Markdown there: component tags degrade to raw text outside Readsmith, while the generated API reference provides the rich version on the site.
  • One operation per embed. A page of twenty embeds is an API reference wearing a costume; use apiReference.layout: pages and get navigation, search, and per-operation URLs for free.
Was this page helpful?