note
This rune is part of @refrakt-md/docs. Install with npm install @refrakt-md/docs and add "@refrakt-md/docs" to the packages array in your refrakt.config.json.
API
API endpoint documentation. Headings become the endpoint title, tables become parameter lists, code blocks become request/response examples, and blockquotes become notes.
GET endpoint
A basic GET endpoint with query parameters and a JSON response example.
{% api method="GET" path="/api/users" auth="Bearer token" %}
## List Users
Returns a paginated list of users. Requires authentication.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| page | number | no | Page number (default: 1) |
| limit | number | no | Items per page (default: 20) |
| sort | string | no | Sort field |
```json
{
"users": [
{ "id": 1, "name": "Alice", "email": "[email protected]" }
],
"total": 42,
"page": 1
}
```
> Rate limited to 100 requests per minute per API key.
{% /api %}<article data-rune="api">
<meta content="GET" data-field="method">
<meta content="/api/users" data-field="path">
<meta content="Bearer token" data-field="auth">
<div data-name="body">
<h2 id="list-users">List Users</h2>
<p>Returns a paginated list of users. Requires authentication.</p>
<div class="rf-table-wrapper">
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Required</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>page</td>
<td>number</td>
<td>no</td>
<td>Page number (default: 1)</td>
</tr>
<tr>
<td>limit</td>
<td>number</td>
<td>no</td>
<td>Items per page (default: 20)</td>
</tr>
<tr>
<td>sort</td>
<td>string</td>
<td>no</td>
<td>Sort field</td>
</tr>
</tbody>
</table>
</div>
<div class="rf-codeblock">
<pre data-language="json">
<code data-language="json">{
"users": [
{ "id": 1, "name": "Alice", "email": "[email protected]" }
],
"total": 42,
"page": 1
}
</code>
</pre>
</div>
<blockquote>
<p>Rate limited to 100 requests per minute per API key.</p>
</blockquote>
</div>
</article>GET
/api/usersBearer tokenList Users
Returns a paginated list of users. Requires authentication.
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | number | no | Page number (default: 1) |
| limit | number | no | Items per page (default: 20) |
| sort | string | no | Sort field |
{
"users": [
{ "id": 1, "name": "Alice", "email": "[email protected]" }
],
"total": 42,
"page": 1
}
Rate limited to 100 requests per minute per API key.
<article class="rf-api rf-api--GET rf-api--/api/users rf-api--Bearer token" data-method="GET" data-path="/api/users" data-auth="Bearer token" data-rune="api" data-density="full">
<div data-name="header" class="rf-api__header" data-section="header">
<span data-name="method" data-meta-type="category" data-meta-rank="primary" data-meta-sentiment="positive" class="rf-api__method">GET</span>
<code data-name="path" class="rf-api__path">/api/users</code>
<span data-name="auth" data-meta-type="status" data-meta-rank="secondary" class="rf-api__auth">Bearer token</span>
</div>
<div data-name="body" class="rf-api__body" data-section="body">
<meta content="GET" data-field="method" />
<meta content="/api/users" data-field="path" />
<meta content="Bearer token" data-field="auth" />
<div data-name="body" class="rf-api__body" data-section="body">
<h2 id="list-users">List Users</h2>
<p>Returns a paginated list of users. Requires authentication.</p>
<div class="rf-table-wrapper">
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Required</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>page</td>
<td>number</td>
<td>no</td>
<td>Page number (default: 1)</td>
</tr>
<tr>
<td>limit</td>
<td>number</td>
<td>no</td>
<td>Items per page (default: 20)</td>
</tr>
<tr>
<td>sort</td>
<td>string</td>
<td>no</td>
<td>Sort field</td>
</tr>
</tbody>
</table>
</div>
<div class="rf-codeblock">
<pre data-language="json"><code data-language="json">{
"users": [
{ "id": 1, "name": "Alice", "email": "[email protected]" }
],
"total": 42,
"page": 1
}
</code></pre>
</div>
<blockquote>
<p>Rate limited to 100 requests per minute per API key.</p>
</blockquote>
</div>
</div>
</article>POST endpoint
A POST endpoint with a request body and response example.
{% api method="POST" path="/api/users" auth="Bearer token" %}
## Create User
Creates a new user account.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| name | string | yes | User's full name |
| email | string | yes | Email address |
| role | string | no | User role (default: "member") |
```json
{
"id": 2,
"name": "Bob",
"email": "[email protected]",
"role": "member"
}
```
{% /api %}<article data-rune="api">
<meta content="POST" data-field="method">
<meta content="/api/users" data-field="path">
<meta content="Bearer token" data-field="auth">
<div data-name="body">
<h2 id="create-user">Create User</h2>
<p>Creates a new user account.</p>
<div class="rf-table-wrapper">
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Required</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td>string</td>
<td>yes</td>
<td>User's full name</td>
</tr>
<tr>
<td>email</td>
<td>string</td>
<td>yes</td>
<td>Email address</td>
</tr>
<tr>
<td>role</td>
<td>string</td>
<td>no</td>
<td>User role (default: "member")</td>
</tr>
</tbody>
</table>
</div>
<div class="rf-codeblock">
<pre data-language="json">
<code data-language="json">{
"id": 2,
"name": "Bob",
"email": "[email protected]",
"role": "member"
}
</code>
</pre>
</div>
</div>
</article>POST
/api/usersBearer tokenCreate User
Creates a new user account.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | yes | User's full name |
| string | yes | Email address | |
| role | string | no | User role (default: "member") |
{
"id": 2,
"name": "Bob",
"email": "[email protected]",
"role": "member"
}
<article class="rf-api rf-api--POST rf-api--/api/users rf-api--Bearer token" data-method="POST" data-path="/api/users" data-auth="Bearer token" data-rune="api" data-density="full">
<div data-name="header" class="rf-api__header" data-section="header">
<span data-name="method" data-meta-type="category" data-meta-rank="primary" data-meta-sentiment="neutral" class="rf-api__method">POST</span>
<code data-name="path" class="rf-api__path">/api/users</code>
<span data-name="auth" data-meta-type="status" data-meta-rank="secondary" class="rf-api__auth">Bearer token</span>
</div>
<div data-name="body" class="rf-api__body" data-section="body">
<meta content="POST" data-field="method" />
<meta content="/api/users" data-field="path" />
<meta content="Bearer token" data-field="auth" />
<div data-name="body" class="rf-api__body" data-section="body">
<h2 id="create-user">Create User</h2>
<p>Creates a new user account.</p>
<div class="rf-table-wrapper">
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Required</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td>string</td>
<td>yes</td>
<td>User's full name</td>
</tr>
<tr>
<td>email</td>
<td>string</td>
<td>yes</td>
<td>Email address</td>
</tr>
<tr>
<td>role</td>
<td>string</td>
<td>no</td>
<td>User role (default: "member")</td>
</tr>
</tbody>
</table>
</div>
<div class="rf-codeblock">
<pre data-language="json"><code data-language="json">{
"id": 2,
"name": "Bob",
"email": "[email protected]",
"role": "member"
}
</code></pre>
</div>
</div>
</div>
</article>Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
method | string | GET | HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS |
path | string | — | Endpoint path (required) |
auth | string | — | Authentication requirement |
Common attributes
All block runes share these attributes for layout and theming.
| Attribute | Type | Default | Description |
|---|---|---|---|
width | string | content | Page grid width: content, wide, or full |
spacing | string | — | Vertical spacing: flush, tight, default, loose, or breathe |
inset | string | — | Horizontal padding: flush, tight, default, loose, or breathe |
tint | string | — | Named colour tint from theme configuration |
tint-mode | string | auto | Colour scheme override: auto, dark, or light |
bg | string | — | Named background preset from theme configuration |