Skip to main content
The simulator command provides complete control over your API mock services, including lifecycle management, monitoring, code generation, and import/export capabilities.

Subcommands

start

Start the API simulator and load service definitions.
apicentric simulator start [flags]
--services-dir
string
required
Directory containing service definition YAML files
--force
boolean
default:"false"
Force stop any existing simulator before starting
--template
string
Install and start a service template from the marketplace
Example:
apicentric simulator start --services-dir ./services
Example with template:
apicentric simulator start --services-dir ./services --template ecommerce
The simulator runs until you press Ctrl+C. All services are started on the ports defined in their YAML files.

stop

Stop the running API simulator.
apicentric simulator stop [flags]
--force
boolean
default:"false"
Force stop even if services are active
Example:
apicentric simulator stop

status

Display the current status of the simulator and all services.
apicentric simulator status [flags]
--detailed
boolean
default:"false"
Show detailed information about each service
Example:
apicentric simulator status --detailed
Sample output:
📊 API Simulator Status
   Status: 🟢 Running
   Services: 3 total
   Active Services: 3

📋 Service Details:
   - users (port 9001 base /) endpoints:5 running:yes
   - orders (port 9002 base /api) endpoints:8 running:yes
   - products (port 9003 base /) endpoints:12 running:yes

validate

Validate service definition files for syntax and structure errors.
apicentric simulator validate --file <path> [flags]
--file
string
required
Path to a service file or directory to validate
--recursive
boolean
default:"false"
Recursively validate all YAML files in subdirectories
--verbose
boolean
default:"false"
Show validation details for each file
Example:
apicentric simulator validate --file ./services --recursive --verbose

logs

Retrieve and filter request logs from a running service.
apicentric simulator logs --service <name> [flags]
--service
string
required
Name of the service to fetch logs from
--limit
number
default:"100"
Maximum number of log entries to retrieve
--method
string
Filter by HTTP method (GET, POST, PUT, DELETE, etc.)
--route
string
Filter by request route/path
--status
number
Filter by HTTP status code
--output
string
Write logs to a JSON file instead of stdout
Example:
apicentric simulator logs --service users --limit 50 --method POST
Example with output file:
apicentric simulator logs --service orders --status 500 --output errors.json

monitor

Continuously monitor simulator status and live request logs.
apicentric simulator monitor [flags]
--service
string
Monitor a specific service (monitors all services if omitted)
--json
boolean
default:"false"
Output in JSON format for programmatic processing
--interval
number
Refresh interval in seconds (monitors continuously if omitted)
Example:
apicentric simulator monitor --service users --interval 5
Press Ctrl+C to stop monitoring.

set-scenario

Activate a specific scenario across all services.
apicentric simulator set-scenario --scenario <name>
--scenario
string
required
Name of the scenario to activate
Example:
apicentric simulator set-scenario --scenario high-latency

import

Import API definitions from other formats into apicentric service definitions.
apicentric simulator import --file <input> --output <output>
--file
string
required
Path to the input file (OpenAPI, Postman, WireMock, or Mockoon)
--output
string
required
Path where the converted service definition will be saved
Supported formats:
  • OpenAPI 3.0 / Swagger 2.0 (JSON or YAML)
  • Postman collections
  • WireMock mappings
  • Mockoon environments
Example:
apicentric simulator import --file openapi.json --output services/api.yaml
The command auto-detects the input format. If detection fails, it attempts to parse as OpenAPI.

export

Export service definitions to other formats.
apicentric simulator export --file <input> --output <output> --format <format>
--file
string
required
Path to the apicentric service definition file
--output
string
required
Path where the exported file will be saved
--format
string
required
Export format: openapi or postman
Example:
apicentric simulator export --file services/users.yaml --output users.json --format openapi

generate-types

Generate TypeScript type definitions from a service definition.
apicentric simulator generate-types --file <input> --output <output>
--file
string
required
Path to the service definition YAML file
--output
string
required
Path where the TypeScript file will be saved
Example:
apicentric simulator generate-types --file services/users.yaml --output src/types/users.ts

generate-query

Generate React Query hooks from a service definition.
apicentric simulator generate-query --file <input> --output <output>
--file
string
required
Path to the service definition YAML file
--output
string
required
Path where the hooks file will be saved
Example:
apicentric simulator generate-query --file services/users.yaml --output src/hooks/useUsers.ts

generate-view

Generate a React component view from a service definition.
apicentric simulator generate-view --file <input> --output <output>
--file
string
required
Path to the service definition YAML file
--output
string
required
Path where the React component will be saved
Example:
apicentric simulator generate-view --file services/users.yaml --output src/views/UsersView.tsx

new

Requires the tui feature to be enabled.
Create a new service definition interactively.
apicentric simulator new --output <directory>
--output
string
required
Directory where the service definition will be created
Example:
apicentric simulator new --output ./services

new-graphql

Create a new GraphQL service definition with schema and mock files.
apicentric simulator new-graphql --name <name> --output <directory>
--name
string
required
Name of the GraphQL service
--output
string
required
Directory where the service files will be created
Example:
apicentric simulator new-graphql --name myapi --output ./services
Generated files:
  • myapi.yaml - Service definition
  • myapi.gql - GraphQL schema
  • helloQuery.json - Example mock response

edit

Requires the tui feature to be enabled.
Add an endpoint to an existing service definition interactively.
apicentric simulator edit --file <path>
--file
string
required
Path to the service definition file
Example:
apicentric simulator edit --file ./services/users.yaml

record

Record live API traffic and generate a service definition.
apicentric simulator record --output <path> [flags]
--output
string
required
Path where the recorded service definition will be saved
--url
string
default:"http://localhost:8080"
Target API URL to record traffic from
Example:
apicentric simulator record --output recorded-api.yaml --url https://api.example.com

dockerize

Generate a Docker image for your service definitions.
apicentric simulator dockerize --file <paths...> --output <directory>
--file
string[]
required
One or more service definition files to include
--output
string
required
Output directory for the Dockerfile and related files
Example:
apicentric simulator dockerize --file services/users.yaml --file services/orders.yaml --output ./docker
Generated files:
  • Dockerfile - Multi-stage build with apicentric
  • .dockerignore - Ignore patterns
  • services/ - Copied service definitions

test

Requires the contract-testing feature to be enabled.
Run contract tests against a real API.
apicentric simulator test --path <contract> --url <api-url> --env <environment> [flags]
--path
string
required
Path to the contract/service definition file
--url
string
required
URL of the real API to test against
--env
string
required
Environment name for the test run
--quiet
boolean
default:"false"
Minimal output, only show pass/fail summary
Example:
apicentric simulator test --path services/users.yaml --url https://api.production.com --env production
Example output:
🚀 Running contract tests...
   Contract: services/users.yaml
   API URL:  https://api.production.com
   Env:      production

🔬 Found 12 test scenarios.

🏁 Contract Test Results:
   ID:         services/users.yaml
   Compatible: ✅
   Score:      98.50%
   Summary:    11 Passed, 1 Failed

✅ All scenarios passed!

Build docs developers (and LLMs) love