History
Paginated order and trade history for any authenticated API-key user — including cancelled and currently open orders. Order and trade lists support both offset pagination (page / pageSize) and opaque keyset pagination (cursor / nextCursor). Prefer the cursor: take nextCursor from one response and pass it as cursor to the next. Do not derive “has more” from total alone (total for orders is capped at about 10000).
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/history/orders | Order history |
GET | /api/history/trades | Trade history |
GET | /api/history/orders/cancelled | Cancelled orders |
GET | /api/history/orders/active | Active open orders |
Order history
GET /api/history/orders
Returns paginated order history for the authenticated user.
Request
import axios from 'axios';
const response = await axios.get('https://api.loafmarkets.com/api/history/orders', {
headers: { Authorization: `Bearer ${process.env.LOAF_API_KEY}` },
});
console.log(response.data);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | number | No | (query) Page number (1-based). Default: 1. |
pageSize | number | No | (query) Results per page (1–100). Default: 20. |
cursor | string | No | (query) Opaque keyset cursor from a previous response’s nextCursor. Prefer this over page for stable paging. |
Response
// See @loafmarkets/shared-types for the response type
type Response = Record<string, unknown>;Example response:
{
"success": true
}Errors
| Status | Code | Description |
|---|---|---|
400 | validation_error | Request failed schema validation. |
401 | unauthorized | Missing or invalid authentication. |
404 | not_found | Resource not found (where applicable). |
500 | internal_error | Unexpected server error. |
Requires API key authentication. Prefer cursor pagination: pass the previous nextCursor as cursor. total for orders is capped (~10000) — do not use it alone to decide whether more pages exist.
Trade history
GET /api/history/trades
Returns paginated trade history for the authenticated user.
Request
import axios from 'axios';
const response = await axios.get('https://api.loafmarkets.com/api/history/trades', {
headers: { Authorization: `Bearer ${process.env.LOAF_API_KEY}` },
});
console.log(response.data);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | number | No | (query) Page number (1-based). Default: 1. |
pageSize | number | No | (query) Results per page (1–100). Default: 20. |
cursor | string | No | (query) Opaque keyset cursor from a previous response’s nextCursor. Prefer this over page for stable paging. |
Response
// See @loafmarkets/shared-types for the response type
type Response = Record<string, unknown>;Example response:
{
"success": true
}Errors
| Status | Code | Description |
|---|---|---|
400 | validation_error | Request failed schema validation. |
401 | unauthorized | Missing or invalid authentication. |
404 | not_found | Resource not found (where applicable). |
500 | internal_error | Unexpected server error. |
Requires API key authentication. Prefer cursor pagination: pass the previous nextCursor as cursor.
Cancelled orders
GET /api/history/orders/cancelled
Returns cancelled orders for any authenticated API-key user.
Request
import axios from 'axios';
const response = await axios.get('https://api.loafmarkets.com/api/history/orders/cancelled', {
headers: { Authorization: `Bearer ${process.env.LOAF_API_KEY}` },
});
console.log(response.data);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| None | - | No | No parameters for this endpoint. |
Response
interface CancelledOrdersResponse {
cancelledOrders: unknown[];
}Example response:
{
"cancelledOrders": []
}Errors
| Status | Code | Description |
|---|---|---|
401 | unauthorized | Missing or invalid authentication. |
500 | internal_error | Unexpected server error. |
Requires API key authentication.
Active orders
GET /api/history/orders/active
Returns currently open orders for any authenticated API-key user.
Request
import axios from 'axios';
const response = await axios.get('https://api.loafmarkets.com/api/history/orders/active', {
headers: { Authorization: `Bearer ${process.env.LOAF_API_KEY}` },
});
console.log(response.data);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| None | - | No | No parameters for this endpoint. |
Response
interface ActiveOrdersResponse {
activeOrders: unknown[];
}Example response:
{
"activeOrders": []
}Errors
| Status | Code | Description |
|---|---|---|
401 | unauthorized | Missing or invalid authentication. |
500 | internal_error | Unexpected server error. |
Requires API key authentication.