Base URL:
http://127.0.0.1:8000/api/
Endpoint
POST /api/documents/
Content-Type
multipart/form-data
Request Body
| Key | Type | Required |
|---|---|---|
| file | File | Yes |
Success Response
{
"message": "Document uploaded successfully",
"document_id": 1,
"filename": "resume.pdf",
"chunks_created": 18
}Endpoint
GET /api/documents/
Response
[
{
"id": 1,
"filename": "resume.pdf",
"uploaded_at": "2026-02-10T12:30:00Z"
}
]Endpoint
GET /api/documents/<id>/
Response
{
"id": 1,
"filename": "resume.pdf",
"uploaded_at": "2026-02-10T12:30:00Z",
"chunks_count": 18
}Endpoint
DELETE /api/documents/<id>/
Response
{
"message": "Document deleted successfully"
}Endpoint
POST /api/chat/
Content-Type
application/json
Request Body
{
"question": "What skills are mentioned in the document?"
}Optional (if filtering per document):
{
"question": "What skills are mentioned?",
"document_id": 1
}- Receive question
- Generate embedding
- Retrieve top matching chunks from vector DB
- Send chunks + question to LLM
- Generate answer
- Return answer + sources
Success Response
{
"answer": "The document mentions Python, Django, React, and REST APIs.",
"sources": [
{
"document_id": 1,
"chunk_id": 4,
"content_preview": "Experienced in Python and Django framework..."
}
]
}Endpoint
POST /api/auth/register/
Request Body
{
"email": "user@example.com",
"password": "password123"
}Response
{
"message": "User registered successfully"
}Endpoint
POST /api/auth/login/
Request Body
{
"email": "user@example.com",
"password": "password123"
}Response (JWT Example)
{
"access": "ACCESS_TOKEN",
"refresh": "REFRESH_TOKEN"
}Endpoint
GET /api/auth/me/
Headers
Authorization: Bearer ACCESS_TOKEN
Response
{
"id": 1,
"email": "user@example.com"
}from django.urls import path, include
urlpatterns = [
path("api/", include("documents.urls")),
path("api/", include("chat.urls")),
path("api/", include("accounts.urls")),
]from django.urls import path
from .views import DocumentListCreateView, DocumentDetailView
urlpatterns = [
path("documents/", DocumentListCreateView.as_view()),
path("documents/<int:pk>/", DocumentDetailView.as_view()),
]from django.urls import path
from .views import ChatAPIView
urlpatterns = [
path("chat/", ChatAPIView.as_view()),
]| Feature | Endpoint | Method |
|---|---|---|
| Upload Document | /api/documents/ | POST |
| List Documents | /api/documents/ | GET |
| Get One | /api/documents// | GET |
| Delete | /api/documents// | DELETE |
| Ask Question | /api/chat/ | POST |
| Register | /api/auth/register/ | POST |
| Login | /api/auth/login/ | POST |
| Current User | /api/auth/me/ | GET |
- MEDIA_ROOT configured
- CORS enabled
- Trailing slash used correctly
- Vector database persistence enabled
- LLM API key configured
- Chunking and embedding working
End of API Backend Documentation.