Skip to main content

Mock Servers Quickstart

Get realistic API responses from 800+ services. One API key. No sandbox accounts needed.

1. Get your API key

Sign up at app.mokra.ai and copy your API key.
export MOKRA_API_KEY=mk_live_xxxxxxxxxxxxxxxx
This one key gives you access to Stripe, Shopify, SendGrid, and 800+ more services.

2. Install the SDK

gem install mockworld

3. Configure and make API calls

Your code calls real API endpoints. Mokra intercepts and returns realistic responses.
require 'mockworld'

Mockworld.configure do |config|
  config.api_key = ENV['MOKRA_API_KEY']
end

# Make normal API calls — Mokra intercepts them
charge = Stripe::Charge.create(
  amount: 5000,
  currency: "usd",
  source: "tok_visa"
)

puts charge.id       # => "ch_mock_abc123"
puts charge.status   # => "succeeded"
puts charge.amount   # => 5000

4. That’s it

You just got a realistic Stripe response without:
  • A Stripe account
  • Test API keys
  • Sandbox configuration
  • Rate limit concerns
The response has the same structure, fields, and types as the real Stripe API.

Try more services

Same API key works for all services:
# Get an order from Shopify
order = ShopifyAPI::Order.find(id: "123456789")
puts order.total_price       # => "150.00"
puts order.customer.email    # => "customer@example.com"

Stateful behavior

Mock servers maintain state. Create something, then reference it:
# Create a customer
customer = Stripe::Customer.create(email: "ana@example.com")
# => { "id": "cus_mock_abc123", "email": "ana@example.com" }

# Create a payment for that customer
payment = Stripe::PaymentIntent.create(
  amount: 5000,
  currency: "usd",
  customer: customer.id  # References the customer we just created
)
# => { "id": "pi_mock_xyz789", "customer": "cus_mock_abc123", ... }

# Refund the payment
refund = Stripe::Refund.create(payment_intent: payment.id)
# => { "id": "re_mock_qrs456", "payment_intent": "pi_mock_xyz789", ... }
The refund knows about the payment. The payment knows about the customer. Just like production.

What you get

FeatureDescription
One API keyAccess 800+ services
Realistic responsesSame structure as production APIs
StatefulObjects reference each other correctly
No rate limitsTest as fast as you can code
Fresh stateEach test starts clean
Any auth valuesk_test_anything works

Next steps

Building AI agents? Check out MockWorld Tests for observe and assert capabilities.