Fields & validation
Every field with its exact validation rule, nullability, and the database column that stores it.
Library (POST /knowledge-bases)
| Field | Type | Required | Nullable | Rules (verbatim) | DB column |
name | string | yes | no | required|string|max:255 | knowledge_bases.name |
description | string | no | yes | nullable|string|max:5000 | knowledge_bases.description |
audience | string | no | yes | nullable|string|in:builder,assistant (super admins only — ignored for everyone else) | knowledge_bases.audience |
Document (create / update)
| Field | Type | Create rule | Update rule | DB column |
title | string | required|string|max:255 | sometimes|string|max:255 | knowledge_articles.title |
content | string | required|string (no max) | sometimes|string (no max) | knowledge_articles.content |
status | string | nullable|in:draft,published | sometimes|in:draft,published,archived | knowledge_articles.status |
The shared-with-me update endpoint accepts only title and content with the same "update rule" above — status is never accepted there.
Assignment (POST /article-assign)
| Field | Rules (verbatim) |
knowledge_article_id | sometimes|uuid|exists:knowledge_articles,id |
knowledge_article_ids | sometimes|array|min:1 |
knowledge_article_ids.* | uuid|exists:knowledge_articles,id |
assistant_id | sometimes|integer|exists:assistants,id |
assistant_ids | sometimes|array|min:1 |
assistant_ids.* | integer|exists:assistants,id |
Exactly one of knowledge_article_id/knowledge_article_ids must resolve to at least one id, and exactly one of assistant_id/assistant_ids must resolve to at least one id — enforced in the controller (422 with a dedicated message), not by the validator rules above.
Sharing (invite / permission / remove)
| Field | invite | permission | remove |
email | required|string|email|max:255 | required|string|email|max:255 | required|string|email|max:255 |
can_view | boolean (optional; defaults to can_edit's value if omitted) | boolean (optional; defaults to true if omitted) | — |
can_edit | boolean (optional; defaults to false if omitted) | boolean (optional; defaults to false if omitted) | — |
On invite, at least one of can_view/can_edit must end up true or the request is rejected with 422.
Other endpoints
| Endpoint | Field | Rules (verbatim) |
POST /knowledge-bases/ensure-default | assistant_id | required|integer|exists:assistants,id |
GET /assistant/{assistantId}/assignable-articles | q | nullable|string|max:200 |
Constraints the rules cannot express
- A non–super-admin can own at most one library —
POST /knowledge-bases checks for an existing owner_user_id match before validating anything else and rejects a second attempt with 422.
- Only a super admin may set
audience; it is silently ignored (always assistant) for every other role.
- Only a published document can be assigned to an assistant or synced to search — both are enforced as 422s in the controller, not as validator rules.
- A document's library must have
audience: assistant to be assignable to assistants at all — a builder-audience library's documents cannot be attached.
- An assignment requires the assistant and the document to belong to the same organization (
reseller_id match) — checked per pair inside the assignment loop.
status cannot go straight to archived on create (only draft or published); archived is reachable only through a later update.
- The
shared-with-me update endpoint never accepts status — recipients can never publish or unpublish a document, no matter their can_edit permission.