Skip to main content
POST
/
api
/
ai
/
chat
AI Chat
curl --request POST \
  --url https://api.example.com/api/ai/chat \
  --header 'Content-Type: application/json' \
  --data '
{
  "history": [
    {}
  ]
}
'
{
  "reply": "<string>",
  "history": [
    {}
  ],
  "tasksCreated": true
}
Interact with the Gemini-powered AI assistant to manage tasks, generate daily scrum summaries, and analyze your work patterns. The assistant can query your tasks, projects, and task types, and even create new tasks through conversation.

Authentication

Requires Bearer token authentication and a configured Gemini API key.

Request Body

history
array
required
Array of conversation history objects. Each object contains a role field (“user” or “model”) and either a text field or parts field with the message content.

Response

reply
string
required
The AI assistant’s text response to the user’s message
history
array
required
Updated conversation history including the latest exchange and any tool calls made by the AI
tasksCreated
boolean
required
Indicates whether any tasks were created during this conversation turn

Example Request

curl -X POST https://api.example.com/api/ai/chat \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "history": [
      {
        "role": "user",
        "text": "What tasks do I have in progress?"
      }
    ]
  }'

Example Response

{
  "reply": "You have 3 tasks in progress:\n- Implement user authentication (Project: Website Redesign, Type: Feature)\n- Fix login bug (Project: Website Redesign, Type: Bug Fix)\n- Update documentation (Project: Mobile App, Type: Documentation)",
  "history": [
    {
      "role": "user",
      "text": "What tasks do I have in progress?"
    },
    {
      "role": "model",
      "text": "You have 3 tasks in progress:\n- Implement user authentication (Project: Website Redesign, Type: Feature)\n- Fix login bug (Project: Website Redesign, Type: Bug Fix)\n- Update documentation (Project: Mobile App, Type: Documentation)",
      "parts": "[...]"
    }
  ],
  "tasksCreated": false
}

Error Responses

400 Bad Request
Gemini API key is not configured, history is empty, or API rate limit exceeded
{
  "error": "Bad Request",
  "message": "Gemini API key not configured"
}
{
  "error": "Bad Request",
  "message": "Gemini API rate limit exceeded. Please try again later."
}
{
  "error": "Bad Request",
  "message": "Invalid Gemini API key"
}
401 Unauthorized
Authentication token is missing or invalid
{
  "error": "Unauthorized",
  "message": "Invalid or missing authentication token"
}
404 Not Found
The user account was not found
{
  "error": "Not Found",
  "message": "User not found"
}

AI Capabilities

The AI assistant has access to the following tools:
  • get_tasks: Query tasks with filters for date, status, and project
  • get_projects: List all user projects
  • get_task_types: List task types, optionally filtered by project
  • create_task: Create new tasks after collecting required information
The assistant can:
  • Generate daily scrum summaries
  • Analyze task distribution and productivity
  • Identify bottlenecks and stalled tasks
  • Create tasks through conversational flow
  • Filter and search tasks by various criteria

Language Support

The assistant responds in the user’s configured language:
  • Portuguese (pt-BR)
  • English (en-US)
  • Spanish (es)
The language is automatically determined from the user’s account settings.

Gemini Integration

This endpoint uses Google’s Gemini 2.5 Flash model with:
  • Function calling for tool execution (up to 3 tool calls per conversation turn)
  • Multi-turn conversation support with full history
  • Encrypted API key storage (AES-256)
  • Automatic error handling for rate limits and invalid keys

Build docs developers (and LLMs) love