Create a named token (owner only). Returns the token once.
const url = 'https://example.com/datanotes/tokens/create/';const options = { method: 'POST', headers: { 'X-Datanotes-Actor': '{"harness":"my-script","model":"","session":"s-1"}', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"name":"example","description":"example","write":["example"],"ddl":true,"maintain":true,"autolink":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/datanotes/tokens/create/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'X-Datanotes-Actor: {"harness":"my-script","model":"","session":"s-1"}' \ --data '{ "name": "example", "description": "example", "write": [ "example" ], "ddl": true, "maintain": true, "autolink": true }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”JSON: on whose behalf the write is made, recorded in the journal (harness, model, session).
Example
{"harness":"my-script","model":"","session":"s-1"}Request Body
Section titled “Request Body”object
Kebab-case; the journal records it as auth. owner is reserved.
Tables the token may write: catalog.schema.table, catalog.schema., catalog. or *.
May the token change the schema?
May the token also undo, restore, vacuum, configure and rebuild the semantic index? (For an agent’s own token.)
Automatic links of the token’s writes that pass no autolink: false for a sync program’s token. Absent: the database’s autolink setting.
Example generated
{ "name": "example", "description": "example", "write": [ "example" ], "ddl": true, "maintain": true, "autolink": true}Responses
Section titled “Responses”Done.
object
A named token as the registry shows it (never its value).
object
The default of its writes for automatic links (absent: the database’s setting).
The last request made with it (saved within a minute).
The token itself: shown once, stored hashed.
Example generated
{ "entry": { "name": "example", "description": "example", "write": [ "example" ], "ddl": true, "maintain": true, "autolink": true, "created_at": "example", "updated_at": "example", "last_seen": "example" }, "token": "example"}Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Missing or wrong bearer token.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}A named token beyond its permissions (the engine’s administration, tables outside its write patterns, schema changes without ddl).
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}Unexpected error.
object
What went wrong, for a person or an agent.
Example generated
{ "error": "example"}