API Documentation

Codelin Data Backend API Reference

API Overview

Codelin Data Backend provides RESTful APIs for collecting and querying code assistance data

SCHEMA
Message Object
Standard message format for all communications

Fields

role string - Message role ("system", "user", "assistant", "function", etc.)
content string - The message content
image string|null - Optional image URL or base64 data (null if not present)
reason string|null - Optional reasoning or explanation (null if not present)

Example

{ "role": "user", "content": "How to optimize this function?", "image": null, "reason": null }

API Endpoints

Available endpoints for data operations

POST
/api/fix-summary
Create a new fix summary record

Request Body

content string - The fix summary content

Response

{ "summary_id": "uuid-string", "status": "created" }

Example

curl -X POST "http://localhost:8000/api/fix-summary" \ -H "Content-Type: application/json" \ -d '{"content": "Fixed the memory leak in the data processing module"}'
POST
/api/agent-chat-round
Log a new agent chat round

Request Body

question object - The question message object
answer object - The answer message object
steps array - Array of all step message objects in this chat round

Response

{ "chat_round_id": "uuid-string", "status": "logged" }

Example

curl -X POST "http://localhost:8000/api/agent-chat-round" \ -H "Content-Type: application/json" \ -d '{ "question": { "role": "user", "content": "How to optimize this function?", "image": null, "reason": null }, "answer": { "role": "assistant", "content": "You can optimize by using memoization...", "image": null, "reason": "Analysis shows that memoization can reduce redundant calculations" }, "steps": [ { "role": "user", "content": "How to optimize this function?", "image": null, "reason": null }, { "role": "assistant", "content": "You can optimize by using memoization...", "image": null, "reason": "Analysis shows that memoization can reduce redundant calculations" } ] }'
GET
/api/fix-summary/{summary_id}
Get a specific fix summary by ID

Path Parameters

summary_id string - The UUID of the fix summary

Response

{ "id": "uuid-string", "content": "Fix summary content...", "timestamp": "2024-01-01T12:00:00.000Z" }
GET
/api/agent-chat-round/{chat_round_id}
Get a specific agent chat round by ID

Path Parameters

chat_round_id string - The UUID of the agent chat round

Response

{ "id": "uuid-string", "query": "User query...", "answer": "Agent answer...", "steps": [ { "role": "user", "content": "User message..." }, { "role": "assistant", "content": "Assistant response..." } ], "timestamp": "2024-01-01T12:00:00.000Z" }

Example

curl "http://localhost:8000/api/agent-chat-round/abc123"
GET
/api/fix-summary
List fix summaries with pagination

Query Parameters

limit integer - Number of records per page (default: 50)
offset integer - Number of records to skip (default: 0)

Response

{ "summaries": [ { "id": "uuid-string", "content": "Fix summary content...", "timestamp": "2024-01-01T12:00:00.000Z" } ], "limit": 50, "offset": 0 }

Example

curl "http://localhost:8000/api/fix-summary?limit=10&offset=0"
GET
/api/agent-chat-round
List agent chat rounds with pagination (preferred endpoint)

Query Parameters

limit integer - Number of records per page (default: 50)
offset integer - Number of records to skip (default: 0)

Response

{ "chat_rounds": [ { "id": "uuid-string", "query": "User query...", "answer": "Agent answer...", "steps": [...], "timestamp": "2024-01-01T12:00:00.000Z" } ], "limit": 50, "offset": 0 }

Example

curl "http://localhost:8000/api/agent-chat-round?limit=10&offset=0"
GET
/health
Health check endpoint

Response

{ "status": "healthy", "timestamp": "2024-01-01T12:00:00.000Z" }