The Verbweaver API provides programmatic access to all features of the platform. This reference covers the REST API endpoints available at /api/v1.
http://localhost:8000/api/v1
Most endpoints require authentication using JWT tokens.
POST /api/v1/auth/login
Content-Type: application/x-www-form-urlencoded
username=user@example.com&password=yourpasswordResponse:
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
"refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
"token_type": "bearer"
}Include the token in the Authorization header:
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGc...POST /api/v1/auth/register
Content-Type: application/json
{
"email": "user@example.com",
"password": "SecurePass123!",
"name": "John Doe"
}POST /api/v1/auth/login
Content-Type: application/x-www-form-urlencodedPOST /api/v1/auth/refresh
Content-Type: application/json
{
"refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGc..."
}GET /api/v1/auth/me
Authorization: Bearer {token}GET /api/v1/projects
Authorization: Bearer {token}Response:
[
{
"id": "proj_123",
"name": "My Novel",
"description": "A science fiction novel",
"gitRepository": {
"type": "local",
"path": "./git-repos/my-novel"
},
"created": "2024-01-01T00:00:00Z",
"modified": "2024-01-02T00:00:00Z"
}
]POST /api/v1/projects
Authorization: Bearer {token}
Content-Type: application/json
{
"name": "My New Project",
"description": "Project description",
"gitRepository": {
"type": "local"
}
}GET /api/v1/projects/{project_id}
Authorization: Bearer {token}PUT /api/v1/projects/{project_id}
Authorization: Bearer {token}
Content-Type: application/json
{
"name": "Updated Name",
"description": "Updated description"
}DELETE /api/v1/projects/{project_id}
Authorization: Bearer {token}GET /api/v1/projects/{project_id}/graph
Authorization: Bearer {token}Response:
{
"nodes": [
{
"id": "node_1",
"type": "document",
"title": "Chapter 1",
"metadata": {...},
"position": {"x": 100, "y": 100}
}
],
"edges": [
{
"id": "edge_1",
"source": "node_1",
"target": "node_2",
"type": "reference"
}
]
}POST /api/v1/projects/{project_id}/graph/nodes
Authorization: Bearer {token}
Content-Type: application/json
{
"type": "document",
"title": "New Node",
"content": "# New Node\n\nContent here...",
"metadata": {
"tags": ["important"]
}
}PUT /api/v1/projects/{project_id}/graph/nodes/{node_id}
Authorization: Bearer {token}DELETE /api/v1/projects/{project_id}/graph/nodes/{node_id}
Authorization: Bearer {token}POST /api/v1/projects/{project_id}/graph/edges
Authorization: Bearer {token}
Content-Type: application/json
{
"source": "node_1",
"target": "node_2",
"type": "reference",
"label": "relates to"
}GET /api/v1/projects/{project_id}/tasks
Authorization: Bearer {token}POST /api/v1/projects/{project_id}/tasks
Authorization: Bearer {token}
Content-Type: application/json
{
"title": "Write Chapter 1",
"description": "Complete the first draft",
"status": "todo",
"priority": "high",
"dueDate": "2024-02-01T00:00:00Z"
}PUT /api/v1/projects/{project_id}/tasks/{task_id}
Authorization: Bearer {token}PATCH /api/v1/projects/{project_id}/tasks/{task_id}/move
Authorization: Bearer {token}
Content-Type: application/json
{
"status": "in_progress"
}GET /api/v1/projects/{project_id}/files/{file_path}
Authorization: Bearer {token}PUT /api/v1/projects/{project_id}/files/{file_path}
Authorization: Bearer {token}
Content-Type: application/json
{
"content": "File content here..."
}DELETE /api/v1/projects/{project_id}/files/{file_path}
Authorization: Bearer {token}GET /api/v1/projects/{project_id}/git/commits
Authorization: Bearer {token}POST /api/v1/projects/{project_id}/git/commit
Authorization: Bearer {token}
Content-Type: application/json
{
"message": "Updated chapter 1",
"files": ["chapter1.md"]
}GET /api/v1/projects/{project_id}/git/diff?from={commit1}&to={commit2}
Authorization: Bearer {token}POST /api/v1/projects/{project_id}/compiler/compile
Authorization: Bearer {token}
Content-Type: application/json
{
"format": "pdf",
"nodes": ["node_1", "node_2"],
"template": "default",
"options": {
"includeMetadata": false,
"pageSize": "A4"
}
}Response:
{
"exportId": "exp_123",
"status": "processing",
"downloadUrl": null
}GET /api/v1/projects/{project_id}/compiler/status/{export_id}
Authorization: Bearer {token}Connect to receive real-time updates:
const ws = new WebSocket('ws://localhost:8000/ws/{project_id}?token={token}');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('Event:', data.type, data.data);
};file-changed: File was modifiednode-created: New node added to graphnode-updated: Node properties changededge-created: New edge addedtask-moved: Task status changeduser-joined: User joined projectuser-left: User left project
API requests are limited to:
- 60 requests per minute for authenticated users
- 20 requests per minute for unauthenticated users
Rate limit headers:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1609459200{
"detail": "Error message",
"code": "ERROR_CODE",
"field": "field_name" // For validation errors
}Common error codes:
401: Unauthorized403: Forbidden404: Not Found422: Validation Error429: Too Many Requests500: Internal Server Error
import requests
class VerbweaverAPI:
def __init__(self, base_url, token=None):
self.base_url = base_url
self.token = token
def get_projects(self):
headers = {"Authorization": f"Bearer {self.token}"}
response = requests.get(f"{self.base_url}/projects", headers=headers)
return response.json()class VerbweaverAPI {
constructor(baseUrl, token) {
this.baseUrl = baseUrl;
this.token = token;
}
async getProjects() {
const response = await fetch(`${this.baseUrl}/projects`, {
headers: {
'Authorization': `Bearer ${this.token}`
}
});
return response.json();
}
}The OpenAPI spec and docs are available at:
http://localhost:8000/api/v1/openapi.json
http://localhost:8000/api/v1/docs