Prerequisites
Make sure you have Apicentric installed. If not, follow the installation guide.Create your first mock API
Let’s build a simple user management API with CRUD operations.Create a service definition
Create a file named
users-api.yaml:users-api.yaml
This YAML defines three endpoints: list users, get a user by ID, and create a user.
Test your API
Open a new terminal and send some requests:List all users:Response:Get a specific user:Create a new user:Response:
Notice how the response uses dynamic data: random ID from Faker and current timestamp from the
now helper.What you learned
You just:- ✅ Created a service definition with fixtures and endpoints
- ✅ Started the API simulator
- ✅ Tested your mock API with curl
- ✅ Used Handlebars templates for dynamic responses
- ✅ Leveraged built-in helpers (faker, now, find, each)
Next steps
Core concepts
Learn about service definitions, fixtures, and scenarios
Create mock APIs
Build more complex APIs with validation and conditional responses
Generate code
Generate TypeScript types and React Query hooks from your API
Browse examples
Explore real-world examples like e-commerce and IoT
Common next tasks
Add request validation
Add request validation
Add schema validation to ensure requests have required fields:See the request validation guide for more.
Add scenarios for testing
Add scenarios for testing
Simulate different API states (latency, errors, maintenance):Activate with:Learn more in the scenarios guide.
Dockerize your service
Dockerize your service
Generate TypeScript types
Generate TypeScript types