Skip to content

Create a named token (owner only). Returns the token once.

POST
/datanotes/tokens/create/
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 }'
X-Datanotes-Actor
string

JSON: on whose behalf the write is made, recorded in the journal (harness, model, session).

Example

{"harness":"my-script","model":"","session":"s-1"}
Media typeapplication/json
object
name
required

Kebab-case; the journal records it as auth. owner is reserved.

string
/^[a-z0-9][a-z0-9-]*$/
description
string
write

Tables the token may write: catalog.schema.table, catalog.schema., catalog. or *.

Array<string>
ddl

May the token change the schema?

boolean
maintain

May the token also undo, restore, vacuum, configure and rebuild the semantic index? (For an agent’s own token.)

boolean
autolink

Automatic links of the token’s writes that pass no autolink: false for a sync program’s token. Absent: the database’s autolink setting.

boolean

Example generated

{
"name": "example",
"description": "example",
"write": [
"example"
],
"ddl": true,
"maintain": true,
"autolink": true
}

Done.

Media typeapplication/json
object
entry

A named token as the registry shows it (never its value).

object
name
required
string
description
string
write
required
Array<string>
ddl
required
boolean
maintain
boolean
autolink

The default of its writes for automatic links (absent: the database’s setting).

boolean
created_at
required
string
updated_at
required
string
last_seen

The last request made with it (saved within a minute).

string
token

The token itself: shown once, stored hashed.

string

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.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Missing or wrong bearer token.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

A named token beyond its permissions (the engine’s administration, tables outside its write patterns, schema changes without ddl).

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Unexpected error.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}