Use mock APIs in your continuous integration and deployment pipelines
Integrate Mock API Builder into your CI/CD pipeline to run automated tests, validate integrations, and ensure your application works correctly before deploying to production.
Run integration tests against mock APIs in every build
Get quick test results without waiting for real APIs
Use predictable mock data across all test runs
Automate project management from CI with the Developer API under /api/v1/.... Authenticate with your user API token (generate or refresh it from your profile). The token must belong to the project owner.
Pass your API token with either header:
Authorization: Token <apiToken> is also accepted. Store the token as a CI secret (for example MOCK_API_TOKEN)—never commit it.
All routes are scoped to a project you own by :slug:
| Method | Path | Description |
|---|---|---|
GET | /api/v1/projects/:slug | Project metadata (name, protocol, mock base URL, endpoint count, and more) |
GET | /api/v1/projects/:slug/endpoints | List endpoints |
POST | /api/v1/projects/:slug/endpoints | Create an endpoint (path, method, optional mockData, config, enabled) |
PATCH | /api/v1/projects/:slug/endpoints/:id | Update an endpoint (path, mockData, config, enabled, contract) |
PUT | /api/v1/projects/:slug/settings | Update settings (proxyMode, isPublic, apiTokenRequired, monitor target, forward headers) |
GET | /api/v1/projects/:slug/logs | Recent request logs (?limit=, default 50, max 200) |
POST | /api/v1/projects/:slug/state/reset | Clear the stateful mock store for the project |
Use the same token header pattern for listing endpoints, updating mock data, toggling MOCK/PROXY/HYBRID, or fetching logs after a pipeline run.
Create a .github/workflows/test.yml file in your repository:
Create a .gitlab-ci.yml file:
Create a Jenkinsfile in your repository:
Create a .circleci/config.yml file:
MOCK_API_URL with your project URLMOCK_API_TOKEN if using authenticationAPI_URL, value as your mock API URLmock-api-urlcredentials('mock-api-url')Use different mock APIs for different environments: