The classify endpoint runs the full AI classification pipeline — sending your text toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/DrDigett/Babel/llms.txt
Use this file to discover all available pages before exploring further.
llama-3.1-8b-instant, extracting structured metadata, and suggesting semantic relations to existing nodes — but does not write anything to the database. Use it to preview what BaBel+ would create before committing, to validate that the model interprets your description correctly, or as the first step in a custom two-phase UI flow where the user reviews and confirms before anything is persisted.
Endpoint
Request
Body parameters
Free-text description of the content to classify. The server trims whitespace and enforces a maximum of 10 000 characters. The same validation rules apply as for Smart Add.
Optional type override. One of:
libro, pelicula, articulo, video, curso, videojuego. When provided, the model is instructed to use this type instead of inferring it from the text.Example request
Response
200 OK
Returns the AI-suggested node and relations. The structure is identical to the Smart Add response but nothing has been persisted — no node row is inserted, no relation row is inserted.The model’s suggested node. Note that
id, localFile, createdAt, and updatedAt are not present in this response because no database record has been created yet.Array of relation suggestions from the model. The model receives the full list of existing nodes from the database when generating these suggestions, so
targetTitle values are grounded in real node titles. However, unlike Smart Add, the classify endpoint does not perform a server-side lookup to resolve targetTitle values to node UUIDs — that resolution only happens during Smart Add. When you later create the node manually, you will need to resolve each targetTitle to an actual node ID yourself.Example response
Error responses
| Status | Condition |
|---|---|
400 Bad Request | text is missing, empty, or not a string. Body: { "error": "text is required" } |
400 Bad Request | text exceeds 10 000 characters. Body: { "error": "text too long (max 10000)" } |
500 Internal Server Error | The Groq API call fails (network error, invalid API key, rate limit). |
500 Internal Server Error | The model returns a response that cannot be parsed as valid JSON. |
Classify vs Smart Add
POST /api/ai/classify | POST /api/ai/smart-add | |
|---|---|---|
| Calls the AI model | ✅ | ✅ |
| Writes node to database | ❌ | ✅ |
| Writes relations to database | ❌ | ✅ |
Resolves targetTitle to node UUIDs | ❌ | ✅ |
| Response status | 200 OK | 201 Created |
classifyAndSuggest function internally and then proceeds to persist the results. If you want the behaviour of classify followed by a persist step, use classify first, show the preview to the user, and then create the node and relations yourself via the standard POST /api/nodes and POST /api/relations endpoints when the user confirms.
Building a confirmation UI
Call classify with the user's text
Send
POST /api/ai/classify with the free-text input. Display the returned node fields (title, type, description, tags, author, year) as an editable form so the user can correct any mistakes before committing.Display suggested relations
Render the
relations array to the user. For each suggested targetTitle, look it up in your local node cache to show a link to the existing node. Let the user deselect relations they do not want.This flow gives you full control over what gets written to the database. It is more work than Smart Add but avoids duplicates and lets users catch mis-classifications before they become graph noise.
Smart Add
Skip the preview step and let BaBel+ classify, create, and connect your node in one call with
POST /api/ai/smart-add.