Skip to content

Create Knowledge Grant

POST /knowledge-grants

Grant an agent access to a base it does not own — explicitly, or dynamically.

KnowledgeService.grant was written, validated and unit-tested at M7 and called by nothing: the explicit grant created alongside a base was the only authorization anybody could produce, and annex 10 §4’s dynamic control existed in the schema only. This route is the caller.

Idempotent by the row’s own unique key: granting the same agent the same access twice returns the incumbent rather than conflicting, because the second call asked for a state that already holds.

FieldTypeNotes
agent_idstring (uuid)required—
kb_idstring (uuid) | nulloptional—
kb_kindstring | nulloptionalmax length 60
dynamic_scopestring | nulloptionalmax length 40
moderead | writeoptionalDefault "read".
StatusDescriptionBody
201Successful ResponseKnowledgeGrantView
422Validation ErrorHTTPValidationError

The body shows the fields the schema always carries. Which combination is legal is a service rule the schema cannot express, so read the description above before copying this.

Terminal window
curl -X POST https://your-deployment.example.com/knowledge-grants \
-H "Authorization: Bearer $COBRE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "0190a2f4-0000-7000-8000-000000000000"
}'
FieldTypeNotes
idstring (uuid)required—
agent_idstring (uuid)required—
kb_idstring (uuid) | nullrequired, nullable—
kb_kindstring | nullrequired, nullable—
dynamic_scopestring | nullrequired, nullable—
moderead | writerequired—
created_atstring (date-time)required—