{"openapi":"3.1.0","info":{"title":"WebhookLab API","description":"Webhook simulation, testing, and contract validation API for the PlatPhorm network.","version":"1.0.0","contact":{"name":"PlatPhorm Network","url":"https://platphormnews.com"},"license":{"name":"MIT"}},"servers":[{"url":"https://webhooks.platphormnews.com","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"tags":[{"name":"Health","description":"Service health and status"},{"name":"Events","description":"Webhook event simulation"},{"name":"Endpoints","description":"Webhook endpoint management"},{"name":"Signatures","description":"HMAC signature generation and verification"},{"name":"Replays","description":"Event replay system"},{"name":"Contracts","description":"Payload contract testing"},{"name":"Deliveries","description":"Delivery tracking"},{"name":"Templates","description":"Webhook payload templates"},{"name":"Agent","description":"MCP and AI agent integration"}],"paths":{"/api/health":{"get":{"tags":["Health"],"summary":"Service health check","operationId":"getHealth","security":[],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/v1/events":{"get":{"tags":["Events"],"summary":"List webhook events","operationId":"listEvents","parameters":[{"name":"eventType","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"Events list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsResponse"}}}}}},"post":{"tags":["Events"],"summary":"Emit a test webhook event","operationId":"createEvent","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEventRequest"},"examples":{"user_created":{"value":{"eventType":"user.created","payload":{"id":"usr_123","email":"test@example.com","name":"Test User"}}},"payment_succeeded":{"value":{"eventType":"payment.succeeded","payload":{"id":"pay_456","amount":9900,"currency":"usd"}}}}}}},"responses":{"201":{"description":"Event created and delivered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEventResponse"}}}},"400":{"description":"Validation error"}}}},"/api/v1/endpoints":{"get":{"tags":["Endpoints"],"summary":"List webhook endpoints","operationId":"listEndpoints","responses":{"200":{"description":"Endpoints list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndpointsResponse"}}}}}},"post":{"tags":["Endpoints"],"summary":"Create a webhook endpoint","operationId":"createEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEndpointRequest"}}}},"responses":{"201":{"description":"Endpoint created"},"400":{"description":"Validation error"}}}},"/api/v1/signatures/generate":{"post":{"tags":["Signatures"],"summary":"Generate HMAC webhook signature","operationId":"generateSignature","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureRequest"}}}},"responses":{"200":{"description":"Signature generated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureResponse"}}}}}}},"/api/v1/signatures/verify":{"post":{"tags":["Signatures"],"summary":"Verify a webhook signature","operationId":"verifySignature","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyRequest"}}}},"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyResponse"}}}}}}},"/api/v1/replays":{"post":{"tags":["Replays"],"summary":"Replay a webhook event","operationId":"replayEvent","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["eventId"],"properties":{"eventId":{"type":"string"},"endpointId":{"type":"string"}}}}}},"responses":{"201":{"description":"Replay initiated"}}}},"/api/v1/contracts":{"get":{"tags":["Contracts"],"summary":"List contracts","operationId":"listContracts","responses":{"200":{"description":"Contracts list"}}},"post":{"tags":["Contracts"],"summary":"Create contract","operationId":"createContract","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"contract_data":{"type":"object"}}}}}},"responses":{"201":{"description":"Contract created"}}}},"/api/v1/deliveries":{"get":{"tags":["Deliveries"],"summary":"List webhook deliveries","operationId":"listDeliveries","parameters":[{"name":"eventId","in":"query","schema":{"type":"string"}},{"name":"endpointId","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":50}}],"responses":{"200":{"description":"Deliveries list"}}}},"/api/v1/templates":{"get":{"tags":["Templates"],"summary":"List webhook templates","operationId":"listTemplates","responses":{"200":{"description":"Templates list"}}}},"/api/v1/agent":{"post":{"tags":["Agent"],"summary":"Unified agent action endpoint","description":"Single endpoint for AI agents and MCP clients to execute any WebhookLab action.","operationId":"agentAction","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentActionRequest"},"examples":{"emit_event":{"value":{"action":"emit_test_event","params":{"eventType":"user.created","payload":{"id":"usr_123"}}}},"generate_sig":{"value":{"action":"generate_signature","params":{"payload":{"id":"evt_1"}}}}}}}},"responses":{"200":{"description":"Action result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentActionResponse"}}}}}}},"/api/mcp":{"post":{"tags":["Agent"],"summary":"MCP JSON-RPC endpoint","description":"Model Context Protocol endpoint. Supports tools/list, tools/call, resources/list, prompts/list.","operationId":"mcpRpc","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MCPRequest"}}}},"responses":{"200":{"description":"MCP JSON-RPC response"}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"HealthResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"data":{"type":"object","properties":{"status":{"type":"string"},"service":{"type":"string"},"version":{"type":"string"},"timestamp":{"type":"string"},"uptime":{"type":"number"}}}}},"CreateEventRequest":{"type":"object","required":["eventType","payload"],"properties":{"eventType":{"type":"string","example":"user.created"},"payload":{"type":"object"},"endpointId":{"type":"string"},"simulated":{"type":"boolean","default":true}}},"CreateEventResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"data":{"type":"object","properties":{"event":{"type":"object"},"delivery":{"type":"object"}}}}},"EventsResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"data":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object"}}}}}},"CreateEndpointRequest":{"type":"object","required":["name","url","events"],"properties":{"name":{"type":"string"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"}},"description":{"type":"string"},"signingAlgorithm":{"type":"string","enum":["sha256","sha512"]},"retryCount":{"type":"integer","minimum":0,"maximum":10}}},"EndpointsResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"data":{"type":"object","properties":{"endpoints":{"type":"array","items":{"type":"object"}}}}}},"SignatureRequest":{"type":"object","required":["payload"],"properties":{"payload":{"type":"object"},"secret":{"type":"string"},"algorithm":{"type":"string","enum":["sha256","sha512"],"default":"sha256"}}},"SignatureResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"data":{"type":"object","properties":{"signature":{"type":"string"},"timestamp":{"type":"integer"},"algorithm":{"type":"string"}}}}},"VerifyRequest":{"type":"object","required":["signature","payload"],"properties":{"signature":{"type":"string"},"payload":{"type":"object"},"secret":{"type":"string"},"tolerance":{"type":"integer","default":300}}},"VerifyResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"data":{"type":"object","properties":{"valid":{"type":"boolean"},"reason":{"type":"string"}}}}},"AgentActionRequest":{"type":"object","required":["action"],"properties":{"action":{"type":"string"},"params":{"type":"object"}}},"AgentActionResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"action":{"type":"string"},"result":{},"executionTimeMs":{"type":"number"},"next":{"type":"array","items":{"type":"object"}}}},"MCPRequest":{"type":"object","required":["jsonrpc","method"],"properties":{"jsonrpc":{"type":"string","const":"2.0"},"id":{},"method":{"type":"string"},"params":{"type":"object"}}}}}}