Skip to content

Save a prompt of one's own​

POST
/api/prompts

Saves a prompt (prompts-v1.md): name (^[a-z0-9][a-z0-9-]{0,31}$, unique for the caller), title, description?, body (text with {{id}} references; \{{ writes {{), variables? (questions of the UI catalog, version 8, without show and without the type images: every one declared and used) and audience? (role values; "*" only alone; empty is private). Sharing needs prompts.share (no role holds it by default, admin included): a request whose audience is not empty without it is 403 forbidden, before the values are read. The checks run in one order (the vectors of requests.json and prompts.json hold them): 401, 403 no_access, 415, the shape (400 bad_request), 403 forbidden, the values (400 bad_name, bad_title, bad_description, bad_body, bad_reference, bad_variable, undeclared_variable, unused_variable, bad_audience, each with at and, for a reference, offset in UTF-16 code units), and last the store (409 name_taken, then too_many_prompts). The media type is exactly application/json, and the body at most 64 KiB. The caller holds at most 100. The text of a body, a title and an answer is in no log.

Authorizations​

bearerToken

A JWT signed by the configured issuer (RS256, RS384, ES256 or EdDSA), with the configured audience. Read when auth.mode is jwt or jwt_or_proxy_header. A missing or refused token gets 401 with WWW-Authenticate: Bearer; an issuer whose keys cannot be fetched gets 503.

Type
HTTP (bearer)
or
dpopToken

A JWT as bearerToken, bound to the key of the client (cnf.jkt, RFC 7638), sent as Authorization: DPoP <token> with one DPoP header holding a proof signed by that key (RFC 9449, ADR 0054). Read only when auth.dpop is configured. A bad proof gets 401 with WWW-Authenticate: DPoP error="invalid_dpop_proof", algs="ES256 EdDSA", a bad or unbound token error="invalid_token".

Type
HTTP (DPoP)
or
proxyIdentity

Set by oauth2-proxy after OIDC login; requests without it get 401. Read when auth.mode is proxy_header (the default) or jwt_or_proxy_header without a bearer token.

Type
API Key (header: X-Auth-Request-Email)

Request Body​

JSON
{
  
"name": "string",
  
"title": "string",
  
"description": "string",
  
"body": "string",
  
"variables": [
  
  
{
  
  
}
  
],
  
"audience": [
  
  
"string"
  
]
}

Responses​

The prompt as saved

JSON
{
  
"id": "string",
  
"name": "string",
  
"title": "string",
  
"description": "string",
  
"body": "string",
  
"variables": [
  
  
{
  
  
  
"id": "string",
  
  
  
"question": "string",
  
  
  
"help": "string",
  
  
  
"type": "single",
  
  
  
"options": [
  
  
  
  
{
  
  
  
  
  
"value": "string",
  
  
  
  
  
"label": "string",
  
  
  
  
  
"description": "string",
  
  
  
  
  
"icon": "agent",
  
  
  
  
  
"recommended": true
  
  
  
  
}
  
  
  
],
  
  
  
"multiple": true,
  
  
  
"allowOther": true,
  
  
  
"required": true,
  
  
  
"default": "string",
  
  
  
"min": 0,
  
  
  
"max": 0,
  
  
  
"yesLabel": "string",
  
  
  
"noLabel": "string",
  
  
  
"minValue": "string",
  
  
  
"maxValue": "string",
  
  
  
"step": "string",
  
  
  
"unit": "string",
  
  
  
"from": 0,
  
  
  
"to": 0,
  
  
  
"fromLabel": "string",
  
  
  
"toLabel": "string",
  
  
  
"minDate": "string",
  
  
  
"maxDate": "string"
  
  
}
  
],
  
"own": true,
  
"audience": [
  
  
"string"
  
],
  
"revision": "string",
  
"updatedAt": "2024-01-01T00:00:00Z"
}

Samples​

Powered by VitePress OpenAPI