Skip to main content

Mock Server

Make API requests through Mokra mock servers. Requests are intercepted and return realistic responses.

Request

ANY https://api.mokra.ai/mock/{service}/{path}

URL Parameters

ParameterDescription
serviceService slug (e.g., stripe, shopify)
pathOriginal API path (e.g., v1/charges)

Headers

HeaderRequiredDescription
X-API-KeyYesYour Mokra API key
X-World-IdNoWorld ID for stateful testing

Example: Stripe charge

curl -X POST https://api.mokra.ai/mock/stripe/v1/charges \
  -H "X-API-Key: mk_live_your_key" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "amount=5000&currency=usd"

Response

{
  "id": "ch_mock_abc123",
  "object": "charge",
  "amount": 5000,
  "currency": "usd",
  "status": "succeeded",
  "created": 1710496200,
  "livemode": false
}

Example: Shopify order

curl https://api.mokra.ai/mock/shopify/admin/api/2024-01/orders/123.json \
  -H "X-API-Key: mk_live_your_key"

Response

{
  "order": {
    "id": 123,
    "total_price": "150.00",
    "financial_status": "paid",
    "fulfillment_status": null,
    "created_at": "2024-03-15T10:30:00Z"
  }
}

Stateful requests

To maintain state across requests, include a World ID:
# Create a customer
curl -X POST https://api.mokra.ai/mock/stripe/v1/customers \
  -H "X-API-Key: mk_live_your_key" \
  -H "X-World-Id: world_abc123" \
  -d "email=test@example.com"

# Retrieve the same customer
curl https://api.mokra.ai/mock/stripe/v1/customers/cus_mock_xyz \
  -H "X-API-Key: mk_live_your_key" \
  -H "X-World-Id: world_abc123"

Supported methods

All HTTP methods are supported:
  • GET
  • POST
  • PUT
  • PATCH
  • DELETE

Errors

StatusDescription
401Invalid or missing API key
404Unknown service or endpoint
422Invalid request format