Chat

Have multi-turn conversations about your documents.

Send Message

POST /api/chat/:projectId

Request Body

FieldTypeRequiredDescription
messagestringYesYour message to the AI
sessionIdstringNoReuse existing session
fileIdsstring[]NoFocus on specific files
systemPromptstringNoCustom AI personality

Example

curl -X POST "https://api.getneji.com/api/chat/proj_abc123" \
  -H "Authorization: Bearer sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "What are the key findings in the Q4 report?",
    "fileIds": ["file_q4_report"]
  }'

Response

{
  "success": true,
  "response": "Based on the Q4 report, here are the key findings:\n\n1. Revenue increased 15% YoY...",
  "sessionId": "session_abc123"
}

Multi-turn Conversation

// First message
const first = await chat({
  message: "Summarize the contract"
});
// Response: { sessionId: "session_abc123", response: "..." }

// Follow-up uses same session
const followUp = await chat({
  message: "What are the termination clauses?",
  sessionId: first.sessionId
});

List Sessions

GET /api/chat/:projectId/sessions

Response

{
  "success": true,
  "sessions": [
    {
      "sessionId": "session_abc123",
      "lastActivity": 1699999999999,
      "status": "active"
    }
  ]
}

End Session

DELETE /api/chat/sessions/:sessionId