API Status: Offline
Documentation

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.dev

CRUD 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 record
POST /api/schema/{route}Create a new record
PATCH /api/schema/{route}/:idUpdate an existing record
DELETE /api/schema/{route}/:idDelete a record
QUERY /api/schema/{route}Body-based search & filter

Auto-Generated Fields

Every record automatically includes the following system fields, regardless of your schema definition:

idUUID v4 - unique identifier for each record
createdAtISO 8601 datetime - set when the record is created
updatedAtISO 8601 datetime - updated on every modification
userIdUUID - added only when Mock Auth is enabled and route is protected

Get Single Record

javascript
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

json
{
  "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.

javascript
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

json
{
  "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

javascript
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

json
{
  "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

javascript
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

json
{
  "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 by
order - 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.

javascript
// 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.
javascript
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
<?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

javascript
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

json
{
  "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 by
orderASC or DESC
filters — object of { fieldName: value } pairs (equality match)
format — pass xml for XML output (paid plans)

Route Creator Example

Route Name:posts
Field Configuration:
title
lorem - paragraph
description
lorem - words
slug
lorem - word