Mock servers

A mock server answers HTTP calls with the example responses saved on a collection's requests. Point a frontend, a mobile app or a test at it while the real API is still being built, or when you don't want to hit it.

Output
https://mock.requestarium.com/m_8f3k2x9q1z/users/42

1. Save example responses

Send a request, then click Save as example in the response header. Requestarium keeps the status code, the body and the headers worth replaying (not Set-Cookie, Content-Length, Date and other per-transfer headers). Save as many as you need, for example 200 OK and 404 Not found; a request holds up to 20 examples of up to 1 MB each.

Examples also arrive with imports: Postman response items and OpenAPI response examples become saved examples.

The saved examples of a request are listed under Docs ▸ Example responses. Expand one to see its headers and body, make it the default, or delete it.

2. Create a mock server

Open the collection, go to Mocks and click Create mock server. Copy the URL or a ready curl line.

3. Call it

The path after the mock's id is matched to a request of the collection by method and path:

Request URL in the collectionMatches
{{baseUrl}}/users/:idGET /users/42, GET /users/abc
{{baseUrl}}/users/{id}/ordersGET /users/42/orders
{{baseUrl}}/users/meGET /users/me (a fixed segment wins over a parameter)

The host and the query string of the saved URL are ignored, and so are those of the call.

Which example answers:

  1. the one named in the x-mock-response-name header, or with the status in x-mock-response-code;
  2. otherwise the default example;
  3. otherwise the first 2xx example, then the first one.
Terminal
curl https://mock.requestarium.com/m_8f3k2x9q1z/users/42
curl https://mock.requestarium.com/m_8f3k2x9q1z/users/42 -H "x-mock-response-code: 404"

Mock servers answer browsers on any origin (CORS is open), so a web app on localhost can call them directly.

Private mock servers and delays

On Pro and Team a mock server can be private: calls must send its key in the x-api-key header. The key is shown once, when you create the mock server or make it private; New key replaces it. Paid plans can also add a delay of up to 10 seconds before every answer, to try loading states.

Terminal
curl https://mock.requestarium.com/m_8f3k2x9q1z/users/42 -H "x-api-key: rqm_..."

Limits

PlanCalls per monthMock servers per collectionCalls per minuteExample bodyPrivate, delay
Free10,000160256 KBno
Pro500,000unlimited3001 MByes
Team5,000,000unlimited1,0001 MByes

Calls are counted per organization per calendar month (UTC); the Mocks tab shows this month's count. Every call that reaches a mock server counts, including ones that match no request.

Errors are JSON, {"error": "...", "message": "..."}: 404 when nothing matches, 401 for a missing or wrong key, 429 when a limit is reached (with Retry-After), 403 for an example body over the plan's size.

Good to know

  • Deleting a mock server, or the collection, stops its URL at once. Restoring the collection from the trash does not

bring the mock server back; create a new one.

  • Responses carry Content-Security-Policy: sandbox and never set cookies.
  • Self-hosted installations serve mock servers at https://<your API host>/mock/<id>/..., or on their own host with

TAIRI_MOCK_HOST.