Docs
Live demo
POST/api/v2/access-templates
access:manageAPI token

Create a new access template with initial version

  • name cannot contain / (400).
  • max_ttl caps rule TTL (400 if exceeded). default_ttl is a UI suggestion only. Both take ISO 8601 durations (15 minutes to 30 days).

Request body application/json · CreateAccessTemplateRequest

Access template creation request

Required3 of 7 fields
bodymap of string → anyrequired
enginestringrequired
postgreskubernetesmysqlclickhousemongodbapplicationssh
namestringrequired

Template name. Leading and trailing whitespace is removed. The response returns the stored name. The name is the key of the template in its address, so it can't contain "/" (400 with details.field=name).

min length 1 · max length 255
Optional4 fields
default_ttlstring

TTL the rule wizard offers for this template, an ISO 8601 duration such as PT8H, no longer than max_ttl. Principal never adds it to a rule by itself.

example "PT8H"
descriptionstring
max_ttlstring

Longest TTL a rule of this template may ask for (L-14), an ISO 8601 duration of 15 minutes to 30 days such as P1D. Absent means the 30-day limit of every rule with a TTL.

example "P1D"
versioninteger

Responses

201

Created

AccessTemplateResponse · 12 fields
bodymap of string → any
created_atstring
default_ttlstring

TTL the rule wizard offers for this template, an ISO 8601 duration.

descriptionstring
enginestring
namestring

Key of the template. Rules, versions and every /access-templates/{name} path refer to the template by it, and a rename never changes it.

display_namestring

Name people see, the same for every version. Equals name until someone renames the template with PATCH /access-templates/{name}.

max_ttlstring

Longest TTL a rule of this template may ask for (L-14), an ISO 8601 duration.

rule_countinteger

How many rules of the caller organization use the template, any version, counted the way a refused delete counts them. Present only in GET, PUT and PATCH /access-templates/{name}.

min 0
future_objects_named_rowFutureObjectsNamedRowResponse

The first row of a PostgreSQL rule or template that names its objects by name or by a name mask while Future objects are on. Future objects reach only a row on every object of its kind in a schema, so the switch reaches none of these objects. Only a rule or template saved before Principal refused such a save carries it, and its next save is refused until Future objects are off or the row covers every object of its kind. A rule carries it in every read. A template only in GET /access-templates/{name} and the version read.

4 fields
objectsstringrequired

The kind of objects of the row, in the plural.

tablessequencesfunctionstypesobjects
databasestring

The database the row names. Absent when the row names none, and always for a template.

schemastring

The schema the row names. Absent when the row names none.

namestringrequired

The object name or name mask of the row.

updated_atstring
versioninteger
400

Bad Request: the template is invalid, or a target named in the body is not a target of this organization (a target of another organization answers like a missing one. Field_errors names body)

409

Conflict - template already exists

422

Unprocessable Entity - Future objects stay on for a PostgreSQL template body while one of its rows names its objects by name or by a name mask. Field_errors names the switch Also when Principal doesn't manage the target of the rule or template (before v7.3 that answer was 403 authorization.denied).

Common errors: 401 403 413 429 503 504. They mean the same for every operation, see Errors.

↑ ↓ to moveEnter to openEsc to close