Created
May 18, 2025 01:48
-
-
Save anuran-roy/e5a349b7029c0c51e93491751e9f9c20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.0.0", | |
| "info": { | |
| "title": "Alchemyst AI API documentation", | |
| "version": "1.0.0", | |
| "description": "API documentation for Alchemyst AI" | |
| }, | |
| "paths": { | |
| "/api/{persona}/generate/content/emails": { | |
| "post": { | |
| "summary": "Generates email content based on chat history for a specific persona", | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "schema": { | |
| "type": "string", | |
| "default": "maya" | |
| }, | |
| "required": true, | |
| "description": "The persona identifier to generate content for" | |
| }, | |
| { | |
| "in": "header", | |
| "name": "Authorization", | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "required": true, | |
| "description": "Bearer token for authentication" | |
| }, | |
| { | |
| "in": "header", | |
| "name": "x-forwarded-proto", | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Protocol (http/https) forwarded by proxy" | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "chat_history" | |
| ], | |
| "properties": { | |
| "chat_history": { | |
| "type": "array", | |
| "description": "Array of chat messages in Langchain format" | |
| }, | |
| "scope": { | |
| "type": "string", | |
| "default": "internal", | |
| "description": "Scope of the content generation" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Successfully generated content", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request body" | |
| }, | |
| "401": { | |
| "description": "User not found" | |
| }, | |
| "402": { | |
| "description": "Invalid user" | |
| }, | |
| "403": { | |
| "description": "User lacks required scope" | |
| }, | |
| "404": { | |
| "description": "No content generated" | |
| } | |
| }, | |
| "tags": [ | |
| "emails" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| } | |
| }, | |
| "/api/{persona}/generate/workbench/components": { | |
| "post": { | |
| "summary": "Handles POST requests for workbench components generation", | |
| "tags": [ | |
| "Workbench Components" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "name": "persona", | |
| "in": "path", | |
| "required": true, | |
| "description": "The persona identifier", | |
| "schema": { | |
| "type": "string" | |
| } | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Successfully processed the request", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "maxDuration": 300 | |
| } | |
| }, | |
| "/api/{persona}/integrations/{integrationName}/list": { | |
| "get": { | |
| "summary": "Retrieve a list of integrations for a specific integration type", | |
| "description": "Fetches all integrations the authenticated user (or their organization) has subscribed to.", | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The persona context for the request" | |
| }, | |
| { | |
| "in": "path", | |
| "name": "integrationName", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The name of the integration type to list" | |
| } | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved list of integrations", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "integrations": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/components/schemas/Integration" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User doesn't have required scope or is not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "It's not you, it's on us. Please report this error code: ERR_INTEGRATIONS_LIST" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/fireflies-ai/{userId}/{integrationId}/webhook": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Webhook endpoint for Fireflies.ai integration", | |
| "description": "Handles incoming webhooks from Fireflies.ai when transcription is complete", | |
| "parameters": [ | |
| { | |
| "name": "persona", | |
| "in": "path", | |
| "required": true, | |
| "description": "The persona identifier", | |
| "schema": { | |
| "type": "string" | |
| } | |
| }, | |
| { | |
| "name": "userId", | |
| "in": "path", | |
| "required": true, | |
| "description": "The user identifier", | |
| "schema": { | |
| "type": "string" | |
| } | |
| }, | |
| { | |
| "name": "integrationId", | |
| "in": "path", | |
| "required": true, | |
| "description": "The integration identifier", | |
| "schema": { | |
| "type": "string" | |
| } | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "meetingId", | |
| "eventType" | |
| ], | |
| "properties": { | |
| "meetingId": { | |
| "type": "string", | |
| "description": "The ID of the transcribed meeting" | |
| }, | |
| "eventType": { | |
| "type": "string", | |
| "description": "Type of event from Fireflies.ai" | |
| }, | |
| "clientReferenceId": { | |
| "type": "string", | |
| "description": "Optional client reference ID" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Webhook processed successfully" | |
| }, | |
| "400": { | |
| "description": "Invalid payload or missing signature" | |
| }, | |
| "401": { | |
| "description": "Invalid signature" | |
| }, | |
| "500": { | |
| "description": "Server configuration error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/fireflies-ai/init": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Initialize Fireflies.ai integration", | |
| "description": "Creates a new Fireflies.ai integration for the authenticated user", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string", | |
| "default": "maya" | |
| }, | |
| "description": "Persona identifier" | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "apiKey" | |
| ], | |
| "properties": { | |
| "apiKey": { | |
| "type": "string", | |
| "description": "Fireflies.ai API key" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Integration created successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "integration": { | |
| "type": "object", | |
| "description": "Created integration object" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request body or API key" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not found" | |
| }, | |
| "402": { | |
| "description": "Invalid user" | |
| }, | |
| "403": { | |
| "description": "Forbidden - Missing required scope" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/marketplace/{integrationName}": { | |
| "get": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Get marketplace integrations", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The persona name" | |
| }, | |
| { | |
| "in": "path", | |
| "name": "integrationName", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The integration name" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Success", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "integrations": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/components/schemas/Integration" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized" | |
| }, | |
| "402": { | |
| "description": "Invalid user" | |
| }, | |
| "403": { | |
| "description": "Insufficient scope" | |
| }, | |
| "500": { | |
| "description": "Server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/marketplace": { | |
| "get": { | |
| "summary": "Retrieves available integrations for a specific Alchemyst persona from the marketplace", | |
| "description": "Returns a list of non-configured integrations available for the specified persona", | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The name of the persona (e.g., 'maya' or 'ron')" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved integrations", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "personaName": { | |
| "type": "string", | |
| "description": "The name of the requested persona" | |
| }, | |
| "integrations": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "persona": { | |
| "type": "string" | |
| }, | |
| "userId": { | |
| "type": "string", | |
| "nullable": true | |
| }, | |
| "organizationId": { | |
| "type": "string", | |
| "nullable": true | |
| }, | |
| "enabled": { | |
| "type": "boolean" | |
| }, | |
| "apiKey": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User doesn't have required scope" | |
| } | |
| }, | |
| "required": [ | |
| "platform.integrations.view scope" | |
| ] | |
| } | |
| }, | |
| "/api/{persona}/integrations/read-ai/{userId}/{integrationId}/webhook": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Webhook endpoint for Read AI integration", | |
| "description": "Processes webhook information from Read AI when a meeting ends. Creates a new chat history and saves the context node.", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "User persona" | |
| }, | |
| { | |
| "in": "path", | |
| "name": "userId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "User ID" | |
| }, | |
| { | |
| "in": "path", | |
| "name": "integrationId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Integration ID" | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "session_id", | |
| "trigger", | |
| "title", | |
| "start_time", | |
| "end_time", | |
| "participants", | |
| "owner", | |
| "summary", | |
| "action_items", | |
| "key_questions", | |
| "topics", | |
| "report_url", | |
| "chapter_summaries", | |
| "transcript" | |
| ], | |
| "properties": { | |
| "session_id": { | |
| "type": "string" | |
| }, | |
| "trigger": { | |
| "type": "string", | |
| "enum": [ | |
| "meeting_end" | |
| ] | |
| }, | |
| "title": { | |
| "type": "string" | |
| }, | |
| "start_time": { | |
| "type": "string", | |
| "format": "date-time" | |
| }, | |
| "end_time": { | |
| "type": "string", | |
| "format": "date-time" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Chat history created successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "data": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request body" | |
| }, | |
| "401": { | |
| "description": "Unauthorized" | |
| }, | |
| "402": { | |
| "description": "Invalid user" | |
| }, | |
| "403": { | |
| "description": "Insufficient scope" | |
| }, | |
| "405": { | |
| "description": "Method not allowed" | |
| }, | |
| "500": { | |
| "description": "Server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/read-ai/init": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "summary": "Initialize a Read AI integration", | |
| "description": "Creates a new Read AI integration for the authenticated user", | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "required": false, | |
| "description": "Persona name (defaults to 'maya')" | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "apiKey" | |
| ], | |
| "properties": { | |
| "apiKey": { | |
| "type": "string", | |
| "description": "API Key for authentication" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Integration created successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "integration": { | |
| "type": "object", | |
| "properties": { | |
| "userId": { | |
| "type": "string" | |
| }, | |
| "type": { | |
| "type": "string" | |
| }, | |
| "apiKey": { | |
| "type": "string" | |
| }, | |
| "credentials": { | |
| "type": "object" | |
| }, | |
| "enabled": { | |
| "type": "boolean" | |
| }, | |
| "source": { | |
| "type": "string" | |
| }, | |
| "persona": { | |
| "type": "string" | |
| }, | |
| "organizationId": { | |
| "type": "string" | |
| }, | |
| "subscribedToWebhook": { | |
| "type": "boolean" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request body or API Key" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not found" | |
| }, | |
| "402": { | |
| "description": "Invalid user" | |
| }, | |
| "403": { | |
| "description": "Forbidden - User lacks required scope" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations": { | |
| "get": { | |
| "summary": "Get integrations for a specific persona", | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Name of the persona (maya or ron)" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "List of integrations for the persona", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "personaName": { | |
| "type": "string" | |
| }, | |
| "integrations": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "name": { | |
| "type": "string" | |
| }, | |
| "persona": { | |
| "type": "string" | |
| }, | |
| "email": { | |
| "type": "string" | |
| }, | |
| "phoneNumber": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized access" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/telegram/init": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Initialize a new Telegram integration", | |
| "description": "Creates a new Telegram integration for the authenticated user with the specified persona", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The persona name to associate with the integration" | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "phoneNumber", | |
| "profileHandle", | |
| "apiKey" | |
| ], | |
| "properties": { | |
| "phoneNumber": { | |
| "type": "string", | |
| "description": "Phone number for Telegram integration" | |
| }, | |
| "profileHandle": { | |
| "type": "string", | |
| "description": "Telegram profile handle" | |
| }, | |
| "apiKey": { | |
| "type": "string", | |
| "description": "API key for authentication" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Integration successfully initialized" | |
| }, | |
| "400": { | |
| "description": "Invalid request parameters" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User lacks required permissions" | |
| }, | |
| "403": { | |
| "description": "Forbidden - Invalid API key or integration already exists" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/telegram/verify": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Verify Telegram integration with OTP", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Persona name for the integration" | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "otp": { | |
| "type": "string", | |
| "description": "One-time password for verification" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Integration verified successfully" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - Invalid or missing authentication token" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/twilio/fetch": { | |
| "get": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Fetch Twilio phone numbers", | |
| "description": "Retrieves all Twilio phone numbers associated with the authenticated user", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "User persona" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved phone numbers", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "credentials": { | |
| "type": "object", | |
| "properties": { | |
| "phoneNumber": { | |
| "type": "string" | |
| }, | |
| "webhookUrl": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request method" | |
| }, | |
| "401": { | |
| "description": "User not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "User not found" | |
| }, | |
| "response": { | |
| "type": "string", | |
| "example": "error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/twilio/init": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Initialize Twilio integration", | |
| "description": "Creates a new Twilio integration configuration for the authenticated user", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The persona identifier" | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "accountSid", | |
| "authToken", | |
| "phoneNumber", | |
| "apiKey" | |
| ], | |
| "properties": { | |
| "accountSid": { | |
| "type": "string", | |
| "description": "Twilio Account SID" | |
| }, | |
| "authToken": { | |
| "type": "string", | |
| "description": "Twilio Auth Token" | |
| }, | |
| "phoneNumber": { | |
| "type": "string", | |
| "description": "Twilio Phone Number" | |
| }, | |
| "apiKey": { | |
| "type": "string", | |
| "description": "User's API Key" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Integration successfully created", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "webhookUrl": { | |
| "type": "string", | |
| "description": "Generated webhook URL for the integration" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request - Invalid input data" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - Missing or invalid authentication" | |
| }, | |
| "403": { | |
| "description": "Forbidden - Invalid API key or duplicate integration" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/whatsapp/{userId}/{integrationId}/webhook": { | |
| "get": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Whatsapp webhook endpoint for GET requests", | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| } | |
| }, | |
| { | |
| "in": "path", | |
| "name": "userId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| } | |
| }, | |
| { | |
| "in": "path", | |
| "name": "integrationId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Success" | |
| } | |
| } | |
| }, | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Whatsapp webhook endpoint for POST requests", | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| } | |
| }, | |
| { | |
| "in": "path", | |
| "name": "userId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| } | |
| }, | |
| { | |
| "in": "path", | |
| "name": "integrationId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Success" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/whatsapp/fetch": { | |
| "get": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Fetch WhatsApp phone numbers for user", | |
| "description": "Retrieves all registered WhatsApp phone numbers and webhook URLs for the authenticated user", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Persona identifier" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved WhatsApp phone numbers", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "credentials": { | |
| "type": "object", | |
| "properties": { | |
| "phoneNumber": { | |
| "type": "string" | |
| }, | |
| "webhookUrl": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request method" | |
| }, | |
| "401": { | |
| "description": "User not authenticated or not found" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/whatsapp/init": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "summary": "Initialize WhatsApp integration", | |
| "description": "Initializes a new WhatsApp integration for the authenticated user", | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The persona identifier" | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "phoneNumber", | |
| "accessToken", | |
| "phoneNumberId", | |
| "appId", | |
| "appSecret", | |
| "verifyToken", | |
| "apiKey", | |
| "whatsappBusinessAccountId" | |
| ], | |
| "properties": { | |
| "phoneNumber": { | |
| "type": "string" | |
| }, | |
| "accessToken": { | |
| "type": "string" | |
| }, | |
| "phoneNumberId": { | |
| "type": "string" | |
| }, | |
| "appId": { | |
| "type": "string" | |
| }, | |
| "appSecret": { | |
| "type": "string" | |
| }, | |
| "verifyToken": { | |
| "type": "string" | |
| }, | |
| "apiKey": { | |
| "type": "string" | |
| }, | |
| "whatsappBusinessAccountId": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Integration successfully created", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "webhookUrl": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request data" | |
| }, | |
| "401": { | |
| "description": "Unauthorized" | |
| }, | |
| "403": { | |
| "description": "API key invalid or integration already exists" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/integrations/whatsapp": { | |
| "get": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Retrieve WhatsApp integration details", | |
| "description": "Gets the WhatsApp integration configuration for a specific persona", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Name of the persona" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Integration details retrieved successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "personaName": { | |
| "type": "string" | |
| }, | |
| "integration": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - Invalid or missing authentication" | |
| }, | |
| "404": { | |
| "description": "Integration not found or not enabled" | |
| } | |
| } | |
| }, | |
| "delete": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Delete WhatsApp integration", | |
| "description": "Removes WhatsApp integration configuration for a specific persona", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Name of the persona" | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Webhook URL to be deleted" | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Integration deleted successfully" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - Invalid or missing authentication" | |
| }, | |
| "404": { | |
| "description": "Integration not found" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/{persona}/recall": { | |
| "post": { | |
| "tags": [ | |
| "chat" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "summary": "Recall chat history - used mostly with integrations.", | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "persona", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| } | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "source", | |
| "title" | |
| ], | |
| "properties": { | |
| "contact": { | |
| "type": "object", | |
| "properties": { | |
| "username": { | |
| "type": "string" | |
| }, | |
| "phone": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "source": { | |
| "type": "string" | |
| }, | |
| "title": { | |
| "type": "string" | |
| }, | |
| "id": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Chat history retrieved successfully" | |
| }, | |
| "400": { | |
| "description": "Bad request" | |
| }, | |
| "401": { | |
| "description": "Unauthorized" | |
| }, | |
| "403": { | |
| "description": "Forbidden" | |
| }, | |
| "404": { | |
| "description": "Chat history not found" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/auth/atlassian": { | |
| "get": { | |
| "summary": "Initiate Atlassian authentication", | |
| "description": "This endpoint initiates the Atlassian OAuth authentication process, requesting access to the user's profile and email.", | |
| "tags": [ | |
| "auth" | |
| ], | |
| "responses": { | |
| "302": { | |
| "description": "Redirect to Atlassian OAuth consent screen for authentication", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Redirecting to Atlassian authentication" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/auth/google/callback": { | |
| "get": { | |
| "summary": "Handle Google OAuth callback and authentication", | |
| "description": "This endpoint handles the OAuth callback from Google, verifies the authentication, and redirects the user to the dashboard if successful.", | |
| "tags": [ | |
| "auth" | |
| ], | |
| "responses": { | |
| "302": { | |
| "description": "Redirects to the dashboard upon successful authentication", | |
| "headers": { | |
| "Location": { | |
| "description": "Redirects to the dashboard URL", | |
| "schema": { | |
| "type": "string", | |
| "example": "https://yourfrontendurl.com/dashboard" | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Authentication failed – Invalid credentials or other error", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Authentication failed" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal error during authentication process", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Internal server error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/auth/google": { | |
| "get": { | |
| "summary": "Initiate Google authentication", | |
| "description": "This endpoint initiates the Google OAuth authentication process, requesting access to the user's profile and email.", | |
| "tags": [ | |
| "auth" | |
| ], | |
| "responses": { | |
| "302": { | |
| "description": "Redirect to Google OAuth consent screen for authentication", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Redirecting to Google authentication" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/auth/logout": { | |
| "get": { | |
| "summary": "Logout and clear the access token", | |
| "description": "This endpoint clears the user's access token cookie, effectively logging them out.", | |
| "tags": [ | |
| "auth" | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully logged out and cleared the access token", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "description": "Indicates whether the logout was successful", | |
| "example": true | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/auth/status": { | |
| "get": { | |
| "summary": "Retrieve user information", | |
| "description": "This endpoint retrieves the information of the authenticated user based on the provided request headers.", | |
| "tags": [ | |
| "auth" | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "User information retrieved successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "type": "object", | |
| "description": "User information.", | |
| "example": { | |
| "userId": "user123", | |
| "username": "john_doe" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "User not found – No user matched the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "type": null, | |
| "description": "No user found." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/emails/generate": { | |
| "post": { | |
| "summary": "Generate an email based on request data", | |
| "description": "This endpoint generates an email based on the provided email fields, and identifies which email addresses belong to the internal system and which belong to clients.", | |
| "tags": [ | |
| "emails" | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "from": { | |
| "type": "string", | |
| "description": "The sender's email address.", | |
| "example": "user@example.com" | |
| }, | |
| "to": { | |
| "type": "string", | |
| "description": "The recipient's email address.", | |
| "example": "recipient@example.com" | |
| }, | |
| "text": { | |
| "type": "string", | |
| "description": "The plain text content of the email.", | |
| "example": "Meeting agenda attached." | |
| }, | |
| "date": { | |
| "type": "string", | |
| "format": "date-time", | |
| "description": "The date and time the email was sent.", | |
| "example": "2024-12-25T12:00:00Z" | |
| } | |
| } | |
| }, | |
| "required": [ | |
| "from", | |
| "to", | |
| "text", | |
| "date" | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Email generated successfully, identifying internal and client email addresses.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "from": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "List of internal email addresses (associated with the user's inbox).", | |
| "example": [ | |
| "user@example.com" | |
| ] | |
| }, | |
| "to": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "List of client email addresses (not associated with the user's inbox).", | |
| "example": [ | |
| "recipient@example.com" | |
| ] | |
| }, | |
| "text": { | |
| "type": "string", | |
| "description": "Generated email content.", | |
| "example": "Meeting agenda attached." | |
| }, | |
| "date": { | |
| "type": "string", | |
| "format": "date-time", | |
| "description": "The current date and time.", | |
| "example": "2024-12-25T12:00:00Z" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "405": { | |
| "description": "Method Not Allowed – Invalid HTTP method.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Method Not Allowed" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal Server Error – Failed to generate the email.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Error generating email" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ] | |
| } | |
| }, | |
| "/api/batch/emails/schedule": { | |
| "post": { | |
| "summary": "Schedule and send emails in batches", | |
| "description": "Endpoint to schedule and send multiple emails in bulk", | |
| "tags": [ | |
| "emails" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "emails" | |
| ], | |
| "properties": { | |
| "emails": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/components/schemas/ExtendedEmail" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "202": { | |
| "description": "Emails scheduled successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "10/10 emails sent successfully" | |
| }, | |
| "emailsGenerated": { | |
| "type": "number", | |
| "example": 10 | |
| }, | |
| "emailsSent": { | |
| "type": "number", | |
| "example": 10 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - Invalid or missing authentication token" | |
| }, | |
| "405": { | |
| "description": "Method Not Allowed - Only POST method is supported" | |
| }, | |
| "500": { | |
| "description": "Internal Server Error", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Error sending email" | |
| }, | |
| "emailsGenerated": { | |
| "type": "number", | |
| "example": 0 | |
| }, | |
| "emailsSent": { | |
| "type": "number", | |
| "example": 0 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/billing": { | |
| "get": { | |
| "summary": "Retrieve user usage data", | |
| "description": "This endpoint returns the user's leads and responses billing usage data.", | |
| "tags": [ | |
| "billing" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved the usage data", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "leads": { | |
| "type": "object", | |
| "description": "The user's leads usage data", | |
| "example": { | |
| "used": 50, | |
| "limit": 100 | |
| } | |
| }, | |
| "responses": { | |
| "type": "object", | |
| "description": "The user's responses usage data", | |
| "example": { | |
| "used": 30, | |
| "limit": 100 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized access – User not found", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "User not found" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/campaigns/delete/{campaignId}": { | |
| "delete": { | |
| "summary": "Delete a campaign", | |
| "description": "This endpoint deletes a campaign by its ID, removes any related scheduled jobs, and marks associated sent emails as deleted.", | |
| "tags": [ | |
| "campaigns" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "campaignId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The ID of the campaign to delete", | |
| "example": "60d21b4667d0d8992e610c85" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Campaign successfully deleted", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Error occurred while deleting the campaign", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/campaigns/emails/{campaignId}": { | |
| "get": { | |
| "summary": "Get opened emails for a campaign", | |
| "description": "Retrieves a list of email addresses that have opened emails from a specific campaign, along with the total count.", | |
| "tags": [ | |
| "campaigns" | |
| ], | |
| "security": [ | |
| { | |
| "BearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "campaignId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The ID of the campaign to get opened email data for", | |
| "example": "65a23f8c7b12345678901234" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved opened emails data", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "openedEmails": { | |
| "type": "object", | |
| "properties": { | |
| "openedEmails": { | |
| "type": "array", | |
| "description": "List of email addresses that have opened the campaign emails", | |
| "items": { | |
| "type": "string", | |
| "example": "recipient@example.com" | |
| } | |
| }, | |
| "count": { | |
| "type": "integer", | |
| "description": "Total number of opened emails", | |
| "example": 15 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not authenticated or campaign ID not provided", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Server error during processing", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/campaigns/fetch/{campaignId}": { | |
| "get": { | |
| "summary": "Get campaign details", | |
| "description": "This endpoint retrieves campaign details by ID with optional warm-up and follow-up email count statistics.", | |
| "tags": [ | |
| "campaigns" | |
| ], | |
| "security": [ | |
| { | |
| "BearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "campaignId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The ID of the campaign to retrieve", | |
| "example": "60d21b4667d0d8992e610c85" | |
| }, | |
| { | |
| "in": "query", | |
| "name": "warmupEmailCount", | |
| "required": false, | |
| "schema": { | |
| "type": "boolean" | |
| }, | |
| "description": "Flag to include warm-up email count statistics", | |
| "example": true | |
| }, | |
| { | |
| "in": "query", | |
| "name": "followUpEmailCount", | |
| "required": false, | |
| "schema": { | |
| "type": "boolean" | |
| }, | |
| "description": "Flag to include follow-up email count statistics", | |
| "example": true | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Campaign details retrieved successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "campaignDetails": { | |
| "type": "object", | |
| "description": "Full campaign details" | |
| }, | |
| "warmupEmailCount": { | |
| "type": "number", | |
| "description": "Count of warm-up emails (included if warmupEmailCount=true)", | |
| "example": 15 | |
| }, | |
| "followUpEmailCount": { | |
| "type": "number", | |
| "description": "Count of follow-up emails (included if followUpEmailCount=true)", | |
| "example": 8 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Missing required campaignId parameter", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "Campaign not found or not accessible", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "No such campaign exists, or is visible to you." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Server error during processing", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "An error occurred while processing the request." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/campaigns/list": { | |
| "get": { | |
| "summary": "List user campaigns", | |
| "description": "This endpoint retrieves a list of campaigns belonging to the authenticated user, optionally filtered by persona.", | |
| "tags": [ | |
| "campaigns" | |
| ], | |
| "security": [ | |
| { | |
| "BearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "query", | |
| "name": "persona", | |
| "required": false, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Filter campaigns by persona", | |
| "example": "maya", | |
| "default": "maya" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved campaigns list", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "campaigns": { | |
| "type": "array", | |
| "description": "List of user's campaigns", | |
| "items": { | |
| "type": "object", | |
| "description": "Campaign object with flattened structure (campaignData properties moved to root level)" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Server error during processing", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "campaigns": { | |
| "type": "array", | |
| "description": "Empty array returned on error", | |
| "items": { | |
| "type": "object" | |
| }, | |
| "example": [] | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/campaigns/replies": { | |
| "get": { | |
| "summary": "Get campaign reply count", | |
| "description": "Retrieves the total number of replies received for a specific campaign, including both email and WhatsApp replies.", | |
| "tags": [ | |
| "campaigns" | |
| ], | |
| "security": [ | |
| { | |
| "BearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "query", | |
| "name": "campaignId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The ID of the campaign to get reply counts for", | |
| "example": "65a23f8c7b12345678901234" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved campaign reply count", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "count": { | |
| "type": "integer", | |
| "description": "Total number of replies across all channels (email and WhatsApp)", | |
| "example": 42 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Server error during processing", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": {} | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/campaigns/workflows/generate/sales": { | |
| "post": { | |
| "tags": [ | |
| "workflows" | |
| ], | |
| "summary": "Generate a sales workflow YAML based on user prompt", | |
| "description": "Generates a customized workflow YAML configuration for sales automation based on the provided user prompt.", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "userPrompt" | |
| ], | |
| "properties": { | |
| "userPrompt": { | |
| "type": "string", | |
| "description": "User's natural language description of the desired workflow" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Successfully generated workflow YAML", | |
| "content": { | |
| "application/x-yaml": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "result": { | |
| "type": "string", | |
| "description": "Generated YAML workflow content" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Missing user prompt", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized access", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/chat/fetch/{chatId}": { | |
| "get": { | |
| "tags": [ | |
| "chat" | |
| ], | |
| "summary": "Fetch a specific chat history by ID", | |
| "description": "Retrieves chat history for a specific chat ID for the authenticated user", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "chatId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The MongoDB ObjectId of the chat to fetch" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved chat history", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "$ref": "#/components/schemas/ChatHistory" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid chat ID format" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not authenticated" | |
| }, | |
| "403": { | |
| "description": "Forbidden - User lacks required scope" | |
| }, | |
| "404": { | |
| "description": "Chat history not found" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/chat/fork": { | |
| "post": { | |
| "tags": [ | |
| "chat" | |
| ], | |
| "summary": "Fork a chat history from a specific message", | |
| "description": "Creates a new chat history by copying messages up to a specified message ID from an existing chat", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "chatId", | |
| "messageId" | |
| ], | |
| "properties": { | |
| "chatId": { | |
| "type": "string", | |
| "description": "ID of the original chat to fork from" | |
| }, | |
| "messageId": { | |
| "type": "string", | |
| "description": "ID of the message up to which the chat should be forked" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Chat successfully forked", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "forkedChatId": { | |
| "type": "string", | |
| "description": "ID of the newly created forked chat" | |
| }, | |
| "originalChatId": { | |
| "type": "string", | |
| "description": "ID of the original chat" | |
| }, | |
| "forkedAtMessageId": { | |
| "type": "string", | |
| "description": "ID of the message where the fork was created" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request body" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not authenticated" | |
| }, | |
| "403": { | |
| "description": "Forbidden - User lacks required permissions" | |
| }, | |
| "404": { | |
| "description": "Chat or message not found" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/chat/generate": { | |
| "post": { | |
| "parameters": [ | |
| { | |
| "name": "chatId", | |
| "in": "query", | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The ID of the chat (optional, can be null or undefined for a new chat)" | |
| }, | |
| { | |
| "name": "researchMode", | |
| "in": "query", | |
| "schema": { | |
| "type": "boolean" | |
| }, | |
| "description": "The flag to enable researching ICPs (default is false)" | |
| }, | |
| { | |
| "name": "stream", | |
| "in": "query", | |
| "schema": { | |
| "type": "boolean" | |
| }, | |
| "description": "The flag to enable streaming (default is false)" | |
| }, | |
| { | |
| "name": "phone", | |
| "in": "query", | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The phone number of the user (useful for WhatsApp chats, voice calls, etc.)" | |
| }, | |
| { | |
| "name": "username", | |
| "in": "query", | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The username of the user (useful for Telegram chats, Discord, Google, Slack, etc.)" | |
| }, | |
| { | |
| "name": "source", | |
| "in": "query", | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The source of the chat (useful for tracking the source of the chat - platform, integrations, etc.)" | |
| }, | |
| { | |
| "name": "title", | |
| "in": "query", | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The title of the chat (useful for tracking the chat in the database)" | |
| }, | |
| { | |
| "name": "scope", | |
| "in": "query", | |
| "schema": { | |
| "type": "string", | |
| "enum": [ | |
| "internal", | |
| "external" | |
| ], | |
| "default": "internal" | |
| }, | |
| "description": "The scope of the chat - in an external public facing environment, or an internal employee facing environment" | |
| }, | |
| { | |
| "name": "voice", | |
| "in": "query", | |
| "schema": { | |
| "type": "boolean" | |
| }, | |
| "description": "The flag to enable voice calls (default is false)" | |
| } | |
| ], | |
| "tags": [ | |
| "chat" | |
| ], | |
| "security": [ | |
| { | |
| "BearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "chat_history": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "lc": { | |
| "type": "number" | |
| }, | |
| "type": { | |
| "type": "string" | |
| }, | |
| "id": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| } | |
| }, | |
| "lc_kwargs": { | |
| "type": "object", | |
| "properties": { | |
| "content": { | |
| "type": "string" | |
| }, | |
| "additional_kwargs": { | |
| "type": "object" | |
| }, | |
| "response_metadata": { | |
| "type": "object" | |
| }, | |
| "tool_calls": { | |
| "type": "array" | |
| }, | |
| "invalid_tool_calls": { | |
| "type": "array" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "description": "Array of chat history in LangChain JSON format" | |
| }, | |
| "persona": { | |
| "type": "string", | |
| "description": "Optional persona for the chat" | |
| } | |
| }, | |
| "required": [ | |
| "chat_history" | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Successful generation of chat", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean" | |
| }, | |
| "result": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad Request: Missing or malformed parameters" | |
| }, | |
| "500": { | |
| "description": "Internal Server Error - Something went wrong on our end" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/chat/generate/stream": { | |
| "post": { | |
| "summary": "Generate streaming chat response", | |
| "description": "This endpoint processes user messages and streams back AI-generated responses, thinking steps, and metadata.", | |
| "tags": [ | |
| "chat" | |
| ], | |
| "security": [ | |
| { | |
| "BearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "chat_history" | |
| ], | |
| "properties": { | |
| "chatId": { | |
| "type": "string", | |
| "description": "ID of the chat session. If not provided, a new session will be created.", | |
| "example": "60d21b4667d0d8992e610c85" | |
| }, | |
| "chat_history": { | |
| "type": "array", | |
| "description": "Array of chat messages in LangChain format", | |
| "items": { | |
| "type": "object" | |
| } | |
| }, | |
| "persona": { | |
| "type": "string", | |
| "description": "Persona to use for response generation", | |
| "default": "maya", | |
| "example": "maya" | |
| }, | |
| "scope": { | |
| "type": "string", | |
| "description": "Scope of the conversation", | |
| "default": "internal", | |
| "example": "internal" | |
| }, | |
| "tools": { | |
| "type": "array", | |
| "description": "Optional tools available for the chat", | |
| "items": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Streaming response with thinking steps and final results", | |
| "content": { | |
| "text/event-stream": { | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "example": "data: {\"type\":\"thinking_update\",\"content\":\"Planning response\"}\ndata: {\"type\":\"thinking_update\",\"content\":\"Analyzing user request\"}\ndata: {\"type\":\"final_response\",\"content\":\"Here's your answer...\",\"json\":{}}\ndata: {\"type\":\"metadata\",\"content\":{\"chatId\":\"60d21b4667d0d8992e610c85\",\"title\":\"Discussion about AI ethics\",\"replaySessionID\":\"60d21b4667d0d8992e610c86\"}}\ndata: [DONE]\n" | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request parameters", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Invalid request" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "403": { | |
| "description": "Forbidden - User lacks required scope", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Forbidden" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Server error during processing", | |
| "content": { | |
| "text/event-stream": { | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "example": "data: {\"content\":null,\"error\":{\"message\":\"Internal server error\"}}\n" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/chat/history": { | |
| "get": { | |
| "summary": "Retrieve chat history", | |
| "description": "This endpoint allows an authenticated user to fetch a list of their chat histories.", | |
| "tags": [ | |
| "chat" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved chat history.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "chats": { | |
| "type": "array", | |
| "description": "A list of user chat histories.", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "title": { | |
| "type": "string", | |
| "description": "The title of the chat history.", | |
| "example": "Conversation with Maya" | |
| }, | |
| "id": { | |
| "type": "string", | |
| "description": "The unique ID of the chat history.", | |
| "example": "64a7f92e9b4f20c5d7f1aabc" | |
| }, | |
| "timestamp": { | |
| "type": "integer", | |
| "description": "The timestamp of the last update for the chat history in milliseconds.", | |
| "example": 1672531200000 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/chat/new": { | |
| "post": { | |
| "summary": "Save chat history", | |
| "description": "This endpoint allows an authenticated user to save a chat history with a title and messages that is create a new chat", | |
| "tags": [ | |
| "chat" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "title": { | |
| "type": "string", | |
| "description": "The title for the chat history.", | |
| "example": "Conversation with Maya" | |
| }, | |
| "messages": { | |
| "type": "array", | |
| "description": "An array of chat messages.", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "role": { | |
| "type": "string", | |
| "enum": [ | |
| "user", | |
| "assistant" | |
| ], | |
| "description": "Role of the speaker in the chat." | |
| }, | |
| "content": { | |
| "type": "string", | |
| "description": "Message content." | |
| } | |
| }, | |
| "example": { | |
| "role": "user", | |
| "content": "Hello, how are you?" | |
| } | |
| } | |
| } | |
| }, | |
| "required": [ | |
| "title", | |
| "messages" | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Chat history successfully saved.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "chatId": { | |
| "type": "string", | |
| "description": "The unique ID of the saved chat history.", | |
| "example": "64a7f92e9b4f20c5d7f1aabc" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal Server Error – Failed to create chat history.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "example": "Failed to create chat history" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/chat": { | |
| "post": { | |
| "summary": "Process user chat and return a response", | |
| "description": "This endpoint processes a user's chat request and returns a response based on the provided chat history and persona.", | |
| "tags": [ | |
| "chat" | |
| ], | |
| "security": [ | |
| { | |
| "BearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "chat_history": { | |
| "type": "array", | |
| "description": "The chat history exchanged so far in JSON format.", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "role": { | |
| "type": "string", | |
| "enum": [ | |
| "user", | |
| "assistant" | |
| ], | |
| "description": "Role of the speaker in the chat." | |
| }, | |
| "content": { | |
| "type": "string", | |
| "description": "Message content." | |
| } | |
| }, | |
| "example": { | |
| "role": "user", | |
| "content": "What is the weather like today?" | |
| } | |
| } | |
| }, | |
| "persona": { | |
| "type": "string", | |
| "description": "The persona to use for generating responses (e.g., 'maya').", | |
| "example": "maya" | |
| } | |
| }, | |
| "required": [ | |
| "chat_history" | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Chat response successfully generated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "result": { | |
| "type": "object", | |
| "description": "The final result from the chat API.", | |
| "example": { | |
| "message": "The weather today is sunny with a high of 75°F.", | |
| "persona": "maya" | |
| } | |
| }, | |
| "metadata": { | |
| "type": "object", | |
| "description": "Additional metadata about the response.", | |
| "properties": { | |
| "timeTaken": { | |
| "type": "number", | |
| "description": "Time taken to process the chat (in milliseconds).", | |
| "example": 200 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "Not Found – No response generated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "No response generated" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal Server Error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Internal Server Error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/context/add": { | |
| "post": { | |
| "summary": "Add context data to the context processor", | |
| "description": "This endpoint accepts context data and sends it to a context processor for further handling. It returns a success or error response depending on the result from the context processor.", | |
| "tags": [ | |
| "context" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "userId": { | |
| "type": "string", | |
| "description": "The unique identifier of the user submitting the context data.", | |
| "example": "user123" | |
| }, | |
| "context": { | |
| "type": "string", | |
| "description": "The context data to be processed by the context processor.", | |
| "example": "User is looking for product recommendations in the tech category." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Context added successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": true | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Context added successfully." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request – Invalid or missing context data", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "Fields missing. Detailed error: {error details}" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User is not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal error during context processing", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "Error encountered: {error details}" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/context/delete": { | |
| "post": { | |
| "tags": [ | |
| "context" | |
| ], | |
| "summary": "Delete context data", | |
| "description": "Deletes context data based on provided parameters", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "source": { | |
| "type": "string", | |
| "description": "Source identifier for the context" | |
| }, | |
| "user_id": { | |
| "type": "string", | |
| "description": "Optional user ID", | |
| "nullable": true | |
| }, | |
| "organization_id": { | |
| "type": "string", | |
| "description": "Optional organization ID", | |
| "nullable": true | |
| }, | |
| "by_doc": { | |
| "type": "boolean", | |
| "description": "Flag to delete by document", | |
| "default": true, | |
| "nullable": true | |
| }, | |
| "by_id": { | |
| "type": "boolean", | |
| "description": "Flag to delete by ID", | |
| "default": false, | |
| "nullable": true | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "204": { | |
| "description": "Successfully deleted context", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request parameters" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not authenticated" | |
| }, | |
| "403": { | |
| "description": "Forbidden - User lacks required permissions" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/context/search": { | |
| "post": { | |
| "summary": "Search for context data in the context processor", | |
| "description": "This endpoint sends a search request to the context processor to retrieve relevant context data based on the provided query.", | |
| "tags": [ | |
| "context" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "query": { | |
| "type": "string", | |
| "description": "The search query used to search for context data.", | |
| "example": "search query for user preferences" | |
| }, | |
| "limit": { | |
| "type": "integer", | |
| "description": "The maximum number of results to retrieve.", | |
| "example": 10 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "202": { | |
| "description": "Context search request successfully processed", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "results": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "contextId": { | |
| "type": "string", | |
| "description": "The unique identifier of the context.", | |
| "example": "context123" | |
| }, | |
| "contextData": { | |
| "type": "string", | |
| "description": "The context data returned by the processor.", | |
| "example": "User's preferences for product recommendations." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request – Invalid or missing search parameters", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "Fields missing. Detailed error: {error details}" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal error during context search processing", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "Error encountered: {error details}" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/context/view/docs": { | |
| "get": { | |
| "tags": [ | |
| "context" | |
| ], | |
| "summary": "Retrieve user contexts by documents.", | |
| "description": "Fetches documents view for authenticated user with optional organization context", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved documents view", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not authenticated" | |
| }, | |
| "402": { | |
| "description": "Invalid user" | |
| }, | |
| "403": { | |
| "description": "Forbidden - User lacks required scope" | |
| }, | |
| "default": { | |
| "description": "Unexpected error from context processor" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/context/view": { | |
| "get": { | |
| "tags": [ | |
| "context" | |
| ], | |
| "summary": "Retrieve user context", | |
| "description": "Gets the context information for the authenticated user", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved context", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "context": { | |
| "type": "array", | |
| "description": "List of context items" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not authenticated" | |
| }, | |
| "403": { | |
| "description": "Forbidden - User doesn't have required scope" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/copilot": { | |
| "post": { | |
| "summary": "Trigger the copilot action", | |
| "description": "This endpoint triggers the copilot action and returns a successful response with status 201.", | |
| "tags": [ | |
| "copilot" | |
| ], | |
| "responses": { | |
| "201": { | |
| "description": "Copilot action triggered successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": true | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/dashboard": { | |
| "get": { | |
| "summary": "Get API request analytics", | |
| "description": "This endpoint retrieves aggregated API request data grouped by API key and time for the authenticated user.", | |
| "security": [ | |
| { | |
| "BearerAuth": [] | |
| } | |
| ], | |
| "tags": [ | |
| "dashboard" | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved analytics.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": true | |
| }, | |
| "entries": { | |
| "type": "object", | |
| "properties": { | |
| "byApiKey": { | |
| "type": "array", | |
| "description": "Aggregated API request data grouped by API key.", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "id": { | |
| "type": "string", | |
| "description": "API key ID.", | |
| "example": "64dbfdd2f7a01c28ed123456" | |
| }, | |
| "label": { | |
| "type": "string", | |
| "description": "Name of the API key.", | |
| "example": "My API Key" | |
| }, | |
| "count": { | |
| "type": "integer", | |
| "description": "Number of requests made using this API key.", | |
| "example": 42 | |
| } | |
| } | |
| } | |
| }, | |
| "byTime": { | |
| "type": "array", | |
| "description": "Aggregated API request data grouped by time.", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "id": { | |
| "type": "string", | |
| "description": "Grouping ID (e.g., date or timestamp).", | |
| "example": "2024-12-01" | |
| }, | |
| "label": { | |
| "type": "string", | |
| "description": "Name or label for the time group.", | |
| "example": "December 2024" | |
| }, | |
| "count": { | |
| "type": "integer", | |
| "description": "Number of requests made during this time period.", | |
| "example": 57 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "status": { | |
| "type": "integer", | |
| "example": 200 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": false | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| }, | |
| "status": { | |
| "type": "integer", | |
| "example": 401 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal Server Error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": false | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Something went wrong" | |
| }, | |
| "status": { | |
| "type": "integer", | |
| "example": 500 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/emails/analytics/spamCheck/apilayer": { | |
| "post": { | |
| "tags": [ | |
| "emails" | |
| ], | |
| "summary": "Check if an email content is spam", | |
| "description": "Analyzes email content using APILayer's spam detection service", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "emailBody" | |
| ], | |
| "properties": { | |
| "emailBody": { | |
| "type": "string", | |
| "description": "The content of the email to check for spam" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Spam check results", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "example": "Email body not found" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "405": { | |
| "description": "Method not allowed", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "example": "Method not allowed" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/emails/analytics/spamCheck/native": { | |
| "post": { | |
| "tags": [ | |
| "emails" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "summary": "Check and delete emails from spam folder", | |
| "description": "Searches for specific emails in the spam folder and deletes them if found", | |
| "requestBody": { | |
| "required": false, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Successfully checked spam folder", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "No message found in Spam folder" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "405": { | |
| "description": "Method not allowed", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Method Not Allowed" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Server error", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Unknown error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/emails/analytics/spamCheck": { | |
| "post": { | |
| "summary": "Delete spam emails from Gmail", | |
| "description": "This endpoint connects to Gmail via IMAP, searches for messages from a specific email address in the Spam folder, and deletes them.", | |
| "tags": [ | |
| "emails" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": false, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "username": { | |
| "type": "string", | |
| "description": "The IMAP username (Gmail email).", | |
| "example": "user@example.com" | |
| }, | |
| "password": { | |
| "type": "string", | |
| "description": "The IMAP password (Gmail password or app-specific password).", | |
| "example": "password123" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "No message found in Spam folder", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "No message found in Spam folder" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "204": { | |
| "description": "Successfully found and deleted messages from the Spam folder.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Found and deleted message(s) in Spam folder" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "405": { | |
| "description": "Method Not Allowed – Invalid HTTP method.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Method Not Allowed" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal Server Error – An error occurred while connecting to IMAP or processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "IMAP request error: Unknown error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/emails/generate/bulk": { | |
| "post": { | |
| "summary": "Generate bulk emails for leads", | |
| "description": "This endpoint generates a batch of emails based on the provided leads information, subject line, agenda, and other optional parameters.", | |
| "tags": [ | |
| "emails" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "leadsInfo": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "description": "Array of lead information used for generating emails.", | |
| "example": [ | |
| { | |
| "name": "John Doe", | |
| "email": "john.doe@example.com" | |
| } | |
| ] | |
| } | |
| }, | |
| "agenda": { | |
| "type": "string", | |
| "description": "The agenda or main content to be included in the generated emails.", | |
| "example": "Discussing the next quarter's plans." | |
| }, | |
| "personaInstructions": { | |
| "type": "string", | |
| "description": "Instructions for the persona that will be used to generate the emails.", | |
| "example": "The persona should sound professional and formal." | |
| }, | |
| "subjectLine": { | |
| "type": "string", | |
| "description": "The subject line for the emails.", | |
| "example": "Important Meeting - Next Steps" | |
| }, | |
| "autogenSubjectLine": { | |
| "type": "boolean", | |
| "description": "Whether to auto-generate the subject line based on the agenda.", | |
| "example": true | |
| }, | |
| "batchSize": { | |
| "type": "integer", | |
| "description": "The batch size to be used when generating emails.", | |
| "example": 20 | |
| } | |
| }, | |
| "required": [ | |
| "leadsInfo", | |
| "agenda", | |
| "subjectLine", | |
| "autogenSubjectLine" | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Emails generated successfully.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "results": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "description": "The generated emails." | |
| }, | |
| "example": [ | |
| { | |
| "to": "john.doe@example.com", | |
| "body": "Hello John, please find the meeting agenda attached.", | |
| "subject": "Meeting Agenda - Next Steps" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "405": { | |
| "description": "Method Not Allowed – Invalid HTTP method.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Method Not Allowed" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal Server Error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Error generating bulk emails" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/emails/send/batch": { | |
| "post": { | |
| "summary": "Send bulk emails", | |
| "description": "This endpoint allows an authenticated user to send multiple emails in bulk.", | |
| "tags": [ | |
| "emails" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "emails": { | |
| "type": "array", | |
| "description": "List of emails to send", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "sender": { | |
| "type": "string", | |
| "description": "The email address of the sender (must be signed in).", | |
| "example": "user@example.com" | |
| }, | |
| "to": { | |
| "type": "string", | |
| "description": "The recipient's email address.", | |
| "example": "recipient@example.com" | |
| }, | |
| "subject": { | |
| "type": "string", | |
| "description": "The subject of the email.", | |
| "example": "Meeting Update" | |
| }, | |
| "html": { | |
| "type": "string", | |
| "description": "The HTML content of the email.", | |
| "example": "<h1>Meeting Agenda</h1><p>Please find the attached agenda.</p>" | |
| }, | |
| "text": { | |
| "type": "string", | |
| "description": "The plain text content of the email.", | |
| "example": "Meeting Agenda: Please find the attached agenda." | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "required": [ | |
| "emails" | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "202": { | |
| "description": "Bulk email process initiated successfully.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "3/5 emails sent successfully" | |
| }, | |
| "emailsGenerated": { | |
| "type": "number", | |
| "example": 5 | |
| }, | |
| "emailsSent": { | |
| "type": "number", | |
| "example": 3 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "405": { | |
| "description": "Method Not Allowed – Invalid HTTP method.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Method Not Allowed" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal Server Error – Failed to process bulk email sending.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Error sending email" | |
| }, | |
| "emailsGenerated": { | |
| "type": "number", | |
| "example": 0 | |
| }, | |
| "emailsSent": { | |
| "type": "number", | |
| "example": 0 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/emails/send": { | |
| "post": { | |
| "summary": "Send an email", | |
| "description": "This endpoint allows an authenticated user to send an email using their configured email credentials.", | |
| "tags": [ | |
| "emails" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "sender": { | |
| "type": "string", | |
| "description": "The email address of the sender (must be signed in).", | |
| "example": "user@example.com" | |
| }, | |
| "from": { | |
| "type": "string", | |
| "description": "The 'From' email address.", | |
| "example": "User <user@example.com>" | |
| }, | |
| "to": { | |
| "type": "string", | |
| "description": "The recipient's email address.", | |
| "example": "recipient@example.com" | |
| }, | |
| "subject": { | |
| "type": "string", | |
| "description": "The subject of the email.", | |
| "example": "Meeting Update" | |
| }, | |
| "html": { | |
| "type": "string", | |
| "description": "The HTML content of the email.", | |
| "example": "<h1>Meeting Agenda</h1><p>Please find the attached agenda.</p>" | |
| }, | |
| "text": { | |
| "type": "string", | |
| "description": "The plain text content of the email.", | |
| "example": "Meeting Agenda: Please find the attached agenda." | |
| } | |
| }, | |
| "required": [ | |
| "sender", | |
| "to", | |
| "subject", | |
| "html", | |
| "text" | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "202": { | |
| "description": "Email sent successfully.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Email sent successfully" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "Sender email not signed in.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Sender email address has not been signed in. Are you sure you signed in?" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "405": { | |
| "description": "Method Not Allowed – Invalid HTTP method.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Method Not Allowed" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal Server Error – Failed to send the email.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Error sending email" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/emails/track/{messageId}": { | |
| "get": { | |
| "tags": [ | |
| "emails" | |
| ], | |
| "summary": "Track email open status", | |
| "description": "Updates the open status of a specific email message", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "messageId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Unique identifier of the email message" | |
| }, | |
| { | |
| "in": "query", | |
| "name": "campaignId", | |
| "required": true, | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "ID of the campaign associated with the email" | |
| }, | |
| { | |
| "in": "query", | |
| "name": "sender", | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "Email sender information" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Email tracking status updated successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Email with ID abc123 has been opened." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid email ID format", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "example": "Invalid email ID format" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "example": "Internal Server Error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/inbox/add": { | |
| "post": { | |
| "summary": "Save email credentials", | |
| "description": "This endpoint saves the email credentials for the authenticated user, including IMAP and SMTP configurations.", | |
| "tags": [ | |
| "inbox" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "email", | |
| "password", | |
| "provider" | |
| ], | |
| "properties": { | |
| "email": { | |
| "type": "string", | |
| "description": "The email address to save.", | |
| "example": "user@example.com" | |
| }, | |
| "password": { | |
| "type": "string", | |
| "description": "The password for the email account.", | |
| "example": "password123" | |
| }, | |
| "meetingLink": { | |
| "type": "string", | |
| "description": "Optional link for meeting-related information.", | |
| "example": "https://example.com/meeting-link" | |
| }, | |
| "provider": { | |
| "type": "string", | |
| "description": "The email provider (e.g., Gmail, Yahoo).", | |
| "example": "Gmail" | |
| }, | |
| "providerIMAPHost": { | |
| "type": "string", | |
| "description": "The IMAP host for the email provider.", | |
| "example": "imap.gmail.com" | |
| }, | |
| "providerIMAPPort": { | |
| "type": "integer", | |
| "description": "The IMAP port for the email provider.", | |
| "example": 993 | |
| }, | |
| "providerSMTPHost": { | |
| "type": "string", | |
| "description": "The SMTP host for the email provider.", | |
| "example": "smtp.gmail.com" | |
| }, | |
| "providerSMTPPort": { | |
| "type": "integer", | |
| "description": "The SMTP port for the email provider.", | |
| "example": 587 | |
| }, | |
| "providerInboxName": { | |
| "type": "string", | |
| "description": "The name of the inbox in the provider's system.", | |
| "example": "Inbox" | |
| }, | |
| "providerSentBoxName": { | |
| "type": "string", | |
| "description": "The name of the sent box in the provider's system.", | |
| "example": "Sent" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Successfully saved the email credentials.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Credentials saved successfully. Saved ID = 12345" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request – Missing or invalid fields.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Missing required fields" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated or found.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "User not found." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Error message" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/inbox/auth": { | |
| "get": { | |
| "summary": "Check for associated email inboxes", | |
| "description": "This endpoint checks if the authenticated user has any associated email inboxes. If no associated inboxes are found, returns an appropriate message.", | |
| "tags": [ | |
| "inbox" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "No associated inboxes found.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "ok" | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "No associated inboxes found." | |
| }, | |
| "data": { | |
| "type": "array", | |
| "items": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "201": { | |
| "description": "Successfully checked associated inboxes.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "ok" | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Success" | |
| }, | |
| "isAuthenticated": { | |
| "type": "boolean", | |
| "description": "Indicates if the user has associated inboxes.", | |
| "example": true | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "User not found." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Internal Server Error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/inbox/delete": { | |
| "delete": { | |
| "summary": "Delete an email inbox and its associated data", | |
| "description": "This endpoint deletes an email inbox associated with the authenticated user. It optionally removes associated context and calendar events based on query parameters.", | |
| "tags": [ | |
| "inbox" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "query", | |
| "name": "email", | |
| "required": true, | |
| "description": "The email inbox to delete.", | |
| "schema": { | |
| "type": "string", | |
| "example": "user@example.com" | |
| } | |
| }, | |
| { | |
| "in": "query", | |
| "name": "remove_context", | |
| "required": false, | |
| "description": "Flag indicating whether to remove associated context. Defaults to false.", | |
| "schema": { | |
| "type": "string", | |
| "enum": [ | |
| "true", | |
| "false" | |
| ], | |
| "default": "false" | |
| } | |
| }, | |
| { | |
| "in": "query", | |
| "name": "remove_events", | |
| "required": false, | |
| "description": "Flag indicating whether to remove associated calendar events. Defaults to false.", | |
| "schema": { | |
| "type": "string", | |
| "enum": [ | |
| "true", | |
| "false" | |
| ], | |
| "default": "false" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully deleted the email inbox and any associated context or events if specified.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "ok" | |
| }, | |
| "emailId": { | |
| "type": "string", | |
| "description": "The email inbox that was deleted.", | |
| "example": "user@example.com" | |
| }, | |
| "removedContexts": { | |
| "type": "integer", | |
| "description": "The number of associated contexts removed.", | |
| "example": 2 | |
| }, | |
| "removedEvents": { | |
| "type": "integer", | |
| "description": "The number of associated calendar events removed.", | |
| "example": 3 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request – Missing or invalid email parameter.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "error" | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "No email inbox specified to delete. Use `email` query parameter." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User is not authenticated or current user not found.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "error" | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Current user not found." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "Not Found – Email inbox not found or could not be deleted.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "error" | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Email inbox not found or could not be deleted." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "error" | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "An internal server error occurred" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/inbox/list": { | |
| "get": { | |
| "summary": "Retrieve the email credentials of an authenticated user", | |
| "description": "This endpoint retrieves the email credentials (email IDs, passwords, and meeting links) associated with the authenticated user. If the 'emailsOnly' query parameter is provided, only email IDs will be returned.", | |
| "tags": [ | |
| "inbox" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "query", | |
| "name": "emailsOnly", | |
| "required": false, | |
| "description": "A flag to retrieve only email IDs. If true, only email IDs are returned.", | |
| "schema": { | |
| "type": "string", | |
| "enum": [ | |
| "true", | |
| "false" | |
| ], | |
| "default": "false" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved email credentials or email IDs", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "emailId": { | |
| "type": "string", | |
| "description": "The unique identifier of the email account.", | |
| "example": "user@example.com" | |
| }, | |
| "password": { | |
| "type": "string", | |
| "description": "The decrypted password of the email account (only if 'emailsOnly' is not set to true).", | |
| "example": "password123" | |
| }, | |
| "meetingLink": { | |
| "type": "string", | |
| "description": "The meeting link associated with the email account.", | |
| "example": "https://zoom.us/j/123456789" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request – Invalid method", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Invalid method" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not found", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "User not found" | |
| }, | |
| "response": { | |
| "type": "string", | |
| "example": "error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "An internal server error occurred" | |
| }, | |
| "response": { | |
| "type": "string", | |
| "example": "error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/inbox": { | |
| "post": { | |
| "summary": "Check email threads for associated inboxes", | |
| "description": "This endpoint allows the user to check email threads for their associated inboxes. It will return the thread IDs that match the provided list of emails.", | |
| "tags": [ | |
| "inbox" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "emailsToCheck": { | |
| "type": "array", | |
| "items": { | |
| "type": "string", | |
| "format": "email" | |
| }, | |
| "description": "List of email addresses to check for threads." | |
| } | |
| }, | |
| "required": [ | |
| "emailsToCheck" | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Successfully fetched thread IDs.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "threads": { | |
| "type": "array", | |
| "items": { | |
| "type": "string", | |
| "description": "List of thread IDs for the specified emails." | |
| } | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Found X threads" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad Request – No emails provided or invalid input.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "No emails to check." | |
| }, | |
| "response": { | |
| "type": "string", | |
| "example": "error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "User not found" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Error fetching thread IDs" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/inbox/thread": { | |
| "post": { | |
| "summary": "Fetch emails by thread ID or subject", | |
| "description": "This endpoint fetches emails for the authenticated user based on a provided thread ID or subject. It retrieves emails associated with the user's inboxes.", | |
| "tags": [ | |
| "inbox" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "threadId": { | |
| "type": "string", | |
| "description": "The ID of the email thread to fetch emails from." | |
| }, | |
| "subject": { | |
| "type": "string", | |
| "description": "The subject of the emails to fetch." | |
| } | |
| }, | |
| "required": [ | |
| "threadId", | |
| "subject" | |
| ], | |
| "example": { | |
| "threadId": "12345", | |
| "subject": "Meeting Updates" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Successfully fetched emails.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "emails": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "description": "List of emails matching the criteria." | |
| }, | |
| "example": [ | |
| { | |
| "emailId": "test@example.com", | |
| "subject": "Meeting Update", | |
| "content": "Please find the meeting agenda attached." | |
| } | |
| ] | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Found 5 emails" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad Request – Invalid request data.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Invalid request data" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "405": { | |
| "description": "Method Not Allowed – Invalid HTTP method.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Method not allowed" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal Server Error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Internal Server Error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/inbox/update": { | |
| "post": { | |
| "summary": "Update email inbox credentials", | |
| "description": "This endpoint allows the user to update their email inbox credentials, including password and meeting link.", | |
| "tags": [ | |
| "inbox" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "email": { | |
| "type": "string", | |
| "description": "Email address of the inbox to be updated." | |
| }, | |
| "password": { | |
| "type": "string", | |
| "description": "New password for the email inbox." | |
| }, | |
| "meetingLink": { | |
| "type": "string", | |
| "description": "Updated meeting link for the inbox." | |
| } | |
| }, | |
| "required": [ | |
| "email", | |
| "password", | |
| "meetingLink" | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Email inbox updated successfully.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "ok" | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Inbox updated successfully." | |
| }, | |
| "updateInboxResult": { | |
| "type": "object", | |
| "description": "Details of the update operation." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated or invalid data.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "User not found" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "Not Found – The inbox to update does not exist.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "response": { | |
| "type": "string", | |
| "example": "error" | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Failed to update the inbox. It may not exist." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Internal Server Error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/instructions": { | |
| "get": { | |
| "tags": [ | |
| "instructions" | |
| ], | |
| "summary": "Retrieve instructions for a specific persona", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "query", | |
| "name": "persona", | |
| "schema": { | |
| "type": "string" | |
| }, | |
| "description": "The persona to get instructions for (defaults to 'maya')" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved instructions", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean" | |
| }, | |
| "instructions": { | |
| "type": "array" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized" | |
| }, | |
| "404": { | |
| "description": "No policy or context found" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| }, | |
| "post": { | |
| "tags": [ | |
| "instructions" | |
| ], | |
| "summary": "Create or update instructions for a persona", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "instructions", | |
| "personality", | |
| "client_id" | |
| ], | |
| "properties": { | |
| "instructions": { | |
| "type": "array" | |
| }, | |
| "personality": { | |
| "type": "string" | |
| }, | |
| "client_id": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Context updated successfully" | |
| }, | |
| "201": { | |
| "description": "New context created successfully" | |
| }, | |
| "400": { | |
| "description": "Missing required fields" | |
| }, | |
| "401": { | |
| "description": "Unauthorized" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/leads/augment": { | |
| "post": { | |
| "summary": "Augment leads data using user prompt and webpage URL", | |
| "description": "This endpoint accepts a user prompt and a webpage URL, scrapes data from the webpage, and generates a response based on the scraped content.", | |
| "tags": [ | |
| "leads" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "userPrompt": { | |
| "type": "string", | |
| "description": "User's prompt instructing the transformation or manipulation of the webpage data.", | |
| "example": "Summarize the key products on this page." | |
| }, | |
| "pageUrl": { | |
| "type": "string", | |
| "description": "URL of the webpage to scrape data from.", | |
| "example": "https://www.example.com/products" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Successfully processed the webpage data and generated the response", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "result": { | |
| "type": "string", | |
| "description": "Generated result based on the webpage data and the user prompt", | |
| "example": "The key products on the page are..." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request – Invalid or missing input data", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Invalid request body" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Error processing the webpage or generating the response", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Couldn't generate answer" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/leads/augment/web/batch": { | |
| "post": { | |
| "tags": [ | |
| "leads", | |
| "augment" | |
| ], | |
| "summary": "Batch process leads with web search augmentation", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "userPrompt", | |
| "dataForSearchQueries" | |
| ], | |
| "properties": { | |
| "userPrompt": { | |
| "type": "string", | |
| "description": "User's query or instructions for augmenting lead data" | |
| }, | |
| "dataForSearchQueries": { | |
| "type": "array", | |
| "items": { | |
| "type": "object" | |
| }, | |
| "description": "Array of lead data objects to process" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Successfully processed leads", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "query": { | |
| "type": "object", | |
| "description": "Original lead data" | |
| }, | |
| "result": { | |
| "type": "object", | |
| "description": "Augmented lead data" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User authentication required" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/leads/augment/web": { | |
| "post": { | |
| "summary": "Augment search results data using user prompt and search query", | |
| "description": "This endpoint accepts a user prompt and a search query regarding the lead, processes the query with web search results, and generates a response based on the data.", | |
| "tags": [ | |
| "leads" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "userPrompt": { | |
| "type": "string", | |
| "description": "User's prompt instructing the transformation or manipulation of the search query results.", | |
| "example": "Summarize the main points from the search results." | |
| }, | |
| "dataForSearchQuery": { | |
| "type": "string", | |
| "description": "The query data used to fetch web search results.", | |
| "example": "latest technology trends" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Successfully processed the search query and generated the response", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "result": { | |
| "type": "string", | |
| "description": "Generated result based on the search query and the user prompt", | |
| "example": "The latest technology trends include AI advancements, quantum computing, and blockchain innovations." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request – Invalid or missing input data", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Invalid request body" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User is not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Error processing the search query or generating the response", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Couldn't generate answer" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/leads/fetch-alt": { | |
| "post": { | |
| "tags": [ | |
| "leads" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "summary": "Fetch leads with filters from BigQuery table.", | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "filters": { | |
| "type": "object", | |
| "required": true | |
| }, | |
| "count": { | |
| "type": "number", | |
| "required": false | |
| }, | |
| "offset": { | |
| "type": "number", | |
| "required": false | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Successfully fetched leads" | |
| }, | |
| "400": { | |
| "description": "Invalid request" | |
| }, | |
| "401": { | |
| "description": "Unauthorized" | |
| }, | |
| "402": { | |
| "description": "Payment required" | |
| }, | |
| "403": { | |
| "description": "Forbidden" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/leads/fetch": { | |
| "post": { | |
| "tags": [ | |
| "leads" | |
| ], | |
| "summary": "Fetch leads based on filters from SuccessAI.", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "count", | |
| "offset", | |
| "filters" | |
| ], | |
| "properties": { | |
| "count": { | |
| "type": "number", | |
| "description": "Number of leads to fetch" | |
| }, | |
| "offset": { | |
| "type": "number", | |
| "description": "Pagination offset" | |
| }, | |
| "filters": { | |
| "$ref": "#/components/schemas/SuccessAILeadSchema" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Successfully fetched leads", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/components/schemas/Lead" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request parameters" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - Missing or invalid authentication" | |
| }, | |
| "402": { | |
| "description": "Payment Required - Insufficient credits or billing issues" | |
| }, | |
| "403": { | |
| "description": "Forbidden - User lacks required permissions" | |
| }, | |
| "500": { | |
| "description": "Internal server error while fetching leads" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/leads/integrations/linkedin/enrich": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Enriches LinkedIn leads data with additional information", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "required": [ | |
| "url", | |
| "timestamp", | |
| "responseData" | |
| ], | |
| "properties": { | |
| "url": { | |
| "type": "string", | |
| "description": "LinkedIn URL for the lead" | |
| }, | |
| "timestamp": { | |
| "type": "string", | |
| "description": "Timestamp of the data collection" | |
| }, | |
| "responseData": { | |
| "type": "object", | |
| "properties": { | |
| "metadata": { | |
| "type": "object" | |
| }, | |
| "elements": { | |
| "type": "array", | |
| "items": { | |
| "type": "object" | |
| } | |
| }, | |
| "paging": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Successfully enriched leads data", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "type": "array" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Invalid request body format" | |
| }, | |
| "401": { | |
| "description": "Unauthorized - User not found" | |
| }, | |
| "402": { | |
| "description": "Invalid user" | |
| }, | |
| "403": { | |
| "description": "Insufficient permissions" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/policies": { | |
| "post": { | |
| "summary": "Set a governing policy for the user", | |
| "description": "This endpoint allows the user to set a governing policy with specific configuration.", | |
| "tags": [ | |
| "policies" | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "policyConfig": { | |
| "type": "object", | |
| "description": "The configuration settings for the policy.", | |
| "example": { | |
| "policyType": "privacy", | |
| "allowedCountries": [ | |
| "US", | |
| "CA" | |
| ], | |
| "dataRetentionPeriod": 365 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Policy successfully set", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": true | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Policy set successfully" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": false | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/profile": { | |
| "get": { | |
| "summary": "Retrieve the current user's ID", | |
| "description": "This endpoint returns the ID of the user associated with the provided request.", | |
| "tags": [ | |
| "profile" | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved the user's ID", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "userId": { | |
| "type": "string", | |
| "description": "The ID of the user", | |
| "example": "607f1f77bcf86cd799439011" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request – Invalid method used", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Invalid method" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized access – User not found", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "User not found" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/settings/api-keys/delete": { | |
| "post": { | |
| "summary": "Delete an API key", | |
| "description": "This endpoint deletes an API key entry from the database using the provided API key.", | |
| "tags": [ | |
| "api-keys" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "apiKey": { | |
| "type": "string", | |
| "description": "The API key to be deleted.", | |
| "example": "abc123xyz" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "API key successfully deleted", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": true | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Entry deleted." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": false | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "An internal server error occurred" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/settings/api-keys/list": { | |
| "get": { | |
| "summary": "Retrieve all API keys associated with a user", | |
| "description": "This endpoint retrieves all API keys linked to the authenticated user’s account.", | |
| "tags": [ | |
| "api-keys" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved API keys", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": true | |
| }, | |
| "apiKeys": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "apiKey": { | |
| "type": "string", | |
| "description": "The unique identifier of the API key.", | |
| "example": "abc123xyz" | |
| }, | |
| "creator": { | |
| "type": "string", | |
| "description": "The user ID of the creator.", | |
| "example": "user123" | |
| }, | |
| "createdAt": { | |
| "type": "string", | |
| "format": "date-time", | |
| "description": "The creation timestamp of the API key.", | |
| "example": "2024-12-24T12:00:00Z" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized – User not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": false | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "Unauthorized" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error – An error occurred while processing the request.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": false | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "An internal server error occurred" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/settings/api-keys/new": { | |
| "post": { | |
| "tags": [ | |
| "api-keys" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "summary": "Generate a new API key", | |
| "description": "Creates a new API key for the authenticated user", | |
| "requestBody": { | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "name": { | |
| "type": "string", | |
| "description": "Name for the API key" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "API key created successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean" | |
| }, | |
| "apiKey": { | |
| "type": "string" | |
| }, | |
| "name": { | |
| "type": "string" | |
| }, | |
| "status": { | |
| "type": "number" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "User not found" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| }, | |
| "/api/settings/api-keys/validate": { | |
| "get": { | |
| "tags": [ | |
| "api-keys" | |
| ], | |
| "summary": "Validates user access and retrieves organization details", | |
| "description": "Validates if the user has required scope and returns user and organization information", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successful validation", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "user": { | |
| "type": "object", | |
| "description": "User information" | |
| }, | |
| "organization": { | |
| "type": "object", | |
| "description": "Organization details" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized access", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "You're not allowed to access this API" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/status": { | |
| "get": { | |
| "tags": [ | |
| "status" | |
| ], | |
| "summary": "Get authenticated user status", | |
| "description": "Retrieves the current authenticated user's information", | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successfully retrieved user information", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "type": "object", | |
| "properties": { | |
| "email": { | |
| "type": "string" | |
| }, | |
| "name": { | |
| "type": "string" | |
| }, | |
| "handle": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "User not found or not authenticated", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "type": null | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/upload": { | |
| "post": { | |
| "tags": [ | |
| "context" | |
| ], | |
| "summary": "Upload and process a PDF file", | |
| "description": "This endpoint accepts a PDF file, processes it, and returns the extracted text.", | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "multipart/form-data": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "file": { | |
| "type": "string", | |
| "format": "binary", | |
| "description": "PDF file to be uploaded and processed" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Successfully processed PDF and extracted text", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "text": { | |
| "type": "string", | |
| "description": "Extracted text from the uploaded PDF", | |
| "example": "This is the extracted text from the PDF." | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "No file uploaded", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "No file uploaded" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Error processing the PDF file", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "message": { | |
| "type": "string", | |
| "example": "Error processing PDF file" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/whatsapptemplates/create": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "security": [ | |
| { | |
| "bearerAuth": [] | |
| } | |
| ], | |
| "summary": "Creates WhatsApp templates for multiple phone numbers", | |
| "description": "Creates WhatsApp message templates for specified phone numbers if they don't already exist", | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "name", | |
| "phoneNumbers" | |
| ], | |
| "properties": { | |
| "name": { | |
| "type": "string", | |
| "description": "Name of the template to create" | |
| }, | |
| "phoneNumbers": { | |
| "type": "array", | |
| "items": { | |
| "type": "string" | |
| }, | |
| "description": "Array of phone numbers to create templates for" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Templates created successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| }, | |
| "400": { | |
| "description": "Failed to create one or more templates", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object" | |
| } | |
| } | |
| } | |
| }, | |
| "404": { | |
| "description": "User not found", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "success": { | |
| "type": "boolean", | |
| "example": false | |
| }, | |
| "message": { | |
| "type": "string", | |
| "example": "User does not exist" | |
| }, | |
| "status": { | |
| "type": "number", | |
| "example": 404 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "example": "Internal Server Error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/api/whatsapptemplates": { | |
| "post": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Create a new WhatsApp template", | |
| "description": "Creates a new WhatsApp message template with placeholders validation", | |
| "requestBody": { | |
| "required": true, | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "required": [ | |
| "name", | |
| "category", | |
| "body", | |
| "language" | |
| ], | |
| "properties": { | |
| "name": { | |
| "type": "string", | |
| "description": "Template name" | |
| }, | |
| "category": { | |
| "type": "string", | |
| "description": "Template category" | |
| }, | |
| "body": { | |
| "type": "object", | |
| "properties": { | |
| "bodyText": { | |
| "type": "string", | |
| "description": "Template text with placeholders in {{n}} format" | |
| }, | |
| "examples": { | |
| "type": "array", | |
| "description": "Example values for placeholders", | |
| "items": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| }, | |
| "language": { | |
| "type": "string", | |
| "description": "Template language code" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "201": { | |
| "description": "Template created successfully" | |
| }, | |
| "400": { | |
| "description": "Invalid request or mismatch in placeholders and examples" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| }, | |
| "get": { | |
| "tags": [ | |
| "Integrations" | |
| ], | |
| "summary": "Get all WhatsApp templates", | |
| "description": "Retrieves a list of all WhatsApp templates with name and body text", | |
| "responses": { | |
| "200": { | |
| "description": "List of templates retrieved successfully", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "templates": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "properties": { | |
| "name": { | |
| "type": "string" | |
| }, | |
| "body": { | |
| "type": "object", | |
| "properties": { | |
| "bodyText": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "components": { | |
| "securitySchemes": { | |
| "BearerAuth": { | |
| "type": "http", | |
| "scheme": "bearer", | |
| "bearerFormat": "JWT" | |
| } | |
| } | |
| }, | |
| "tags": [] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment