Skip to content

Hand-written endpoint pages

Document an endpoint without a spec: write the page, and add the method bar with one line of frontmatter.

Updated

If you have no OpenAPI file, or an endpoint isn’t in it, write the page yourself. Add api to its frontmatter, and the page gets the method bar and a method badge in the sidebar.

guides/list-projects.mdx
---
title: "List projects"
api: "GET https://api.your-product.dev/v1/projects"
---
Returns the projects in your account.
apistringpath

"METHOD address". The method is get, put, post, delete, options, head, patch or trace. A full address is shown as written. A path that starts with / is added to the first address in api.baseUrl in docs.json.

The bar shows the method and address, with Copy for the whole address. There’s no Try it on a hand-written page, since there’s no spec to build the form from.

Everything after the frontmatter is your own. Use API fields to describe the parameters and the response, and RequestExample and ResponseExample to show them beside the text:

Fields
<ParamField query="limit" type="integer" default="20">
How many projects to return.
</ParamField>
<ResponseField name="projects" type="object[]">
The projects, newest first.
</ResponseField>

api and openapi do different jobs. Use api when no spec describes the endpoint. Use openapi to build the page from a spec, and add your own text. To keep a spec operation out of the generated pages and write it by hand, mark it x-hidden in the spec, then add a page with api. See Set up OpenAPI.

Was this page helpful?

Report a problem

What’s the problem?

The docs team sees this. Other readers don’t.