Skip to content

Commit f50bb18

Browse files
authored
Update API documentation for various endpoints
Expanded API documentation for conversations, messages, user settings, user models, model providers, assistants, and projects.
1 parent b4046ad commit f50bb18

1 file changed

Lines changed: 281 additions & 0 deletions

File tree

api-docs.md

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,284 @@ Enhance a prompt using an LLM to make it better for generation.
316316
"enhanced_prompt": "string"
317317
}
318318
```
319+
320+
---
321+
322+
### Conversations
323+
324+
#### GET `/api/db/conversations`
325+
List all conversations for the user, or get a specific conversation by ID.
326+
327+
**Authentication**: Session (or Public for shared conversations)
328+
329+
**Query Parameters**:
330+
- `id`: (Optional) Conversation ID to fetch a specific conversation.
331+
- `projectId`: (Optional) Filter by project. Use `"null"` for non-project conversations.
332+
- `search`: (Optional) Search term for conversation search.
333+
- `mode`: (Optional) Search mode: `'exact'`, `'words'`, or `'fuzzy'`.
334+
335+
**Response** (list):
336+
```json
337+
[
338+
{
339+
"id": "string",
340+
"title": "string",
341+
"userId": "string",
342+
"projectId": "string | null",
343+
"pinned": "boolean",
344+
"generating": "boolean",
345+
"costUsd": "number | null",
346+
"createdAt": "date",
347+
"updatedAt": "date"
348+
}
349+
]
350+
```
351+
352+
#### POST `/api/db/conversations`
353+
Create or update conversations.
354+
355+
**Authentication**: Session
356+
357+
**Request Body**:
358+
```json
359+
{
360+
"action": "create" | "createWithMessage" | "branch" | "updateTitle" | "updateGenerating" | "updateCost" | "setPublic" | "togglePin",
361+
// Additional fields depend on action
362+
}
363+
```
364+
365+
**Actions**:
366+
- `create`: Create new conversation. Fields: `title`, `projectId`.
367+
- `createWithMessage`: Create conversation with first message. Fields: `content`, `contentHtml`, `role`, `images`, `webSearchEnabled`, `projectId`.
368+
- `branch`: Branch from existing message. Fields: `conversationId`, `fromMessageId`.
369+
- `updateTitle`: Update title. Fields: `conversationId`, `title`.
370+
- `setPublic`: Make conversation public. Fields: `conversationId`, `public`.
371+
- `togglePin`: Toggle pin status. Fields: `conversationId`.
372+
373+
#### DELETE `/api/db/conversations`
374+
Delete a conversation or all conversations.
375+
376+
**Authentication**: Session
377+
378+
**Query Parameters**:
379+
- `id`: Conversation ID to delete.
380+
- `all`: Set to `"true"` to delete all conversations.
381+
382+
---
383+
384+
### Messages
385+
386+
#### GET `/api/db/messages`
387+
Get messages for a conversation.
388+
389+
**Authentication**: Session (or Public for public conversations)
390+
391+
**Query Parameters**:
392+
- `conversationId`: (Required) Conversation ID.
393+
- `public`: Set to `"true"` for public conversations.
394+
395+
**Response**:
396+
```json
397+
[
398+
{
399+
"id": "string",
400+
"conversationId": "string",
401+
"role": "user" | "assistant" | "system",
402+
"content": "string",
403+
"contentHtml": "string | null",
404+
"modelId": "string | null",
405+
"reasoning": "string | null",
406+
"images": "array | null",
407+
"documents": "array | null",
408+
"createdAt": "date"
409+
}
410+
]
411+
```
412+
413+
#### POST `/api/db/messages`
414+
Create or update messages.
415+
416+
**Authentication**: Session
417+
418+
**Request Body**:
419+
```json
420+
{
421+
"action": "create" | "updateContent" | "update" | "updateError" | "delete",
422+
// Additional fields depend on action
423+
}
424+
```
425+
426+
---
427+
428+
### User Settings
429+
430+
#### GET `/api/db/user-settings`
431+
Get user settings.
432+
433+
**Authentication**: Session
434+
435+
**Response**:
436+
```json
437+
{
438+
"userId": "string",
439+
"privacyMode": "boolean",
440+
"contextMemoryEnabled": "boolean",
441+
"persistentMemoryEnabled": "boolean",
442+
"theme": "string | null",
443+
...
444+
}
445+
```
446+
447+
#### POST `/api/db/user-settings`
448+
Update user settings.
449+
450+
**Authentication**: Session
451+
452+
**Request Body**:
453+
```json
454+
{
455+
"action": "update",
456+
"privacyMode": "boolean (optional)",
457+
"contextMemoryEnabled": "boolean (optional)",
458+
...
459+
}
460+
```
461+
462+
---
463+
464+
### User Models
465+
466+
#### GET `/api/db/user-models`
467+
Get enabled models for the user.
468+
469+
**Authentication**: Session
470+
471+
**Query Parameters**:
472+
- `provider`: (Optional) Filter by provider.
473+
- `modelId`: (Optional) Get specific model.
474+
475+
**Response**:
476+
```json
477+
[
478+
{
479+
"modelId": "string",
480+
"provider": "string",
481+
"enabled": "boolean",
482+
"pinned": "boolean"
483+
}
484+
]
485+
```
486+
487+
#### POST `/api/db/user-models`
488+
Enable/disable models or toggle pinned status.
489+
490+
**Authentication**: Session
491+
492+
**Request Body**:
493+
```json
494+
{
495+
"action": "set" | "togglePinned" | "enableInitial",
496+
"provider": "string",
497+
"modelId": "string",
498+
"enabled": "boolean"
499+
}
500+
```
501+
502+
---
503+
504+
### Model Providers
505+
506+
#### GET `/api/model-providers`
507+
Get available providers for a model.
508+
509+
**Authentication**: Session
510+
511+
**Query Parameters**:
512+
- `modelId`: (Required) Model ID.
513+
514+
**Response**:
515+
```json
516+
{
517+
"canonicalId": "string",
518+
"displayName": "string",
519+
"supportsProviderSelection": "boolean",
520+
"providers": []
521+
}
522+
```
523+
524+
---
525+
526+
### Assistants (Extended)
527+
528+
#### PATCH `/api/assistants/[id]`
529+
Update an assistant.
530+
531+
**Authentication**: Session
532+
533+
**Request Body**:
534+
```json
535+
{
536+
"name": "string (optional)",
537+
"systemPrompt": "string (optional)",
538+
"defaultModelId": "string | null (optional)",
539+
"defaultWebSearchMode": "enum (optional)"
540+
}
541+
```
542+
543+
#### DELETE `/api/assistants/[id]`
544+
Delete an assistant.
545+
546+
**Authentication**: Session
547+
548+
#### POST `/api/assistants/[id]`
549+
Set assistant as default.
550+
551+
**Authentication**: Session
552+
553+
**Request Body**:
554+
```json
555+
{
556+
"action": "setDefault"
557+
}
558+
```
559+
560+
---
561+
562+
### Projects (Extended)
563+
564+
#### GET `/api/projects/[id]`
565+
Get a single project with all details.
566+
567+
**Authentication**: Session
568+
569+
**Response**:
570+
```json
571+
{
572+
"id": "string",
573+
"name": "string",
574+
"role": "owner" | "editor" | "viewer",
575+
"files": [],
576+
"members": [],
577+
"conversations": []
578+
}
579+
```
580+
581+
#### PATCH `/api/projects/[id]`
582+
Update a project.
583+
584+
**Authentication**: Session (owner or editor)
585+
586+
**Request Body**:
587+
```json
588+
{
589+
"name": "string (optional)",
590+
"description": "string (optional)",
591+
"systemPrompt": "string (optional)",
592+
"color": "string (optional)"
593+
}
594+
```
595+
596+
#### DELETE `/api/projects/[id]`
597+
Delete a project.
598+
599+
**Authentication**: Session (owner only)

0 commit comments

Comments
 (0)