Skip to content

// DOCUMENTATION

Mock Responses

Define response variants and execute them through the authenticated cloud mock runtime.

Create response variants

Add several named variants to an operation so success and failure behavior can coexist.

  • Give variants descriptive names.
  • Match the status to the scenario.
  • Use valid JSON bodies where the content type requires it.

Variant fields

A mock response variant can include a status code, response headers, body and delay. Delays help document timing-dependent interface states.

Name: Card declined
Status: 422
Delay: 300 ms
Body: { "code": "card_declined" }

Cloud mock runtime

Call /api/public/v1/mock/{workspaceId}/{path} with the workspace mock server key. Select a named variant with X-Rest-Test-Mock or the __mock query parameter. Anonymous mocks and arbitrary scripts are not supported.

// GET STARTED

Bring your API workflow into one workspace.

Start with an OpenAPI or Swagger JSON definition and keep the workflow together.

Start for free