HeHo API Documentation

Welcome to the HeHo API. Integrate AI-powered backend services and autonomous data management into your applications.

Authentication
Your API key must be included in the Authorization header of every request.

Get your API key from the Settings page.

Authorization: Bearer YOUR_HEHO_API_KEY

Warning

Your API key is a secret! Do not share it publicly or commit it to version control.

API Endpoints

POST /api/verify-user
Verifies your API key and returns your complete user profile from the database.

Example: cURL

curl -X POST https://heho.vercel.app/api/verify-user \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY"
POST /api/aichat
Send a message to one of your chatbots and receive an AI-generated reply.

Request Body (JSON)

FieldTypeDescription
chatbotIdstringThe unique ID of your chatbot. Find this on the chatbot's settings page.
messagesarrayAn array of new message objects.
historyarray (optional)An array of previous messages for context.

Example: cURL

curl -X POST https://heho.vercel.app/api/aichat \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY" \ 
  -H "Content-Type: application/json" \ 
  -d '{ 
    "chatbotId": "YOUR_AGENT_ID", 
    "messages": [{"role": "user", "content": "Hello?"}] 
  }'

Chatbot Management

POST /api/v1/chatbots/manage
Create a new chatbot with specific configuration and data sources.

Request Body (JSON)

FieldTypeDescription
namestringThe name of your chatbot (Required).
goalstringThe primary goal of the chatbot (Required).
descriptionstringA detailed description/prompt (Min 200 characters) (Required).
modelstringAI model ID (Required). Examples: qwen/qwen3-next-80b-a3b-instruct:free, arcee-ai/trinity-large-preview:free
tonestringChatbot tone (Optional, defaults to 'professional'). Values: friendly, professional, strict
themestringUI theme name (Optional, defaults to 'sky'). Values: twilight, sunrise, ocean, forest, grape, rose, sky, candy

Data Source Configuration (All Optional)

Configure up to 3 data sources. If not provided, fields default to null/false.

FieldTypeDescription
data_table_1stringName of the first data source table (Optional, defaults to null).
data_table_1_readbooleanAllow chatbot to read from table 1 (Optional, defaults to false).
data_table_1_writebooleanAllow chatbot to write/insert data to table 1 (Optional, defaults to false).
data_table_1_editbooleanAllow chatbot to edit/update existing records in table 1 (Optional, defaults to false).

Example: cURL (Minimal)

curl -X POST https://heho.vercel.app/api/v1/chatbots/manage \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY" \ 
  -H "Content-Type: application/json" \ 
  -d '{ 
    "name": "My AI Assistant", 
    "goal": "Customer Support", 
    "description": "This is a very long description that must be at least 200 characters long to satisfy the validation requirements of the HeHo platform and ensure the AI has enough context to operate effectively...", 
    "model": "qwen/qwen3-next-80b-a3b-instruct:free"
  }'
GET /api/v1/chatbots/manage
Retrieve a list of all your chatbots.

Example: cURL

curl -X GET https://heho.vercel.app/api/v1/chatbots/manage \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY"
DELETE /api/v1/chatbots/manage
Delete a specific chatbot by its ID.

Example: cURL (Query Parameter)

curl -X DELETE "https://heho.vercel.app/api/v1/chatbots/manage?chatbotId=YOUR_CHATBOT_ID" \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY"

Database Management

GET /api/v1/database/manage
Fetch all connected tables and their column structures.

Example: cURL

curl -X GET https://heho.vercel.app/api/v1/database/manage \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY"

Response Example

{
  "tables": [
    {
      "table_name": "products",
      "columns": [
        { "column_name": "id", "data_type": "uuid", "required": true },
        { "column_name": "name", "data_type": "text", "required": true },
        { "column_name": "price", "data_type": "numeric", "required": false }
      ]
    }
  ]
}
POST /api/v1/database/tables
Create a new table in your Supabase database.

Request Body (JSON)

FieldTypeDescription
tableNamestringThe name of the table to create (Required). Must contain only letters, numbers, and underscores.
columnsarrayArray of column definitions (Required). Each column should have: name, type, primaryKey (optional), notNull (optional), defaultValue (optional).

Example: cURL

curl -X POST https://heho.vercel.app/api/v1/database/tables \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY" \ 
  -H "Content-Type: application/json" \ 
  -d '{ 
    "tableName": "customers", 
    "columns": [
      { "name": "id", "type": "uuid", "primaryKey": true },
      { "name": "name", "type": "text", "notNull": true },
      { "name": "email", "type": "text" }
    ]
  }'
POST /api/v1/database/tables/connect
Connect an existing table from your Supabase database to HeHo.

Request Body (JSON)

FieldTypeDescription
tableNamestringThe name of the existing table to connect (Required).

Example: cURL

curl -X POST https://heho.vercel.app/api/v1/database/tables/connect \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY" \ 
  -H "Content-Type: application/json" \ 
  -d '{ 
    "tableName": "existing_table"
  }'
DELETE /api/v1/database/tables
Disconnect a table from your HeHo app. This does NOT delete the table from your Supabase database.

Request Body (JSON)

FieldTypeDescription
tableNamestringThe name of the table to delete (Required).

Example: cURL

curl -X DELETE https://heho.vercel.app/api/v1/database/tables \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY" \ 
  -H "Content-Type: application/json" \ 
  -d '{ 
    "tableName": "customers"
  }'
POST /api/v1/database/manage
Perform CRUD operations (Read, Add, Edit, Delete) on your connected tables.

Request Body (JSON)

FieldTypeDescription
actionstringThe operation to perform: read, add, edit, delete (Required).
tableNamestringThe name of the table (Required).
dataobjectThe row data for add or edit actions.
idanyThe primary key value for edit or delete actions.
queryobjectFilter criteria for read action (e.g., { "id": 1 }).

Example: Add Row

curl -X POST https://heho.vercel.app/api/v1/database/manage \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY" \ 
  -H "Content-Type: application/json" \ 
  -d '{ 
    "action": "add", 
    "tableName": "products", 
    "data": { "name": "New Product", "price": 99.99 } 
  }'

Example: Read Rows

curl -X POST https://heho.vercel.app/api/v1/database/manage \ 
  -H "Authorization: Bearer YOUR_HEHO_API_KEY" \ 
  -H "Content-Type: application/json" \ 
  -d '{ 
    "action": "read", 
    "tableName": "products"
  }'