{"generatedAt":"2026-07-19T03:01:59.574Z","tool":{"id":"api-response-mocker","name":"API Response Mocker","description":"Generate mock API responses for testing — get instant code for fetch, MSW, Express, curl, and Python without spinning up a server","category":"devtools","icon":"API","keywords":["api","mock","testing","fetch","msw","express","curl","python","agent","tools","response","http","rest"],"remoteCallable":true,"remoteMode":"dedicated_api","riskClass":"L","maxInputBytes":131072,"timeoutMs":2000,"supportsStreaming":false,"url":"/api-response-mocker/","tags":["devtools","prompting"],"faqs":[{"question":"What is API Response Mocker?","answer":"API Response Mocker generates mock API responses for testing without spinning up a server. It produces ready-to-use code for fetch, MSW, Express, cURL, and Python."},{"question":"How do I use API Response Mocker?","answer":"Define your API endpoint, status code, headers, and JSON response body. The tool generates mock code in multiple formats — copy the snippet for your testing framework or language of choice."},{"question":"Is API Response Mocker free?","answer":"Yes. This tool is free to use with immediate access—no account required."},{"question":"Does API Response Mocker store or send my data?","answer":"No. All processing happens entirely in your browser. Your API definitions stay on your device — nothing is sent to any server."},{"question":"What mock code formats does API Response Mocker support?","answer":"It generates code for JavaScript fetch, MSW (Mock Service Worker), Express.js routes, cURL commands, and Python. Each output is ready to paste directly into your project or terminal."}],"howTo":[{"title":"Generate mock API responses for frontend testing","description":"Define endpoint path, HTTP method, and shape (e.g., { id, name, email, created_at }). The tool generates realistic mock data (UUIDs for IDs, faker names/emails). Use in Storybook or Jest tests."},{"title":"Create paginated response mocks for list endpoints","description":"Configure mock for GET /users with 50 items per page. Set 'is_paginated' and specify page count. Generate paginated responses for testing pagination UI without hitting a real API."},{"title":"Mock error responses for failure scenarios","description":"Create 400, 401, 403, 500 responses with realistic error messages. Test error handling in your app without breaking the real API. Useful for negative test cases."},{"title":"Use mocked responses in Cypress/Playwright tests","description":"Generate mock response JSON, intercept the actual API call in your test (cy.intercept or page.route), and return the mocked data. App thinks it got real data, tests run fast and deterministic."},{"title":"Export mock data as JSON seed files","description":"Generate multiple mock records (e.g., 10 users), export as JSON, save to fixtures/users.json. Seed your test database or Storybook data with consistent, realistic mock data."}],"agentContract":{"toolId":"api-response-mocker","contractVersion":"2.0.0","remote_callable":true,"remote_mode":"dedicated_api","risk_class":"L","max_input_bytes":131072,"timeout_ms":2000,"supports_streaming":false,"preferred_surface":"dedicated_api","dedicated_api":{"baseUrl":"https://aidevhub.io/api/api-response-mocker/","openapiUrl":"https://aidevhub.io/api/openapi.yaml","endpoints":[{"method":"GET","path":"/api/api-response-mocker/","summary":"GET api-response-mocker"},{"method":"POST","path":"/api/api-response-mocker/","summary":"POST api-response-mocker"}],"riskClass":"L","inputMaxBytes":131072,"timeoutMs":2000},"runtime":{"endpoint":"/api/tools/run/","methods":["GET","POST"],"queryParams":[{"name":"toolId","required":true,"description":"Tool identifier"},{"name":"a","required":true,"description":"Primary input"}],"postBodyShape":{"toolId":"string","input":"{ a, b?, c?, mode? }"},"exampleGet":"https://aidevhub.io/api/tools/run/?toolId=api-response-mocker&a=...","policy":{"riskClass":"L","limit":60,"burst":20,"windowSec":60,"inputMaxBytes":131072,"timeoutMs":2000,"cacheTtlSec":0,"networkEnabled":false,"supportsStreaming":false}}},"relatedTools":[{"id":"api-header-builder","name":"API Header Builder & cURL Generator","url":"/api-header-builder/","category":"devtools"},{"id":"http-status-codes","name":"HTTP Status Code Reference","url":"/http-status-codes/","category":"devtools"},{"id":"openapi-preview","name":"OpenAPI / Swagger Preview","url":"/openapi-preview/","category":"devtools"},{"id":"webhook-inspector","name":"Webhook Payload Inspector","url":"/webhook-inspector/","category":"devtools"},{"id":"basic-auth-encoder","name":"Basic Auth Encoder / Decoder","url":"/basic-auth-encoder/","category":"devtools"},{"id":"cli-ux-linter","name":"CLI UX Linter","url":"/cli-ux-linter/","category":"devtools"}]}}