This page is machine-translated from French. Read the French original.

API developer

An HTTP API allows you to integrate WivenLLM into your applications: populate spaces, ask questions, manage users, leverage conversations.

Available for server or hosted deployment.


Authentication

Create a key in Réglages → Clés d'API. It is only displayed during creation.

Each request carries the key in the header. Authorization :

curl https://votre-instance/api/v1/workspaces \
  -H "Authorization: Bearer VOTRE_CLE_API"

A key provides full access to the API. Create one key per integration, revoke any that are no longer needed, and never publish them in shared code. Key creation and deletion are logged.


Interactive documentation

Interactive API documentation is provided by the instance itself. It lists all entry points with their parameters and allows you to try them out. This is the up-to-date reference for your version.

It can be disabled in production via configuration.


Main entry points

All addresses are relative to /api.

Workspaces

Method Path Role
GET /v1/workspaces List the spaces
POST /v1/workspace/new Create a space
GET /v1/workspace/{slug} Detail of a space
POST /v1/workspace/{slug}/update Change your settings
POST /v1/workspace/{slug}/update-embeddings Add or remove documents
POST /v1/workspace/{slug}/update-pin Pin or unpin a document
DELETE /v1/workspace/{slug} Delete a space

Conversation

Method Path Role
POST /v1/workspace/{slug}/chat Ask a question, get a full answer
POST /v1/workspace/{slug}/stream-chat Likewise, continuous flow response
GET /v1/workspace/{slug}/chats History of space
POST /v1/workspace/{slug}/vector-search Documentary research alone, without generation

Example :

curl -X POST https://votre-instance/api/v1/workspace/dossier-dupont/chat \
  -H "Authorization: Bearer VOTRE_CLE_API" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Quel est le délai de résiliation du bail ?",
    "mode": "query"
  }'

The response contains the generated text and the sources used.

vector-search is useful when you only want to find the relevant passages and process them yourself, without going through a template.

Discussion thread

Method Path Role
POST /v1/workspace/{slug}/thread/new Create a thread
POST /v1/workspace/{slug}/thread/{threadSlug}/chat Write in a thread
POST /v1/workspace/{slug}/thread/{threadSlug}/stream-chat Likewise, in continuous flow
GET /v1/workspace/{slug}/thread/{threadSlug}/chats History of the thread
DELETE /v1/workspace/{slug}/thread/{threadSlug} Delete the thread

Threads allow multiple independent conversations to be maintained for different end users within the same space.

Documents

Method Path Role
POST /v1/document/upload Upload a file
POST /v1/document/upload-link Import a URL
POST /v1/document/raw-text Inject raw text
GET /v1/documents List the documents
GET /v1/document/accepted-file-types Accepted formats
POST /v1/document/create-folder Create a folder
POST /v1/document/move-files Move documents

Reminder : Uploading a document does not make it searchable. You must then add it to a space via update-embeddings.

Administration

Method Path Role
GET /v1/admin/users List users
POST /v1/admin/users/new Create a user
POST /v1/admin/invite/new Create an invitation
GET /v1/admin/workspace-chats Conversations within the body
POST /v1/admin/workspaces/{id}/update-users Managing the members of a space

Widgets

Creation, consultation and monitoring of widgets and their conversations.

System

Information about the instance, number of vectors, export of conversations.


OpenAI compatibility

A set of entry points replicates the interface of the OpenAI standard:

  • POST /v1/openai/chat/completions
  • POST /v1/openai/embeddings
  • GET /v1/openai/models

The advantage: an application already written for this standard works with WivenLLM by changing the base address and the key. The model name corresponds to the workspace to be queried, which allows you to benefit from its documentary context.

This is the shortest way to connect an existing tool to your private document database.


Best practices for integration

One space per use. Isolate areas exposed to an application from areas used by your employees.

One thread per end user. If your application serves multiple people, create a thread for each person: contexts do not mix.

Process the mode. The parameter mode (chat Or query) is crucial for integration: query avoids invented answers when the database does not contain the information.

Manage errors and latency. A response may take several seconds, even longer with an agent. Plan for appropriate wait times and a way to handle model provider failures.

Use continuous flow For any interface where a human is waiting: the response is displayed as it is given, the perceived wait is much shorter.

Utilize the sources. The responses return the extracts used: display them, this is what makes the integration verifiable.