API Endpoints
Your custom endpoints are generated based on your route configuration. Rest Faker provides full CRUD operations for every route you create.
Base URL
https://api.restfaker.devCRUD Endpoints
Where {route} is the name you defined in the Route Creator (e.g., "posts", "users", "products").
GET /api/schema/{route}List all records (paginated)GET /api/schema/{route}/:idGet a single recordPOST /api/schema/{route}Create a new recordPATCH /api/schema/{route}/:idUpdate an existing recordDELETE /api/schema/{route}/:idDelete a recordQUERY /api/schema/{route}Body-based search & filterAuto-Generated Fields
Every record automatically includes the following system fields, regardless of your schema definition:
idUUID v4 - unique identifier for each recordcreatedAtISO 8601 datetime - set when the record is createdupdatedAtISO 8601 datetime - updated on every modificationuserIdUUID - added only when Mock Auth is enabled and route is protectedGet Single Record
fetch('https://api.restfaker.dev/api/schema/posts/d9c03940-8451-4c3e-944f-6ddfd23390f6', {
headers: {
'apiToken': 'your_api_token_here',
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => console.log(data));Response
{
"id": "d9c03940-8451-4c3e-944f-6ddfd23390f6",
"title": "Lorem ipsum dolor sit amet",
"description": "Consectetur adipiscing elit...",
"createdAt": "2025-01-15T10:30:00Z",
"updatedAt": "2025-01-15T10:30:00Z"
}Create Record
The request body must be wrapped in a data key.
fetch('https://api.restfaker.dev/api/schema/posts', {
method: 'POST',
headers: {
'apiToken': 'your_api_token_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
title: 'My New Post',
description: 'This is the post content.',
slug: 'my-new-post'
}
})
})
.then(response => response.json())
.then(data => console.log(data));Response
{
"id": "a1b2c3d4-...",
"title": "My New Post",
"description": "This is the post content.",
"slug": "my-new-post",
"createdAt": "2025-01-15T12:00:00Z",
"updatedAt": "2025-01-15T12:00:00Z"
}Update Record
fetch('https://api.restfaker.dev/api/schema/posts/d9c03940-8451-4c3e-944f-6ddfd23390f6', {
method: 'PATCH',
headers: {
'apiToken': 'your_api_token_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Updated Post Title'
})
})
.then(response => response.json())
.then(data => console.log(data));Response
{
"id": "d9c03940-8451-4c3e-944f-6ddfd23390f6",
"title": "Updated Post Title",
"description": "Original description...",
"slug": "lorem-ipsum-dolor-sit-amet",
"createdAt": "2025-01-15T10:30:00Z",
"updatedAt": "2025-01-15T14:00:00Z"
}Delete Record
fetch('https://api.restfaker.dev/api/schema/posts/d9c03940-8451-4c3e-944f-6ddfd23390f6', {
method: 'DELETE',
headers: {
'apiToken': 'your_api_token_here',
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => console.log(data));Response
{
"success": true,
"message": "Record deleted successfully"
}Query Parameters
The list endpoint (GET /api/schema/{route}) supports the following query parameters:
Pagination
page - Page number (default: 1)perPage - Items per page (default: 10, max: 100)Sorting
sort - Field name to sort byorder - Sort direction (asc, desc)Field Filtering
Pass any schema field name as a query parameter to filter results by exact match. Reserved params (page, perPage, sort, order, format) are never treated as filters.
// Filter users by firstName and role
fetch('https://api.restfaker.dev/api/schema/users?firstName=John&role=admin', {
headers: { 'apiToken': 'your_api_token_here' }
})
.then(r => r.json())
.then(data => console.log(data));Response FormatPremium
format - Response format. Pass xml to receive XML instead of JSON. Requires a paid plan.fetch('https://api.restfaker.dev/api/schema/posts?format=xml', {
headers: {
'apiToken': 'your_api_token_here',
'Content-Type': 'application/json'
}
})
.then(response => response.text())
.then(xml => console.log(xml));Response
<?xml version="1.0" encoding="UTF-8"?>
<response>
<data>
<item>
<id>d9c03940-8451-4c3e-944f-6ddfd23390f6</id>
<title>Lorem ipsum dolor sit amet</title>
<createdAt>2025-01-15T10:30:00Z</createdAt>
</item>
</data>
<meta>
<total>50</total>
<page>1</page>
<perPage>10</perPage>
<pages>5</pages>
</meta>
</response>HTTP QUERY MethodNew
Every route also supports the QUERY HTTP method — a safe, idempotent request (like GET) that carries filter and pagination criteria in a JSON body instead of the URL. Useful when your filter conditions are too complex or too long for query params.
Request
fetch('https://api.restfaker.dev/api/schema/users', {
method: 'QUERY',
headers: {
'apiToken': 'your_api_token_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
page: 1,
perPage: 10,
sort: 'firstName',
order: 'ASC',
filters: {
role: 'admin',
status: 'active'
}
})
})
.then(r => r.json())
.then(data => console.log(data));Response — same shape as GET
{
"data": [
{ "id": "...", "firstName": "John", "role": "admin", "status": "active" }
],
"meta": {
"total": 3,
"page": 1,
"perPage": 10,
"pages": 1
}
}Body fields
page — page number (default: 1)perPage — items per page (default: 25)sort — field name to sort byorder — ASC or DESCfilters — object of { fieldName: value } pairs (equality match)format — pass xml for XML output (paid plans)Route Creator Example
posts