- Documentation
- Components
- API fields and examples
API fields and examples
Document an endpoint's fields, and show its request and response beside the text.
ParamField and ResponseField describe a field: its name, type, whether it’s required, its default, and what it is.
Expandable folds a field’s children away.
urlstringrequiredWhere Specly sends the event.
limitintegerHow many results to return.
X-Legacy-KeystringUse an API key instead.
retryobjectHow failed deliveries are retried.
<ParamField body="url" type="string" required> Where Specly sends the event.</ParamField>
<ParamField query="limit" type="integer" default="10"> How many results to return.</ParamField>
<ResponseField name="retry" type="object"> How failed deliveries are retried.
<Expandable title="child fields"> <ResponseField name="max_age" type="integer" default="259200">Seconds to keep trying.</ResponseField> </Expandable></ResponseField>Field props
Section titled “Field props”ParamField and ResponseField are the same component. Name the field with name, or with the place it goes: path,
query, body or header, which also shows that place beside it.
typestring- The field’s type, shown as given.
requiredboolean- Shows “required”.
deprecatedboolean- Shows “deprecated” and dims the field.
defaultstring- The default value.
prestring[]- Tags shown before the name.
poststring[]- Tags shown after the details.
Expandable props
Section titled “Expandable props”titlestringThe summary reads “Show” or “Hide”, then this text.
defaultOpenboolean- Starts it open.
Request and response examples
Section titled “Request and response examples”RequestExample and ResponseExample hold code blocks. Specly gathers them into a panel in the right-hand column,
beside the text, and each block becomes a tab named by its title or language. The page then drops its table of
contents. The panel is on this page, to the right. On a phone it sits below the text.
curl https://api.yourcompany.dev/events -d '{"url":"https://hooks.yourcompany.dev"}'await fetch('https://api.yourcompany.dev/events', { method: 'POST' });{ "id": "evt_1", "status": "pending" }<RequestExample>
```bash cURLcurl https://api.yourcompany.dev/events -d '{"url":"https://hooks.yourcompany.dev"}'```
```js Nodeawait fetch('https://api.yourcompany.dev/events', { method: 'POST' });```
</RequestExample>
<ResponseExample>
```json 201{ "id": "evt_1", "status": "pending" }```
</ResponseExample>A request’s tabs follow the reader’s language, as a code group does. A response’s tabs, such as status codes, stay its own.
Panel puts any content you choose in the same right-hand column. Use it for something other than code. Place it at
the top level of the page, not inside another component.
<Panel> Anything that belongs beside the text.</Panel>