Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.swisstools.dev/llms.txt

Use this file to discover all available pages before exploring further.

API mocks let you define a fake HTTP endpoint — method, path, status code, response headers, and body — that Swisstools serves at a stable subdomain URL. You point your application or tests at that URL during development instead of a real upstream API. Each mock is served at:
https://<team_referenceId>-<project_slug>.swisstools.dev/api/mock/<endpoint>
For example, if your team’s referenceId is aB3cD4eF and your project slug is payments-api, a mock with endpoint /users is reachable at:
https://aB3cD4eF-payments-api.swisstools.dev/api/mock/users
All management endpoints (list, create, update, delete) require session authentication. The mock invocation URL itself is public — no auth needed.

List Mocks

GET /api/projects/:projectId/mocks Returns all mock endpoints defined for the specified project. Path Parameters
projectId
string
required
The UUID of the project.
Request
curl https://swisstools.dev/api/projects/018e5a3b-2d4e-8c9f-a0b1-3c4d5e6f7a8b/mocks \
  -b cookies.txt
Response
[
  {
    "id": "018e6c4d-3e5f-9d0a-b1c2-4d5e6f7a8b9c",
    "projectId": "018e5a3b-2d4e-8c9f-a0b1-3c4d5e6f7a8b",
    "name": "List Users",
    "description": "Returns a paginated list of users.",
    "method": "GET",
    "endpoint": "/users",
    "responseBody": "[{\"id\": 1, \"name\": \"Alice\"}, {\"id\": 2, \"name\": \"Bob\"}]",
    "responseHeaders": {"Content-Type": "application/json"},
    "statusCode": 200,
    "createdAt": "2024-02-10T11:00:00.000Z",
    "updatedAt": "2024-02-10T11:00:00.000Z"
  }
]

Create Mock

POST /api/projects/:projectId/mocks Creates a new mock endpoint for the project. Path Parameters
projectId
string
required
The UUID of the project.
Request Body
name
string
required
A human-readable name for the mock, used in the dashboard.
method
string
required
The HTTP method this mock responds to. Accepted values: GET, POST, PUT, PATCH, DELETE. Defaults to GET.
endpoint
string
required
The path this mock handles, relative to /api/mock/. For example, /users or /orders/123.
responseBody
string
required
The raw response body to return. JSON must be provided as a string. Defaults to {}.
responseHeaders
object
Key-value pairs of HTTP response headers. Defaults to an empty object.
statusCode
integer
The HTTP status code the mock returns. Defaults to 200.
description
string
An optional description of what this mock simulates.
Request
curl -X POST https://swisstools.dev/api/projects/018e5a3b-2d4e-8c9f-a0b1-3c4d5e6f7a8b/mocks \
  -b cookies.txt \
  -H "Content-Type: application/json" \
  -d '{
    "name": "List Users",
    "method": "GET",
    "endpoint": "/users",
    "responseBody": "[{\"id\": 1, \"name\": \"Alice\"}]",
    "responseHeaders": {"Content-Type": "application/json"},
    "statusCode": 200,
    "description": "Returns a list of users."
  }'
Response201 Created
{
  "id": "018e6c4d-3e5f-9d0a-b1c2-4d5e6f7a8b9c",
  "projectId": "018e5a3b-2d4e-8c9f-a0b1-3c4d5e6f7a8b",
  "name": "List Users",
  "description": "Returns a list of users.",
  "method": "GET",
  "endpoint": "/users",
  "responseBody": "[{\"id\": 1, \"name\": \"Alice\"}]",
  "responseHeaders": {"Content-Type": "application/json"},
  "statusCode": 200,
  "createdAt": "2024-02-10T11:00:00.000Z",
  "updatedAt": "2024-02-10T11:00:00.000Z"
}

Get Mock

GET /api/projects/:projectId/mocks/:mockId Returns a single mock endpoint by its ID. Path Parameters
projectId
string
required
The UUID of the project.
mockId
string
required
The UUID of the mock.
Request
curl https://swisstools.dev/api/projects/018e5a3b-2d4e-8c9f-a0b1-3c4d5e6f7a8b/mocks/018e6c4d-3e5f-9d0a-b1c2-4d5e6f7a8b9c \
  -b cookies.txt
Response
{
  "id": "018e6c4d-3e5f-9d0a-b1c2-4d5e6f7a8b9c",
  "projectId": "018e5a3b-2d4e-8c9f-a0b1-3c4d5e6f7a8b",
  "name": "List Users",
  "description": "Returns a list of users.",
  "method": "GET",
  "endpoint": "/users",
  "responseBody": "[{\"id\": 1, \"name\": \"Alice\"}]",
  "responseHeaders": {"Content-Type": "application/json"},
  "statusCode": 200,
  "createdAt": "2024-02-10T11:00:00.000Z",
  "updatedAt": "2024-02-10T11:00:00.000Z"
}

Update Mock

PUT /api/projects/:projectId/mocks/:mockId Updates one or more fields of an existing mock endpoint. Path Parameters
projectId
string
required
The UUID of the project.
mockId
string
required
The UUID of the mock to update.
Request Body
name
string
Updated display name.
method
string
Updated HTTP method.
endpoint
string
Updated endpoint path.
responseBody
string
Updated response body string.
responseHeaders
object
Updated response headers.
statusCode
integer
Updated HTTP status code.
description
string
Updated description.
Request
curl -X PUT https://swisstools.dev/api/projects/018e5a3b-2d4e-8c9f-a0b1-3c4d5e6f7a8b/mocks/018e6c4d-3e5f-9d0a-b1c2-4d5e6f7a8b9c \
  -b cookies.txt \
  -H "Content-Type: application/json" \
  -d '{
    "statusCode": 404,
    "responseBody": "{\"error\": \"User not found\"}"
  }'
Response
{
  "id": "018e6c4d-3e5f-9d0a-b1c2-4d5e6f7a8b9c",
  "projectId": "018e5a3b-2d4e-8c9f-a0b1-3c4d5e6f7a8b",
  "name": "List Users",
  "description": "Returns a list of users.",
  "method": "GET",
  "endpoint": "/users",
  "responseBody": "{\"error\": \"User not found\"}",
  "responseHeaders": {"Content-Type": "application/json"},
  "statusCode": 404,
  "createdAt": "2024-02-10T11:00:00.000Z",
  "updatedAt": "2024-03-01T08:15:00.000Z"
}

Delete Mock

DELETE /api/projects/:projectId/mocks/:mockId Permanently removes a mock endpoint. Path Parameters
projectId
string
required
The UUID of the project.
mockId
string
required
The UUID of the mock to delete.
Request
curl -X DELETE https://swisstools.dev/api/projects/018e5a3b-2d4e-8c9f-a0b1-3c4d5e6f7a8b/mocks/018e6c4d-3e5f-9d0a-b1c2-4d5e6f7a8b9c \
  -b cookies.txt
Response
{"success": true}

Mock Object

id
string
UUID that uniquely identifies the mock.
projectId
string
UUID of the project that owns this mock.
name
string
Display name shown in the dashboard.
description
string
Optional description of what this mock simulates.
method
string
HTTP method this mock responds to (GET, POST, PUT, PATCH, DELETE).
endpoint
string
The path relative to /api/mock/ at which this mock is served on the subdomain.
responseBody
string
The raw string returned as the response body when the mock is invoked.
responseHeaders
object
Key-value HTTP response headers returned when the mock is invoked.
statusCode
integer
HTTP status code returned when the mock is invoked.
createdAt
string
ISO 8601 timestamp of creation.
updatedAt
string
ISO 8601 timestamp of the last update.