Quickmock API documentation

Create one endpoint or a complete multi-route mock workspace through the JSON API. Every example below is copy-pasteable and uses the same contract as the web builder.

Download OpenAPI 3.1 specification

Create a mock

POST /api/mocks returns the public URL and a one-time admin_token. Keep that token: updates, deletes and private logs require it as a Bearer token.

curl -X POST https://quickmock.dev/api/mocks \
  -H 'Content-Type: application/json' \
  -d '{"method":"GET","response_status":200,"content_type":"application/json","response_body":"{\"ok\":true}","ttl_seconds":604800}'

Named response variants

Variants make edge cases deterministic. Select one with X-Quickmock-Variant or __quickmock_variant; an unknown name falls back to normal matching.

"response_variants": [
  {"name":"not-found","status":404,"body":"{\"error\":\"not found\"}"}
]

curl -H 'X-Quickmock-Variant: not-found' https://quickmock.dev/m/<slug>
curl 'https://quickmock.dev/m/<slug>?__quickmock_variant=not-found'

Conditional response rules

Rules run in order and the first complete match wins. Sources: method, path, query, header and JSON body paths. Operators: equals, not_equals, contains and exists.

"response_rules": [{
  "name":"missing user",
  "variant":"not-found",
  "conditions":[{"source":"query","key":"id","operator":"equals","value":"missing"}]
}]

Multi-route workspaces

A single slug can expose up to 50 method + path routes. OpenAPI-style path placeholders such as {id} match one segment.

"routes": [
  {"method":"GET","path":"/users/{id}","response_status":200,"content_type":"application/json","response_body":"{\"id\":1}"},
  {"method":"POST","path":"/users","response_status":201,"content_type":"application/json","response_body":"{\"created\":true}"}
]

Inspector privacy

Request logs are private by default. Choose whether bodies and sender IPs are retained; common credential headers are always redacted.

"logs_public": false,
"capture_body": true,
"capture_ip": false