Loutre
v1.0.0Hosted mock APIs from OpenAPI, TypeScript or Postman: realistic data, errors and latency on demand.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
create_mock
Create a hosted mock from an OpenAPI 3.0/3.1 or Swagger 2.0 document (YAML or JSON), from TypeScript types (interfaces, types, enums: CRUD routes derived, or a route map type keyed like "GET /users") or from a Postman v2 collection, an Insomnia export (v4 JSON or v5 YAML), a Bruno collection (JSON export, or .bru files one after the other), a HAR file (headers and cookies are dropped, data is generated), a json-server db.json (records served as they are), curl commands, or a GraphQL schema (SDL or introspection JSON; Pro plan: queries, mutations and introspection answered on POST /graphql). Op…
| Parameter | Type | Description |
|---|---|---|
auto | boolean | With url: re-read every six hours (default true) |
locale | string | Language of names, addresses, texts and error messages (default: the request's language, else English) |
seed | string | Data seed, for reproducible data sets |
slug | string | Desired subdomain (Pro plan) |
spec | string | The full document, verbatim: OpenAPI, Swagger, TypeScript types, a Postman, Insomnia or Bruno collection, a HAR file, a db.json or curl commands |
url | string | Public URL of the document, instead of spec |
list_mocks
List the connected account's mocks (API token required), with their URL, routes and expiry.
get_mock
Details of a mock: routes with identifiers, behaviour, lock, sample generated bodies per route.
| Parameter | Type | Description |
|---|---|---|
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
call_mock
Call a route of the mock like an HTTP client would and return the status, the x-loutre-* headers and the body. The headers x-loutre-status, x-loutre-delay, x-loutre-count, x-loutre-message and x-loutre-seed are honoured; latency is not awaited, it is reported in delayMs. Writes (POST, PUT, PATCH, DELETE) are persisted when persistent state is on. For a GraphQL mock, POST to its GraphQL path with the body { "query": "…", "variables": { … } }; mutations are persisted the same way.
| Parameter | Type | Description |
|---|---|---|
method * | string | |
path * | string | Path with its query string: "/users/42?expand=orders" |
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
accessKey | string | Access key (lk_…) of a private mock you do not own |
body | JSON body for POST, PUT, PATCH | |
headers | object | Request headers, including x-loutre-* |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
set_behavior
Change a mock's behaviour: default status, latency, jitter, error rate, persistent writes, and per route status, latency, hand-written bodies, rules. Merge semantics: missing keys are kept, null clears.
| Parameter | Type | Description |
|---|---|---|
patch * | object | Same fields as PATCH /mocks/:slug/behavior: a missing key is kept, null clears |
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
set_response
Set the JSON body a route returns for a given status (hand-written response); a null body restores the generated response.
| Parameter | Type | Description |
|---|---|---|
body * | JSON body, or null to go back to the generated response | |
route * | string | Route identifier, lowercase method: "get:/users/{id}" |
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
status * | integer | |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
add_rule
Add a conditional response to a route: when the request matches the conditions (query, header, path param, body field), the mock answers with this status, body and latency. Rules are evaluated in order, the first match wins; x-loutre-* headers keep priority.
| Parameter | Type | Description |
|---|---|---|
route * | string | Route identifier, lowercase method: "get:/users/{id}" |
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
when * | object | Every condition must hold |
body | JSON body of the response | |
latencyMs | number | |
name | string | Human-readable label of the rule |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
status | integer |
clear_rules
Remove every conditional rule of a route.
| Parameter | Type | Description |
|---|---|---|
route * | string | Route identifier, lowercase method: "get:/users/{id}" |
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
regenerate_mock
Generate a new data set (new seed), for the whole mock or for one route and the routes sharing its collection. A full new set forgets persisted writes.
| Parameter | Type | Description |
|---|---|---|
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
locale | string | Switch the data language (whole mock only) |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
routeId | string | Route identifier, lowercase method: "get:/users/{id}" |
seed | string |
get_requests
The latest requests received by the mock, most recent first: method, path, query, status, headers and body as received (body cut at 8 KB), where the answer came from, latency. Each entry has an id for replay_request.
| Parameter | Type | Description |
|---|---|---|
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
limit | integer | |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
replay_request
Replay a request from the log exactly as it was received (same method, path, headers and body) against the mock as it is now, and return the answer. Useful after changing a rule, a body or a scenario.
| Parameter | Type | Description |
|---|---|---|
id * | string | Entry id from get_requests |
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
clear_requests
Empty the mock's request log.
| Parameter | Type | Description |
|---|---|---|
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
sync_mock
Re-read the schema at the mock's source URL now and update the mock if it changed (routes, fields; settings kept, persisted writes forgotten). force regenerates even when the document is unchanged.
| Parameter | Type | Description |
|---|---|---|
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
force | boolean | |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
set_domain
Serve the mock under the account's own hostname (Pro): declares it at Cloudflare and returns the CNAME to create (hostname → target) plus the current status; call again without hostname to re-check, or with hostname null to remove it.
| Parameter | Type | Description |
|---|---|---|
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
hostname | e.g. mock.acme.com; null removes; omitted re-checks the status | |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
reset_state
Forget persisted writes (POST, PUT, PATCH, DELETE): the generated collections come back as they were.
| Parameter | Type | Description |
|---|---|---|
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
set_access
Lock a mock with a token (private) and/or restrict the allowed browser origins. Pro plan.
| Parameter | Type | Description |
|---|---|---|
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
origins | Allowed origins (https://app.example.com); null to allow all | |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |
private | boolean |
delete_mock
Permanently delete a mock and its kept schema.
| Parameter | Type | Description |
|---|---|---|
slug * | string | Subdomain of the mock, e.g. "brisk-otter" |
ownerToken | string | Owner token received at creation (not needed when the account is connected with an API token) |