{
  "openapi": "3.0.1",
  "info": {
    "title": "ChatDash API Documentation",
    "description": "API Documentation for the ChatDash Server",
    "version": "2.0.0"
  },
  "servers": [
    {
      "url": "https://api.chat-dash.com/v1/public"
    }
  ],
  "paths": {
    "/agents": {
      "get": {
        "tags": ["Agent"],
        "summary": "Fetch Agents",
        "description": "Fetch all agents in your agency",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "description": "All requests to the ChatDash API must be validated with the agency API Key found on your agency profile",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Agent"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {}
          }
        }
      },
      "post": {
        "tags": ["Agent"],
        "summary": "Create Agent",
        "description": "Create a new agent",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "description": "All requests to the ChatDash API must be validated with the agency API Key found on your agency profile",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The agent's name"
                  },
                  "platform": {
                    "type": "string",
                    "enum": [
                      "voiceflow",
                      "openai",
                      "botpress",
                      "vectorshift",
                      "flowise",
                      "vapi",
                      "retell",
                      "elevenlabs",
                      "n8n",
                      "custom"
                    ],
                    "description": "The agent's platform"
                  },
                  "apiId": {
                    "type": "string",
                    "description": "The 'ID' for interacting with the agent platform's API. Varies by platform:\n- Voiceflow: Project ID\n- OpenAI: Assistant ID\n- Botpress: Messaging API webhook URL\n- Vectorshift: Agent Name on VectorShift\n- Flowise: Chatflow ID\n- Vapi: Assistant ID\n- Retell: Agent ID\n- ElevenLabs: Agent ID\n- n8n: N/A\n- Custom: N/A"
                  },
                  "apiKey": {
                    "type": "string",
                    "description": "The 'Key' for interacting with the agent platform's API. Varies by platform:\n- Voiceflow: Dialog API Key\n- OpenAI: API Key\n- Botpress: Personal Access Token\n- Vectorshift: API Key\n- Flowise: API Key\n- Vapi: Private API Key\n- Retell: API Key\n- ElevenLabs: API Key\n- n8n: N/A\n- Custom: N/A"
                  },
                  "platformCredentials": {
                    "type": "object",
                    "description": "Additional credentials for interacting with certain agent platform's API (field only required for the specified platforms below)",
                    "oneOf": [
                      {
                        "title": "Not Required"
                      },
                      {
                        "title": "Botpress",
                        "type": "object",
                        "properties": {
                          "botId": {
                            "type": "string",
                            "description": "Your Botpress bot ID"
                          },
                          "workspaceId": {
                            "type": "string",
                            "description": "Your Botpress workspace ID"
                          }
                        }
                      },
                      {
                        "title": "Flowise",
                        "type": "object",
                        "properties": {
                          "baseUrl": {
                            "type": "string",
                            "description": "The URL of your deployed Flowise dashboard"
                          }
                        }
                      },
                      {
                        "title": "Vapi",
                        "type": "object",
                        "properties": {
                          "publicKey": {
                            "type": "string",
                            "description": "Your Vapi public key (only required for using ChatDash's web widget"
                          }
                        }
                      },
                      {
                        "title": "n8n",
                        "type": "object",
                        "properties": {
                          "baseUrl": {
                            "type": "string",
                            "description": "The Chat Webook URL used to trigger your n8n workflow"
                          }
                        }
                      }
                    ]
                  },
                  "agentConfig": {
                    "type": "object",
                    "description": "Configuration settings defining how the system will handle the agent",
                    "properties": {
                      "usingExternalWidget": {
                        "type": "boolean",
                        "default": false,
                        "description": "Whether the agent is using an external widget or interface over ChatDash's native widget. Varied support by platform:\n- Voiceflow: Supported\n- OpenAI: Supported\n- Botpress: Supported\n- Vectorshift: Not Supported\n- Flowise: Supported\n- Vapi: Supported\n- Retell: Supported\n- ElevenLabs: Required to be set to true\n- n8n: Not Supported"
                      },
                      "useImportWebhook": {
                        "type": "boolean",
                        "default": false,
                        "description": "Whether the agent is using an import webhook to sync in conversations (Retell and Vapi only)"
                      },
                      "isTemplate": {
                        "type": "boolean",
                        "default": false,
                        "description": "Whether the agent is a template used for SaaS mode"
                      },
                      "isSaas": {
                        "type": "boolean",
                        "default": false,
                        "description": "Whether the agent was created from a template in SaaS mode"
                      }
                    }
                  }
                },
                "required": ["name", "platform"]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Agent created successfully"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "An unexpected error occurred"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agents/{agentId}": {
      "get": {
        "tags": ["Agent"],
        "summary": "Fetch Agent",
        "description": "Fetch a specific agent",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "description": "All requests to the ChatDash API must be validated with the agency API Key found on your agency profile",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "description": "The ID of the agent",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Agent"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {}
          }
        }
      },
      "put": {
        "tags": ["Agent"],
        "summary": "Update Agent",
        "description": "Update a agent",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "description": "All requests to the ChatDash API must be validated with the agency API Key found on your agency profile",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "description": "The ID of the agent",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The agent's name"
                  },
                  "apiId": {
                    "type": "string",
                    "description": "The 'ID' for interacting with the agent platform's API. Varies by platform:\n- Voiceflow: Project ID\n- OpenAI: Assistant ID\n- Botpress: Messaging API webhook URL\n- Vectorshift: Chatbot Name on VectorShift\n- Flowise: Chatflow ID\n- Vapi: Assistant ID\n- Retell: Agent ID\n- ElevenLabs: Agent ID\n- n8n: N/A\n- Custom: N/A"
                  },
                  "apiKey": {
                    "type": "string",
                    "description": "The 'Key' for interacting with the agent platform's API. Varies by platform:\n- Voiceflow: Dialog API Key\n- OpenAI: API Key\n- Botpress: Personal Access Token\n- Vectorshift: API Key\n- Flowise: API Key\n- Vapi: Private API Key\n- Retell: API Key\n- ElevenLabs: API Key\n- n8n: N/A\n- Custom: N/A"
                  },
                  "platformCredentials": {
                    "type": "object",
                    "description": "Additional credentials for interacting with certain agent platform's API (field only required for the specified platforms below)",
                    "oneOf": [
                      {
                        "title": "Not Required"
                      },
                      {
                        "title": "Botpress",
                        "type": "object",
                        "properties": {
                          "botId": {
                            "type": "string",
                            "description": "Your Botpress bot ID"
                          },
                          "workspaceId": {
                            "type": "string",
                            "description": "Your Botpress workspace ID"
                          }
                        }
                      },
                      {
                        "title": "Flowise",
                        "type": "object",
                        "properties": {
                          "baseUrl": {
                            "type": "string",
                            "description": "The URL of your deployed Flowise dashboard"
                          }
                        }
                      },
                      {
                        "title": "Vapi",
                        "type": "object",
                        "properties": {
                          "publicKey": {
                            "type": "string",
                            "description": "Your Vapi public key (only required for using ChatDash's web widget"
                          }
                        }
                      },
                      {
                        "title": "n8n",
                        "type": "object",
                        "properties": {
                          "baseUrl": {
                            "type": "string",
                            "description": "The Chat Webook URL used to trigger your n8n workflow"
                          }
                        }
                      }
                    ]
                  },
                  "agentConfig": {
                    "type": "object",
                    "description": "Configuration settings defining how the system will handle the agent",
                    "properties": {
                      "usingExternalWidget": {
                        "type": "boolean",
                        "description": "Whether the agent is using an external widget or interface over ChatDash's native widget. Varied support by platform:\n- Voiceflow: Supported\n- OpenAI: Supported\n- Botpress: Supported\n- Vectorshift: Not Supported\n- Flowise: Supported\n- Vapi: Supported\n- Retell: Supported\n- ElevenLabs: Required to be set to true\n- n8n: Not Supported"
                      },
                      "useImportWebhook": {
                        "type": "boolean",
                        "description": "Whether the agent is using an import webhook to sync in conversations (Retell and Vapi only)"
                      },
                      "isTemplate": {
                        "type": "boolean",
                        "description": "Whether the agent is a template used for SaaS mode"
                      },
                      "isSaas": {
                        "type": "boolean",
                        "description": "Whether the agent was created from a template in SaaS mode"
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Agent updated successfully"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "An unexpected error occurred"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": ["Agent"],
        "summary": "Delete Agent",
        "description": "Delete a agent",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "description": "All requests to the ChatDash API must be validated with the agency API Key found on your agency profile",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "description": "The ID of the agent",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "An unexpected error occurred"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agents/assign": {
      "put": {
        "tags": ["Agent"],
        "summary": "Assign Agents to Client",
        "description": "Assign existing agents to a specific client",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "description": "All requests to the ChatDash API must be validated with the agency API Key found on your agency profile",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agentIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The IDs of the agents to assign"
                  },
                  "clientId": {
                    "type": "string",
                    "description": "The ID of the client to assign the agent to"
                  }
                },
                "required": ["agentIds", "clientId"]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Agent assigned to client successfully"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "An unexpected error occurred"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agents/{agentId}/unassign": {
      "put": {
        "tags": ["Agent"],
        "summary": "Unassign Agent from Client",
        "description": "Unassign an existing agent from a specific client",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "description": "All requests to the ChatDash API must be validated with the agency API Key found on your agency profile",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "description": "The ID of the agent to unassign",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clientId": {
                    "type": "string",
                    "description": "The ID of the client to unassign the agent from"
                  }
                },
                "required": ["clientId"]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Agent unassigned from client successfully"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "An unexpected error occurred"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/clients/{clientId}/agents": {
      "get": {
        "tags": ["Agent"],
        "summary": "Fetch Client Agents",
        "description": "Fetch all agents for a specific client",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "description": "All requests to the ChatDash API must be validated with the agency API Key found on your agency profile",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "description": "The ID of the client",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Agent"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {}
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Agent": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "The ID of the agent"
          },
          "clientId": {
            "type": "string",
            "description": "The ID of the client the agent is assigned to"
          },
          "name": {
            "type": "string",
            "description": "The agent's name"
          },
          "platform": {
            "type": "string",
            "enum": [
              "voiceflow",
              "openai",
              "botpress",
              "vectorshift",
              "flowise",
              "vapi",
              "retell",
              "elevenlabs",
              "n8n",
              "custom"
            ],
            "description": "The agent's platform"
          },
          "apiId": {
            "type": "string",
            "description": "The 'ID' for interacting with the agent platform's API. Varies by platform:\n- Voiceflow: Project ID\n- OpenAI: Assistant ID\n- Botpress: Messaging API webhook URL\n- Vectorshift: Agent Name on VectorShift\n- Flowise: Chatflow ID\n- Vapi: Assistant ID\n- Retell: Agent ID\n- ElevenLabs: Agent ID\n- n8n: N/A\n- Custom: N/A"
          },
          "apiKey": {
            "type": "string",
            "description": "The 'Key' for interacting with the agent platform's API. Varies by platform:\n- Voiceflow: Dialog API Key\n- OpenAI: API Key\n- Botpress: Personal Access Token\n- Vectorshift: API Key\n- Flowise: API Key\n- Vapi: Private API Key\n- Retell: API Key\n- ElevenLabs: API Key\n- n8n: N/A\n- Custom: N/A"
          },
          "platformCredentials": {
            "type": "object",
            "description": "Additional credentials for interacting with certain agent platform's API",
            "oneOf": [
              {
                "title": "Botpress",
                "type": "object",
                "properties": {
                  "botId": {
                    "type": "string",
                    "description": "Your Botpress bot ID"
                  },
                  "workspaceId": {
                    "type": "string",
                    "description": "Your Botpress workspace ID"
                  }
                }
              },
              {
                "title": "Flowise",
                "type": "object",
                "properties": {
                  "baseUrl": {
                    "type": "string",
                    "description": "The URL of your deployed Flowise dashboard"
                  }
                }
              },
              {
                "title": "Vapi",
                "type": "object",
                "properties": {
                  "publicKey": {
                    "type": "string",
                    "description": "Your Vapi public key (only required for using ChatDash's web widget"
                  }
                }
              },
              {
                "title": "n8n",
                "type": "object",
                "properties": {
                  "baseUrl": {
                    "type": "string",
                    "description": "The Chat Webook URL used to trigger your n8n workflow"
                  }
                }
              }
            ]
          },
          "agentConfig": {
            "type": "object",
            "description": "Configuration settings defining how the system will handle the agent",
            "properties": {
              "usingExternalWidget": {
                "type": "boolean",
                "description": "Whether the agent is using an external widget or interface over ChatDash's native widget. Varied support by platform:\n- Voiceflow: Supported\n- OpenAI: Supported\n- Botpress: Supported\n- Vectorshift: Not Supported\n- Flowise: Supported\n- Vapi: Supported\n- Retell: Supported\n- ElevenLabs: Required to be set to true\n- n8n: Not Supported"
              },
              "useImportWebhook": {
                "type": "boolean",
                "description": "Whether the agent is using an import webhook to sync in conversations (Retell and Vapi only)"
              },
              "isTemplate": {
                "type": "boolean",
                "description": "Whether the agent is a template used for SaaS mode"
              },
              "isSaas": {
                "type": "boolean",
                "description": "Whether the agent was created from a template in SaaS mode"
              }
            }
          }
        }
      }
    }
  },
  "x-original-swagger-version": "2.0"
}
