{ "openapi": "3.0.0", "info": { "version": "1.0.0", "title": "Adscrush CRM API", "description": "API for managing leads in Adscrush CRM", "license": { "name": "MIT" } }, "servers": [ { "url": "https://adscrush-api.anonymoussherlock.workers.dev/api" } ], "security": [ { "API_KEY": [] } ], "paths": { "/v1/leads": { "post": { "summary": "Add a new lead to campaign", "description": "Add a new lead to campaign", "security": [ { "API_KEY": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewLead" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "order_id": { "type": "string", "example": "rec_crlh9b3n9o8uin0cj1kg" } } } } } }, "400": { "$ref": "#/components/responses/ZodValidationError" }, "401": { "$ref": "#/components/responses/UnauthorizedError" }, "500": { "$ref": "#/components/responses/InternalServerError" } } } } }, "components": { "schemas": { "Lead": { "type": "object", "properties": { "id": { "type": "string", "description": "The unique identifier for the lead." }, "name": { "type": "string", "description": "The name of the lead." }, "phone": { "type": "string", "description": "The phone number of the lead." }, "address": { "type": "string", "description": "The address of the lead." }, "s1": { "type": "string", "description": "The unique identifier provided by us." }, "lp_name": { "type": "string", "description": "The identifier of the lp name associated with the lead." } }, "required": ["name", "phone", "s1", "lp_name"], "description": "Represents a lead in the Adscrush CRM system." }, "NewLead": { "type": "object", "properties": { "name": { "type": "string", "description": "Name is required. The name of the lead." }, "phone": { "type": "string", "description": "The phone number of the lead." }, "s1": { "type": "string", "description": "The unique code provided by us." }, "lp_name": { "type": "string", "description": "The lp name provided by us." }, "address": { "type": "string", "description": "The address of the lead." } }, "required": ["name", "phone", "s1", "lp_name"] } }, "securitySchemes": { "API_KEY": { "type": "apiKey", "in": "header", "name": "API_KEY", "description": "Your API key. Include this key in the `API_KEY` header when making requests to endpoints that require authentication. You can find your API key in the 'Profile' tab on the website." } }, "responses": { "UnauthorizedError": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "error": { "type": "string", "example": "unauthorized" }, "message": { "type": "string", "example": "Authentication failed" } } } } } }, "InternalServerError": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "error": { "type": "string", "example": "error" }, "message": { "type": "string", "example": "An unexpected error occurred" } } } } } }, "ZodValidationError": { "description": "Zod Validation Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "error": { "type": "string", "example": "validation" }, "message": { "type": "string", "example": "Invalid input data" } } } } } }, "NotFoundError": { "description": "Not Found Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "error": { "type": "string", "example": "Not Found" }, "message": { "type": "string", "example": "No lead found with this id" } } } } } } } } }