Skip to content
Hexel StudioDocs

Approvals where your team works

Send Titan's approvals to Slack, to a phone, into your own app or to your webhook, and decide them there with the same checks as the console.

On this page

An approval should reach the person who decides it where they already are, not wait in a console. Titan does three things for every approval, wherever it is decided:

  1. It decides that an approval is needed, from your policy.
  2. It checks the decision: who decided, that they may decide, the quorum, and how the decision was signed.
  3. It records the decision in the Agent Ledger, with where it came from (decided_via).

The console, the CLI and the API stay the record and the fallback: every approval is listed there, whatever else is set up, and an administrator can decide it there.

Choose a destination

Two kinds of people decide approvals, and the destinations differ for each.

  • The person the agent works for. An agent acting for someone (for example, a request they made in Slack) asks them before it acts. Your organization allows this with the delegated_self_approval setting.
  • Role approvers. People listed in an approval role of the rule's approval profile, for example a release manager or the security team. The requester can be kept out with requester_separation_required.
WhereWho decides thereHow they decideAvailability
Console, CLI, APIRole approvers, administratorsThe admin decide routeAvailable
SlackThe person the agent works forApprove and Deny buttons on a card in their Slack threadPrivate preview, turned on per deployment
PhoneThe person the agent works forPhone-signed decision in the phone appPrivate preview, turned on per deployment
Your own appRole approvers, the person the agent works forYour app calls the decide route with the approver's own tokenAvailable
WebhookRole approversSigned approval.requested, approval.decided and approval.expired events to your backend; your app decidesRolling out (see Webhook)

To turn on Slack, phone or webhook delivery for a deployment during the private preview, write to support@mail.hexelstudio.com with the deployment id (td-...).

Slack

When someone asks an agent for something in Slack and the agent needs approval, Titan posts a card in that Slack thread (or a direct message). The card shows what the agent wants to do, on which resource, which agent asked and when the request expires, with Approve and Deny buttons. Once the approval ends, the card is updated to show the outcome, wherever it was decided.

WhatsApp works the same way where it's turned on for your deployment: list whatsapp in approval_channels, and the vote is recorded with decided_via: whatsapp.

What a click checks

  1. Slack's request signature.
  2. The person who clicked is the person the agent works for, through their linked Slack account. Anyone else in the channel sees "only the requester can answer this", and nothing is decided.
  3. The same rules as a decision on the API: the request is still pending, your settings still allow Slack approvals, and the action is checked again against the policy in force now.

The vote is recorded with decided_via: slack. Clicking the same button again only shows the current state.

When a card has no buttons

A card links to the phone app instead of deciding, when the person can't decide alone from Slack:

ReasonWhat it means
phone_signature_requiredPhone-signed decisions are required where your deployment runs (see Phone); open the phone app.
separation_requiredThe approval profile sets delegator_separation_required: the person the agent works for may not approve, so someone else must decide.
approvers_requiredThe person's approve alone would not complete the approval: role approvers or a larger quorum are needed.
slack_not_allowedYour settings don't allow Slack approvals: approval_channels must list slack and chat_actions must list approve.

Turn it on

Slack approvals need the Slack app installed for your organization and each person's Slack account linked once. Then allow the person to decide their own agent's approvals, from Slack:

Bash
curl -X PATCH "https://api.hexelstudio.com/v1/titan/management/settings" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "set": {
      "delegated_self_approval": true,
      "chat_actions": ["approve"],
      "approval_channels": ["web", "slack"]
    }
  }'

Values under set replace the whole option. If your organization already has other chat_actions (such as start) or approval_channels (such as mobile_push, extension or whatsapp), include them in the lists too, or they are turned off.

SettingValuesLevels
delegated_self_approvaltrue lets the person the agent works for decide its approvals. Default false.Organization, workspace, deployment
chat_actionsapprove, start, steer. approve is needed for Slack buttons. Default none.Organization, workspace
approval_channelsweb, slack, mobile_push, extension, whatsapp. Default web.Organization, workspace, deployment

PATCH /v1/titan/management/settings/workspaces/{workspace_id} and PATCH /v1/titan/management/deployments/{id}/settings set the same options for one workspace or one deployment.

Phone

A person enrolls their phone once. Its key stays in the phone's Secure Enclave or Android Keystore. When their agent needs approval, Titan sends a push notification to their trusted phones; they review the action on the phone and approve or deny it, and the phone signs the decision. Titan accepts only a decision signed by one of their active phones, and records it with decided_via: phone.

Phone signatures can be made mandatory for a whole Titan plane: every approval of a person then needs a signature from their phone, and a decision without one is refused with 403 DEVICE_SIGNATURE_REQUIRED, on the console and the API too. This is a setting of the plane, not of one organization or deployment, so it's available on Titan Dedicated and on-premises, where the plane is yours; ask us to turn it on. On the shared Titan Cloud plane it isn't offered per customer.

Role approvers can decide on their phones as well, through the push destination of the webhook section's notify list (rolling out). For them, your settings must also list mobile_push in approval_channels.

Your own mobile app can do the same with the Titan device SDKs for React Native (Expo) and Android; ask us for access.

Your own app

Any app can show approvals to its users and decide them, as long as it decides with the approver's own token. Titan then checks that person exactly as on the console: their permission, their approval role, requester separation and the quorum. An app can't approve on someone's behalf with a shared key.

Role approvers decide on the admin route with their own access token (they need the titan:approval:decide permission and a role in the approval profile):

Bash
curl -X POST "https://api.hexelstudio.com/v1/titan/admin/approvals/$APPROVAL_ID:decide" \
  -H "Authorization: Bearer $APPROVER_ACCESS_TOKEN" \
  -H "Titan-Enforcement-Deployment: $TITAN_ENFORCEMENT_ID" \
  -H "Content-Type: application/json" \
  -d '{"decision": "approve"}'

With the TypeScript SDK (0.3.0 or later):

TypeScript
import { decideApproval } from '@hexelstudio/titan-sdk/approvals';

const result = await decideApproval(approvalId, 'approve', {
  as: approverAccessToken,          // the approver's own token, never a service key
  enforcementDeploymentId: 'td-...',
});
console.log(result.state);          // approved, denied, or pending while more approvers are needed

The person the agent works for decides on the person routes with their user-route token, which your deployment's identity provider issues:

Bash
curl "https://api.hexelstudio.com/v1/titan/user/approvals" \
  -H "Authorization: Bearer $USER_ROUTE_TOKEN" \
  -H "Titan-Enforcement-Deployment: $TITAN_ENFORCEMENT_ID"

curl -X POST "https://api.hexelstudio.com/v1/titan/user/approvals/$APPROVAL_ID:decide" \
  -H "Authorization: Bearer $USER_ROUTE_TOKEN" \
  -H "Titan-Enforcement-Deployment: $TITAN_ENFORCEMENT_ID" \
  -H "Content-Type: application/json" \
  -d '{"decision": "approve"}'

When phone signatures are required, the body also carries proof, the decision signed by the person's phone. The person routes are served once they are turned on for your deployment; until then they answer 404 NOT_FOUND.

To know when an approval is waiting, list pending approvals (GET /v1/titan/admin/approvals?state=pending), or receive webhook events.

Webhook

A webhook destination sends your backend a signed event when an approval is requested, and again when it's decided or expires, once for each person who may decide it. Your app shows it to that person, and they decide in your app as in Your own app.

Set the destination

JSON
{
  "approval_profiles": [
    {
      "approval_profile_id": "release_managers",
      "role_ids": ["release_managers"],
      "quorum": 1,
      "requester_separation_required": true,
      "maximum_age_seconds": 3600,
      "notify": [
        { "type": "webhook", "url": "https://api.acme.com/titan/approvals" },
        { "type": "push" }
      ]
    }
  ]
}
typeWhat it does
consoleNothing extra: the approval is listed in the console, the CLI and the API, as always.
webhookSigned events to url. The URL must be https on port 443 and resolve to a public address; redirects are not followed.
pushA push notification to the trusted phones of every approver in the profile's roles, who decide phone-signed.

What your backend receives

Each event is a POST with Content-Type: application/jwt. The body is a compact JWS: header {"alg": "EdDSA", "kid": "...", "typ": "titan-approval-event+jwt"}, signed with your deployment's key. Its payload:

JSON
{
  "iss": "urn:titan:approval-events:td-0123456789abcdef0123456789abcdef",
  "aud": "https://api.acme.com/titan/approvals",
  "sub": "user_alice",
  "iat": 1800000000,
  "exp": 1800000300,
  "jti": "aev_0123456789abcdef0123456789abcdef",
  "event": {
    "v": 1,
    "type": "approval.requested",
    "event_id": "aev_0123456789abcdef0123456789abcdef",
    "occurred_at": 1800000000,
    "organization_id": "org_0123456789abcdef",
    "enforcement_deployment_id": "td-0123456789abcdef0123456789abcdef",
    "approval": {
      "approval_request_id": "apr_0123456789abcdef0123456789abcdef",
      "workspace_id": "ws_engineering",
      "environment_id": "env_prod",
      "capability": "github.issue.create",
      "capability_revision": 3,
      "resource_type": "github.repository",
      "resource_id": "github.repository:acme/payments",
      "operation": "create",
      "approval_profile_ids": ["release_managers"],
      "requester_agent_id": "agt_0123456789abcdef",
      "created_at": 1800000000,
      "expires_at": 1800003600
    }
  }
}
FieldMeaning
subThe approver this delivery is for. Show the approval to this person only.
jtiThe event id; the same on every retry. Handle each once.
expFive minutes after iat. Refuse an expired delivery.
event.typeapproval.requested, approval.decided or approval.expired.
event.decisionOn approval.decided only: outcome (approved, denied or revoked), reason (approver or titan), decided_at, and for an approver's decision decided_by and decided_via (console, phone, slack, webhook_app or cli).

The event shows what the agent wants to do, never the action's arguments.

Verify and handle events

Verify every delivery before you trust it: the signature against your deployment's keys, typ, iss (your deployment), aud (exactly your URL) and exp. The keys are public, at GET https://api.hexelstudio.com/v1/titan/user/push-keys with the Titan-Enforcement-Deployment header; read them again when a delivery names a kid you don't have.

The SDK's receiver does all of this, and drops repeats:

TypeScript
import { createApprovalReceiver, decideApproval, ApprovalEventError } from '@hexelstudio/titan-sdk/approvals';

const approvals = createApprovalReceiver({
  enforcementDeploymentId: 'td-...',
  webhookUrl: 'https://api.acme.com/titan/approvals', // exactly as in notify
});

approvals.on('requested', async (event, delivery) => {
  await showInMyApp(delivery.sub, event.approval);     // the approver, and what to show them
});
approvals.on('decided', async (event) => {
  await closeInMyApp(event.approval.approval_request_id, event.decision);
});
approvals.on('expired', async (event) => {
  await closeInMyApp(event.approval.approval_request_id);
});

// Your webhook route:
export async function POST(request: Request) {
  try {
    await approvals.handle(await request.text());
    return new Response(null, { status: 204 });
  } catch (err) {
    // 400: the delivery didn't verify; 500: your handler failed, and Titan sends it again later.
    return new Response(null, { status: err instanceof ApprovalEventError ? 400 : 500 });
  }
}

// When the approver clicks Approve in your app, with their own token:
await decideApproval(approvalId, 'approve', { as: approverAccessToken, enforcementDeploymentId: 'td-...' });

Answer with any 2xx status once you've handled a delivery. Titan retries any other answer, or no answer within 10 seconds, with backoff, and gives up after its last attempt. Each retry carries the same jti.

Errors

CodeWhereMeaning
403 NOT_AN_ELIGIBLE_APPROVERAdmin routeThe person isn't in an approval role of the profile.
403 SELF_APPROVAL_NOT_ALLOWEDPerson routesYour settings don't let a person decide their own agent's approvals (delegated_self_approval).
403 PERSON_APPROVAL_ONLYPerson routes, admin decide route, phone pushThe agent's session acts for a person of another organization, so only that person may approve it, on their own person routes. Others may still deny.
403 DELEGATOR_SEPARATIONAnyThe person the agent works for can't approve this profile; another approver must.
403 DEVICE_SIGNATURE_REQUIREDPerson routes, admin routePhone signatures are required; decide in the phone app.
403 DEVICE_SIGNATURE_INVALIDPerson routesThe proof didn't verify with one of the person's trusted phones.
403 CHAT_NOT_REQUESTERSlackSomeone other than the person the agent works for clicked the card.
403 CHAT_ACTION_NOT_ALLOWEDSlackYour settings no longer allow slack in approval_channels or approve in chat_actions.
403 CHAT_CARD_NOT_DECIDABLESlackThe approval can no longer be decided from Slack alone.
409 APPROVAL_NOT_PENDINGAnyThe approval was already decided or has expired.
400 POLICY_TERM_UNSUPPORTEDPolicy updatenotify isn't offered for your organization yet.
404 NOT_FOUNDPerson routes, keysThe routes or the keys aren't turned on for the deployment.