Loutre

v1.0.0
app.loutre/loutre Checked 19 hours ago Published 1 month ago

Hosted 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…

ParameterTypeDescription
autobooleanWith url: re-read every six hours (default true)
localestringLanguage of names, addresses, texts and error messages (default: the request's language, else English)
seedstringData seed, for reproducible data sets
slugstringDesired subdomain (Pro plan)
specstringThe full document, verbatim: OpenAPI, Swagger, TypeScript types, a Postman, Insomnia or Bruno collection, a HAR file, a db.json or curl commands
urlstringPublic 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.

ParameterTypeDescription
slug *stringSubdomain of the mock, e.g. "brisk-otter"
ownerTokenstringOwner 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.

ParameterTypeDescription
method *string
path *stringPath with its query string: "/users/42?expand=orders"
slug *stringSubdomain of the mock, e.g. "brisk-otter"
accessKeystringAccess key (lk_…) of a private mock you do not own
bodyJSON body for POST, PUT, PATCH
headersobjectRequest headers, including x-loutre-*
ownerTokenstringOwner 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.

ParameterTypeDescription
patch *objectSame fields as PATCH /mocks/:slug/behavior: a missing key is kept, null clears
slug *stringSubdomain of the mock, e.g. "brisk-otter"
ownerTokenstringOwner 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.

ParameterTypeDescription
body *JSON body, or null to go back to the generated response
route *stringRoute identifier, lowercase method: "get:/users/{id}"
slug *stringSubdomain of the mock, e.g. "brisk-otter"
status *integer
ownerTokenstringOwner 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.

ParameterTypeDescription
route *stringRoute identifier, lowercase method: "get:/users/{id}"
slug *stringSubdomain of the mock, e.g. "brisk-otter"
when *objectEvery condition must hold
bodyJSON body of the response
latencyMsnumber
namestringHuman-readable label of the rule
ownerTokenstringOwner token received at creation (not needed when the account is connected with an API token)
statusinteger

clear_rules

Remove every conditional rule of a route.

ParameterTypeDescription
route *stringRoute identifier, lowercase method: "get:/users/{id}"
slug *stringSubdomain of the mock, e.g. "brisk-otter"
ownerTokenstringOwner 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.

ParameterTypeDescription
slug *stringSubdomain of the mock, e.g. "brisk-otter"
localestringSwitch the data language (whole mock only)
ownerTokenstringOwner token received at creation (not needed when the account is connected with an API token)
routeIdstringRoute identifier, lowercase method: "get:/users/{id}"
seedstring

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.

ParameterTypeDescription
slug *stringSubdomain of the mock, e.g. "brisk-otter"
limitinteger
ownerTokenstringOwner 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.

ParameterTypeDescription
id *stringEntry id from get_requests
slug *stringSubdomain of the mock, e.g. "brisk-otter"
ownerTokenstringOwner token received at creation (not needed when the account is connected with an API token)

clear_requests

Empty the mock's request log.

ParameterTypeDescription
slug *stringSubdomain of the mock, e.g. "brisk-otter"
ownerTokenstringOwner 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.

ParameterTypeDescription
slug *stringSubdomain of the mock, e.g. "brisk-otter"
forceboolean
ownerTokenstringOwner 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.

ParameterTypeDescription
slug *stringSubdomain of the mock, e.g. "brisk-otter"
hostnamee.g. mock.acme.com; null removes; omitted re-checks the status
ownerTokenstringOwner 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.

ParameterTypeDescription
slug *stringSubdomain of the mock, e.g. "brisk-otter"
ownerTokenstringOwner 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.

ParameterTypeDescription
slug *stringSubdomain of the mock, e.g. "brisk-otter"
originsAllowed origins (https://app.example.com); null to allow all
ownerTokenstringOwner token received at creation (not needed when the account is connected with an API token)
privateboolean

delete_mock

Permanently delete a mock and its kept schema.

ParameterTypeDescription
slug *stringSubdomain of the mock, e.g. "brisk-otter"
ownerTokenstringOwner token received at creation (not needed when the account is connected with an API token)