Skip to main content
MockServer maintains four types of internal state:
  • Recorded requests — every request received, whether or not it matched an expectation
  • Recorded expectations — expectations captured from proxied traffic
  • Active expectations — expectations currently registered and eligible to match
  • Logs — structured log entries for all major actions
Use the endpoints below to inspect and manage this state.

PUT /mockserver/retrieve

Retrieve recorded requests, expectations, or log entries. Use the type query parameter to select what to retrieve, and the optional format parameter to control the output format. Returns: 200 OK with a JSON array (or log text) in the response body.

Query parameters

Request body (optional)

Pass a request matcher object as the body to filter results. MockServer returns only the items that match. Omit the body to retrieve everything.

Retrieve all recorded requests

Retrieve requests filtered by path and method

Retrieve recorded requests and responses

Retrieve recorded expectations (from proxy traffic)

Retrieve active expectations

Filtered by request properties:

Retrieve log entries

Filtered:
Recorded expectations are populated only when MockServer is running in proxy mode and has forwarded requests. They represent what the real upstream server responded with, ready to be replayed as mocked expectations.

PUT /mockserver/clear

Clear recorded requests, active expectations, and/or logs. Use the type query parameter to select what to clear and an optional request matcher or expectation ID to narrow the scope. Returns: 200 OK on success.

Query parameter

Clear everything matching a path

Clear logs only (keep expectations)

Clear all recorded requests and logs

Clear expectations only

Clear by OpenAPI operation

Clear by expectation ID

When the log level is set to DEBUG, clearing logs marks entries as deleted rather than removing them. This preserves the audit trail for verification and the UI, but the entries no longer affect verification results.

PUT /mockserver/reset

Remove all state from MockServer: recorded requests, active expectations, recorded expectations, and logs. Returns: 200 OK. No request body is required.
Reset removes everything with no ability to recover. Use clear if you need selective removal.

PUT /mockserver/status

Return the ports MockServer is currently listening on. Returns: 200 OK with a JSON object.
Response:
No request body is required.

PUT /mockserver/bind

Bind MockServer to one or more additional ports at runtime. Pass 0 to have the OS assign a free port. Returns: 200 OK with a JSON object listing all ports now bound (including pre-existing ones).

Bind to specific ports

Bind to free ports (OS-assigned)

Response:
Ports bound via this endpoint persist only for the lifetime of the MockServer process. They are not saved to configuration.