Skip to main content
POST
/
worlds
Create World
curl --request POST \
  --url https://api.example.com/worlds

Create World

Create a new MockWorld with specified services.

Request

POST https://api.mokra.ai/api/worlds

Headers

HeaderRequiredDescription
X-API-KeyYesYour Mokra API key
Content-TypeYesapplication/json

Body

{
  "name": "My test",
  "services": ["stripe", "shopify", "sendgrid"]
}
FieldTypeRequiredDescription
namestringYesName for the world (for logging)
servicesarrayYesList of service slugs to include

Response

{
  "id": "world_abc123",
  "name": "My test",
  "created_at": "2024-03-15T10:30:00Z",
  "mock_servers": {
    "stripe": {
      "id": "ms_stripe_xyz",
      "service": "stripe",
      "base_url": "https://api.mokra.ai/mock/stripe"
    },
    "shopify": {
      "id": "ms_shopify_abc",
      "service": "shopify",
      "base_url": "https://api.mokra.ai/mock/shopify"
    },
    "sendgrid": {
      "id": "ms_sendgrid_def",
      "service": "sendgrid",
      "base_url": "https://api.mokra.ai/mock/sendgrid"
    }
  }
}

Example

curl -X POST https://api.mokra.ai/api/worlds \
  -H "X-API-Key: mk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Refund test",
    "services": ["stripe", "shopify"]
  }'

Errors

StatusDescription
400Invalid request body
401Invalid or missing API key
422Unknown service slug