App API.

The routes under /v1/ that the app's backend calls with its app key. The SDK wraps them, for example check is POST /v1/check.

On this page
  1. POST /v1/agents
  2. POST /v1/agents/{id}/delegate
  3. POST /v1/approvals
  4. POST /v1/check
  5. GET /v1/events/stream
  6. GET /v1/meta
  7. GET /v1/openapi.json
  8. GET /v1/sessions/tree
  9. GET /v1/users/{id}
  10. Schemas

9 routes, from the server's OpenAPI document. Every refusal is an RFC 9457 problem; the codes are in the error catalog.

POST /v1/agents

Create an agent for the subject, a person signed in with a human session

Auth
App key, in the Tensile-App-Key header
Body
CreateAgentRequest as application/json
StatusMeaningBody
201The agentAgent
400The body isn't valid, or the library refused the callProblem
401The app key isn't live (app_key_invalid), or the subject's credential isn't valid (unauthenticated)Problem
403The library's rules refuse the subjectProblem
429The app key sent too many requests; see Retry-AfterProblem
503The server can't reach its databaseProblem

POST /v1/agents/{id}/delegate

Give the agent a token, delegated from the subject's session

Auth
App key, in the Tensile-App-Key header
Body
DelegateRequest as application/json
ParameterInTypeDescription
idrequiredpathstring
StatusMeaningBody
201The token, shown onceDelegated
400The body isn't valid, or the library refused the callProblem
401The app key isn't live (app_key_invalid), or the subject's credential isn't valid (unauthenticated)Problem
403The library's rules refuse the subjectProblem
429The app key sent too many requests; see Retry-AfterProblem
503The server can't reach its databaseProblem

POST /v1/approvals

Ask the subject agent's human to approve an action; a pending request for the same action returns the same approval

Auth
App key, in the Tensile-App-Key header
Body
RequestApprovalRequest as application/json
StatusMeaningBody
201The approvalApprovalCreated
400The body isn't valid, or the library refused the callProblem
401The app key isn't live (app_key_invalid), or the subject's credential isn't valid (unauthenticated)Problem
403The library's rules refuse the subjectProblem
429The app key sent too many requests; see Retry-AfterProblem
503The server can't reach its databaseProblem

POST /v1/check

Authenticate a credential, apply a need, and redeem or request an approval

With the header Prefer: wait=N (RFC 7240), N from 1 to 60, a retry that redeems a pending approval is held until the person approves or denies, the approval expires, or N seconds pass, and answers approval_pending when they pass. On the check that creates an approval, N caps the wait that the refusal's fix and wait_hint offer; without the header, the refusal offers no wait and tells the agent to retry after Retry-After. Each app key holds at most 256 waits on each replica; a retry over that answers at once. Give a waiting call a timeout of N seconds plus your usual timeout.

Auth
App key, in the Tensile-App-Key header
Body
CheckRequest as application/json
ParameterInTypeDescription
Preferheaderstringwait=N, from 1 to 60: how long to hold a retry for the person's decision, and the longest wait the refusal offers. Larger values count as 60.
StatusMeaningBody
200The server decided; the end user's outcome is in the bodyCheckResponse
400The body isn't validProblem
401The app key is missing or isn't live: code app_key_invalidProblem
429The app key sent too many requests; see Retry-AfterProblem
503The server can't reach its databaseProblem

GET /v1/events/stream

Server-sent events that tell the SDK when to clear its cache: ready once subscribed, then invalidate after each change to sessions, agents, or users. The stream ends when the server stops hearing every change; bypass the cache until it reconnects

Auth
App key, in the Tensile-App-Key header
StatusMeaningBody
200The stream: event ready, then event invalidate after each change, and a comment every 15 secondsstring
401The app key is missing or isn't live: code app_key_invalidProblem
429The app key sent too many requests; see Retry-AfterProblem
503The server can't hear every change, or can't reach its database; bypass the cache and retry after Retry-AfterProblem

GET /v1/meta

The server's version, the API versions it serves, and its preset

Auth
App key, in the Tensile-App-Key header
StatusMeaningBody
200The server's metadataMeta
401The app key is missing or isn't live: code app_key_invalidProblem
429The app key sent too many requests; see Retry-AfterProblem
503The server can't reach its databaseProblem

GET /v1/openapi.json

This document

Auth
None
StatusMeaningBody
200The OpenAPI documentobject

GET /v1/sessions/tree

The subject's live sessions, as a tree of delegations

Auth
App key, in the Tensile-App-Key header
ParameterInTypeDescription
Tensile-Subjectrequiredheaderstringbase64url JSON in the shape of Credential
StatusMeaningBody
200The treeSessionTree
401The app key isn't live (app_key_invalid), or the subject's credential isn't valid (unauthenticated)Problem
429The app key sent too many requests; see Retry-AfterProblem
503The server can't reach its databaseProblem

GET /v1/users/{id}

What the server knows of a user: the address, whether it's verified, and live sessions and agents

Auth
App key, in the Tensile-App-Key header
ParameterInTypeDescription
idrequiredpathstring
StatusMeaningBody
200The userUser
401The app key isn't live (app_key_invalid), or the subject's credential isn't valid (unauthenticated)Problem
404No session, agent, or address has this user ID: code not_foundProblem
429The app key sent too many requests; see Retry-AfterProblem
503The server can't reach its databaseProblem

Schemas

Action

FieldTypeDescription
kindrequiredstring
resourcestring
paramsmap of string
summarystring

Agent

FieldTypeDescription
idrequiredstring
ownerrequiredstring
namerequiredstring
scopesrequiredarray of string
created_atrequiredstring (date-time)

ApprovalCreated

FieldTypeDescription
idrequiredstring
staterequiredstring
expires_atrequiredstring (date-time)
urlstring

Challenge

What would turn a refused request into a success: the need that failed, and the factors that would meet it

FieldTypeDescription
actionrequiredstring
assurancerequired"none" or "recovering" or "single" or "multi"
within_secondsintegerAt least 0.
humanboolean
scopesarray of string
satisfy_withrequiredarray of "passkey" or "totp" or "recovery" or "external" or "federated" or "password" or "bridged"
beginstring
approvalChallengeApproval
purposePurpose

ChallengeApproval

The approval an agent can wait for instead of stopping at a refusal

FieldTypeDescription
idrequiredstring
urlstring
summaryrequiredstring
expires_inrequiredinteger
wait_hintstring

CheckRequest

FieldTypeDescription
credentialrequiredobjectExactly one of cookie or authorization; dpop only with authorization
credential.cookiestringThe __Host-session cookie's value
credential.authorizationstring
credential.dpopstring
requestrequiredobject
request.methodstring
request.urlrequiredstringThe URL the client called on the app; its origin must be one of the server's origins, or the answer refuses with origin_not_allowed
request.client_ipstring
request.user_agentstring
request.originstringThe browser's Origin header. Cookie requests get the library's cross-origin protection
request.sec_fetch_sitestringThe browser's Sec-Fetch-Site header
needNeed
approvalobjectWith id, redeems that approval for action; without id, an agent that misses the need gets human_required with an approval for action in challenge.approval
approval.idstring
approval.actionrequiredAction
resourcestringThe canonical URI of the resource server that checks; tokens bound to another resource are refused

CheckResponse

FieldTypeDescription
allowedrequiredboolean
principalPrincipal
problemProblem
set_cookiesrequiredarray of string
headersrequiredmap of string

CreateAgentRequest

FieldTypeDescription
subjectrequiredCredential
namerequiredstring
scopesarray of string

Credential

One of cookie or authorization; dpop only with authorization

FieldTypeDescription
cookiestring
authorizationstring
dpopstring

DelegateRequest

FieldTypeDescription
subjectrequiredCredential
namestring
scopesarray of string
ttl_secondsintegerAt least 0.
key_thumbprintstring

Delegated

The agent's token, shown once

FieldTypeDescription
tokenrequiredstring
sessionrequiredstring
agentrequiredstring
scopesrequiredarray of string
expires_atrequiredstring (date-time)

Meta

FieldTypeDescription
versionrequiredstring
api_versionsrequiredarray of string
presetrequiredstring

Need

FieldTypeDescription
actionrequiredstring
humanboolean
assurance"none" or "recovering" or "single" or "multi"
within_secondsintegerAt least 0.
scopesarray of string
approval_ttl_secondsintegerHow long an approval for this need lives: 60 to 86400 seconds, or 0 for 5 minutes. From 0 to 86400.

Principal

FieldTypeDescription
userrequiredstring
sessionrequiredstring
kindrequired"human" or "agent" or "pat" or "oauth"
agentrequiredstring or null
scopesrequiredarray of string
assurancerequiredstring
methodsrequiredarray of string
authenticated_atrequiredstring (date-time)
expires_atrequiredstring (date-time)

Problem

An RFC 9457 problem, as authhttp writes it and the browser client reads it

FieldTypeDescription
typerequiredstring
titlerequiredstring
statusrequiredinteger
coderequiredstring
detailstringWhat happened in this occurrence, for people
fixstring
retry_afterintegerSeconds to wait before retrying, for throttled At least 0.
challengeChallenge

Purpose

The purpose an elevation must be for

FieldTypeDescription
namerequiredstring
resourcestring

RequestApprovalRequest

FieldTypeDescription
subjectrequiredCredential
actionrequiredAction
needrequiredNeed

Session

FieldTypeDescription
idrequiredstring
kindrequired"human" or "agent" or "pat" or "oauth"
agentrequiredstring or null
parentrequiredstring or null
namestring
devicestring
scopesrequiredarray of string
created_atrequiredstring (date-time)
last_seen_atrequiredstring (date-time)
expires_atrequiredstring (date-time)
childrenrequiredarray of Session

SessionTree

FieldTypeDescription
sessionsrequiredarray of Session

User

FieldTypeDescription
idrequiredstring
emailrequiredstring or null
email_verifiedrequiredboolean
live_sessionsrequiredinteger
agentsrequiredinteger
last_seen_atrequiredstring (date-time) or null