Note: The Casa API is still in beta and some breaking changes are to be expected.

#

Casa API

Casa’s API allows developers to integrate Casa’s wallet functionality into their own apps.

Every request is made on behalf of a Casa user and carries that user’s API Token. There are two ways to obtain one:

  1. Connected app — your app launches Casa’s Connect Flow with the @casainc/browser package; the user signs in and Casa issues a token for your app. See Authentication.
  2. Personal API key — a Casa user creates a token themselves in the Casa web app, choosing its scope and domains, with no connected app involved. See Personal API keys.

Both kinds of token are used the same way: send them in the x-api-key header of every request. The SDK packages wrap the wallets endpoints; everything else is documented as plain HTTP in the REST API section.

This documentation is for the following package versions:

@casainc/browser
v0.3.2
@casainc/node
v0.1.8

Authentication

API tokens

Every request to https://connect.keys.casa must carry an API Token in the x-api-key header:

curl https://connect.keys.casa/wallets \
  -H "x-api-key: $CASA_API_TOKEN"

A token is tied to one Casa user and to a scope and a set of domains (see Scopes and domains). A request the token does not cover fails with 403 INSUFFICIENT_SCOPE; a token the user has revoked fails with 401 AUTH_INVALID.

A user’s API Token is sensitive. Make sure to store it securely (encrypted as you would with any other auth token), and never embed it in client-side code you ship to other users.

Connected apps

A connected app is an integration that Casa has registered and issued an App ID for. Your app launches the Connect Flow; the user signs in to Casa, reviews your app, and Casa creates an API Token for your app on that user’s behalf. The token is returned to your app and the user can revoke it at any time from the Casa web app.

Requesting scopes for a connected app

A connected app’s scope and domains are part of its registration, not of each request. Every token the Connect Flow issues for your app carries exactly the access registered for the app, and nothing in the request body can raise it.

New apps are registered with read-only access to the wallets domain. If your integration needs more — read & write access, or the keysets domain — request it when you ask for your App ID, or afterwards, by writing to connect@team.casa with:

  • which scope you need (read-only or read-write), and
  • which domains you need (wallets, keysets, or both), and
  • what your integration will do with that access.

Access beyond read-only wallets is granted by Casa on a per-app basis. Once your registration is updated, tokens created through the Connect Flow from then on carry the new access; tokens users created earlier keep the access they were issued with until the user reconnects.

Personal API keys

A Casa user can also create an API Token directly, without any connected app. This suits scripts, dashboards, and tooling a user runs against their own account.

In the Casa web app, open API Keys in the sidebar (https://app.keys.casa/api-keys) and choose Create API Key:

  1. Give the key a label (for example “Portfolio tracker”).
  2. Choose its scope: Read-only or Read & write.
  3. Choose its domains: Wallets, Keysets, or both.
  4. Verify with the account’s two-factor authentication. A personal key cannot be created on an account without 2FA.

The token is shown once, when the key is created; copy it then. The API Keys page lists each key’s label, scope, domains, creation date and last use, and lets the user revoke it. A revoked token fails with 401 AUTH_INVALID on its next use.

Personal API keys are rolling out gradually. If API Keys is not in the sidebar of a Casa account yet, that account does not have the feature enabled; ask us at connect@team.casa.

Personal keys and connected-app tokens are interchangeable on the API: same header, same endpoints, same scope rules. The difference is only in how they are created and who chose the scope.

Scopes and domains

A token has one scope that applies to every domain on it:

ScopeAllows
read-onlyReading data in the token’s domains.
read-writeReading, plus the write operations in the token’s domains — creating transactions and signing, or managing devices and health checks. Write access always includes read access.

and one or more domains that pick which parts of the account it can reach:

DomainCovers
walletsWallets, balances, transactions, transaction signatures, fee estimates.
keysetsKeysets (device groups), devices, and device health checks.

Each endpoint below states the domain and access it requires. Some data crosses the line: a wallet’s embedded keyset and the extended public keys (xpub) of the keys that secure it belong to the keysets domain, so they are omitted from wallets-domain responses unless the token also holds keysets.

A request the token does not cover is rejected before anything runs:

{
  "status": 403,
  "code": "INSUFFICIENT_SCOPE",
  "message": "API key does not grant write access to the wallets domain"
}

Errors

Errors raised by the API’s authentication and authorization layer share one shape:

interface ApiError {
  status: number
  code: ApiErrorCode
  message: string
}

type ApiErrorCode =
  | 'AUTH_INVALID' // 401: the token is missing, malformed, or has been revoked
  | 'INSUFFICIENT_SCOPE' // 403: the token's scope or domains do not cover this request
  | 'NOT_FOUND' // 404: no such endpoint

Validation and business-rule failures come from the endpoint itself as a 400 whose body has an error field. It is a plain message:

{ "error": "Must specify toAddress or toAccount" }

or, when the failure has a stable code you can branch on, an object:

{
  "error": {
    "code": "missing_send_amount",
    "message": "Send amount is missing. Please provide a total or the toAccount for a wallet sweep."
  }
}

Individual endpoints also return 404 (with the same error body) for a resource that exists but does not belong to the token’s user, and 422 when a broadcast is rejected by the network.

API Limits

Requests to Casa’s API are rate-limited to 100 reads and 100 writes per second. If this limit is reached, the request will fail with the 429 (Too Many Requests) HTTP status.

Browser

Getting Started

There are some important things to keep in mind when getting started:

  1. You need to get an App ID, which you can request by getting in touch with us at connect@keys.casa.
  2. You need to install the @casainc/browser npm package.

Connect Flow

For your users to connect their Casa account with your app, they must go through Casa’s Connect Flow.

The Connect Flow is launched in a new browser window from within your app. It gives users the opportunity to review the requested permissions and then create an API Token for your app.

Customize the onboarding

Certain features can be customized in the Connect Flow:

  1. Enable certain Casa tiers (Free, Standard, Premium, and Private Client) or disable signup completely.
  2. Offer discounts for a Casa subscription for your users by partnering with Casa.

To utilize any of these features, you will need to get in touch with us at connect@team.casa.

API Token

API Tokens are generated when a user completes the Connect Flow. This flow is launched using the @casainc/browser package:

import { connect } from '@casainc/browser'

const apiToken: string | null = await connect({
  appId: MY_APP_ID,
})
// Store apiToken somewhere
// It is null when the user exits the flow early

Optionally, the user’s email address can be passed along to prefill it within the Connect Flow:

connect({
  appId: MY_APP_ID,
  email: 'user_email@example.com',
})

The token carries the scope and domains registered for your app — see Requesting scopes for a connected app. Store it securely and handle revocation as described under Errors: a revoked token fails with 401 AUTH_INVALID, at which point you can request a new one by going through the Connect Flow again.

Wallets API

Once you have the API Token, wallet data can be fetched:

import { getWallets } from '@casainc/browser'
const wallets: Wallet[] = await getWallets({
  token: apiToken,
})
// Render the wallet balances, etc

The getWallets method returns an array of Wallet objects. See the Interfaces section below.

Note: By default, only mainnet wallets are fetched. To change this, you can pass testnet: true as an option to getWallets.

Node.js

Getting Started

Before making API requests for a user, you need to generate an API Token. Read the Browser section above on how to do this.

Once you have an API Token, you can use the @casainc/node npm package.

Wallets API

Wallet data can be fetched using the API Token you have stored:

import { getWallets } from '@casainc/node'
const wallets: Wallet[] = await getWallets({
  token: apiToken,
})

The getWallets method returns an array of Wallet objects. See the Interfaces section below.

Note: By default, only mainnet wallets are fetched. To change this, you can pass testnet: true as an option to getWallets.

getWallets({
  token: apiToken,
  testnet: false,
})

REST API

Everything the SDKs do not wrap is available as plain HTTP against https://connect.keys.casa. Send JSON, receive JSON, and put the user’s token in the x-api-key header. Each endpoint lists the domain and access it requires.

export CASA_API="https://connect.keys.casa"
export CASA_API_TOKEN="..." # a connected-app token or a personal API key

Wallets

wallets domain. Reads need read-only; creating transactions needs read-write.

List wallets

GET /wallets — every active wallet the user owns or can sign for.

QueryDefaultMeaning
testnetfalsetrue returns testnet wallets (TBTC, TETH) instead of mainnet ones.
activeOnlytruefalse includes deactivated wallets.
convertToCurrencies—Comma-separated fiat codes, e.g. USD,EUR; fills balance.fiat.
curl "$CASA_API/wallets?convertToCurrencies=USD" -H "x-api-key: $CASA_API_TOKEN"

Returns Wallet[].

Get a wallet

GET /wallets/{walletId} — one wallet, with the same convertToCurrencies query. When the token also holds the keysets domain the response embeds the full keyset that secures the wallet; otherwise keyset is omitted and only keysetId and keysetType identify it.

Returns Wallet.

Estimate a fee rate

GET /wallets/{walletId}/transactions/feeRateEstimate — current fee rates for a new transaction from this wallet, in satoshis per kilobyte.

{ "feeRate": 2000, "slowFeeRate": 1000, "fastFeeRate": 4000, "minFeeRate": 1000, "maxFeeTotal": 12000 }

List a wallet’s transactions

GET /wallets/{walletId}/transactions — the wallet’s transactions, newest first, each with its signatures.

Returns Transaction[].

Create a transaction

POST /wallets/{walletId}/transactions — read-write. Builds an unsigned transaction and reserves the coins it spends; nothing is broadcast until Broadcast a transaction.

Body fieldRequiredMeaning
toAddressone of toAddress, toAccountDestination address.
toAccountone of toAddress, toAccountThe id of another wallet the token’s user can access. With total, the transaction pays that wallet’s current deposit address. Without total, it sweeps this wallet’s whole balance into that wallet.
totalyes, unless toAccount is setAmount to send in the coin’s base unit (satoshis for BTC), as a positive number or numeric string. Omit it only for a sweep to toAccount; a request with neither returns 400 with code missing_send_amount.
fullSweepnoFlag for a send of the whole balance. It does not replace total: for BTC the amount still comes from total; for ETH and ERC-20 it lets the amount use the whole balance with no gas reserve.
manualFeeRatenoFee rate in satoshis per kilobyte. Defaults to the estimate above; values below the network minimum are raised to it.
memonoFree-text note stored with the transaction.
curl -X POST "$CASA_API/wallets/$WALLET_ID/transactions" \
  -H "x-api-key: $CASA_API_TOKEN" -H "content-type: application/json" \
  -d '{ "toAddress": "bc1q...", "total": 250000, "memo": "invoice 42" }'

Returns 201 with the new Transaction (txId is null until broadcast). Fails with 400 if the wallet cannot cover total plus fees.

Transactions

wallets domain. Reading a transaction needs read-only; signing, broadcasting and cancelling need read-write.

Bitcoin only. The signing steps below (inputs, outputs, toSign, and the signature format) apply to BTC and TBTC wallets. ETH and TETH wallets use a different signing payload that this reference does not document yet: inputs and outputs return 400 for them, and their toSign response has no usable utxoLookup.

A Bitcoin transaction goes through these steps, all against the same transactionId:

  1. Request a signature for one of the wallet’s keys — POST /transactions/{id}/signatures.
  2. Fetch the signing data — GET /transactions/{id}/toSign.
  3. Sign each input with that key’s private key, off-line or on your signing device.
  4. Submit the signatures — PUT /signatures/{signatureId}.
  5. Repeat until the keyset’s signatureThreshold is met. Wallet does not carry this field: read it from the wallet’s embedded keyset (GET /wallets/{id} with the keysets domain) or from GET /keysets/{keysetId}. A phone-key wallet needs one signature.
  6. Broadcast — POST /transactions/{id}/send.

List transactions

GET /transactions — display-ready summaries of the user’s transactions, newest first. Casa computes every label, amount and status, so a client can render the list as it is returned.

By default (scope=actionable) the response holds the un-broadcast transactions the user can act on: add a signature, or broadcast once the signature threshold is reached. With scope=all it holds the history of every keyset the user can view, including broadcast sends and received deposits. Heirs who are not team signers see only the transactions they started.

Query parameterDefaultMeaning
scopeactionableactionable returns what the user can sign or broadcast; all returns the full history.
networkBTCBTC, ETH (includes ERC-20 transfers) or all.
testnetfalsetrue reads testnet wallets instead of mainnet.
keysetId—Only this keyset’s transactions.
walletId—Only this wallet’s transactions.
limit200 with scope=all, otherwise unlimitedMaximum number of summaries (1–500).
before—scope=all only. The id of the last summary of the previous page; returns the summaries after it.

The response header X-Has-More is true when more transactions match than the response holds. Page with before until it is false.

curl "$CASA_API/transactions?scope=all&limit=50" -H "x-api-key: $CASA_API_TOKEN"

Returns TransactionSummary[].

Get a transaction

GET /transactions/{transactionId} — the transaction with its signatures and the wallet it spends from. Returns Transaction.

Get inputs and outputs

GET /transactions/{transactionId}/inputs and GET /transactions/{transactionId}/outputs — a decoded view of what the transaction spends and pays, useful for showing a confirmation screen. Bitcoin only: for an ETH or TETH transaction both return 400 (This operation is only available for UTXO-based transactions).

{ "inputs": [{ "txHash": "…", "vout": 1, "memo": null }] }
{ "outputs": [{ "address": "bc1q…", "amount": 250000, "isChange": false }], "fee": 1200 }

Request a signature

POST /transactions/{transactionId}/signatures — read-write. Opens a signature request for one key of the wallet.

Body fieldMeaning
keyIdThe key that will sign. Use the id of a Key from the wallet’s keyset (GET /wallets/{id} with the keysets domain, or GET /keysets/{id}).

Returns 201 with the new Signature. If an unsigned request for the same key already exists it is returned unchanged with 200, so the call is safe to retry.

Get signing data

GET /transactions/{transactionId}/toSign — read-write. For a BTC or TBTC transaction, everything a signer needs (the shape for ETH and TETH differs and is not covered here):

interface ToSign {
  // The transaction to sign, hex encoded
  txData: string
  // The same transaction decoded (inputs with prevout hash/index, outputs)
  tx: object
  amountCurrency: string
  // For each input, keyed "txid/vout": the coin being spent and its address
  utxoLookup: Record<
    string,
    { address: string; value: number; script: string; keyPathAddress: number; isChange: boolean }
  >
}

Sign each input of txData with the requested key: the coin’s script and value are in utxoLookup, and the input’s address path is keyPathAddress under the change (isChange) or receive chain of the key’s wallet-level xpub.

Submit signatures

PUT /signatures/{signatureId} — read-write.

Body fieldMeaning
externalSignaturesOne array per transaction input, in input order. Each holds the hex-encoded signatures produced for that input by the requested key — DER signatures without the trailing sighash byte for SegWit inputs, or the 64-byte Schnorr signature for Taproot inputs.
deviceTypeThe signing device, e.g. trezor, ledger, coldcard.
curl -X PUT "$CASA_API/signatures/$SIGNATURE_ID" \
  -H "x-api-key: $CASA_API_TOKEN" -H "content-type: application/json" \
  -d '{ "deviceType": "trezor", "externalSignatures": [["3044…"], ["3045…"]] }'

Returns the Signature with signedData set. Once enough keys have signed, the transaction’s signatures show it is ready to broadcast.

Broadcast a transaction

POST /transactions/{transactionId}/send — read-write. Assembles the collected signatures and broadcasts. Returns 201 with the Transaction, now carrying its txId.

StatusWhen
400The transaction does not have enough signatures yet (Transaction is not fully signed).
400Whitelisting is on and the destination is not a saved address (code WHITELIST_ADDRESS_DENIED).
400Bitcoin only: the node’s mempool check rejects the transaction. The body is { "error": { "code": "broadcast-error", "message": "…", "rpcRejectReason": "…" } }; rpcRejectReason is the node’s reason.
400Bitcoin only: an output is dust (Unable to broadcast. At least one of the outputs is dust.).
422Ethereum only: the wallet cannot pay for the broadcast (code insufficient_funds).
500Any other broadcast failure, including a node error after the mempool check passed. The body is { "error": "Internal server error" } with no detail, so check the transaction’s txId with Get a transaction before you retry.

Cancel a transaction

DELETE /transactions/{transactionId} — read-write. Cancels an un-broadcast transaction and releases the coins it reserved. Returns 204.

Signatures

Signature requests are shared between the two domains: a transaction signature belongs to wallets, a healthCheck signature to keysets. The token must hold the domain matching the signature’s type.

Requests are created under the resource they sign: POST /transactions/{transactionId}/signatures for a transaction (Request a signature) and POST /devices/{deviceId}/signatures for a device health check (Request a health check). Once created, every request is read, submitted, or withdrawn under /signatures/{signatureId}.

  • GET /signatures/{signatureId} — read the request. read-only.
  • PUT /signatures/{signatureId} — submit the signature (see Submit signatures and Complete a health check). read-write.
  • DELETE /signatures/{signatureId} — withdraw a request that has not been fulfilled yet. read-write. A fulfilled request cannot be deleted (400).

Keysets

keysets domain, read-only. A keyset (a “vault” in Casa’s apps) is the set of keys securing one or more wallets.

List keysets

GET /keysets — every keyset the user owns or manages. Returns Keyset[].

Get a keyset

GET /keysets/{keysetId} — one keyset with its keys and wallets. Returns Keyset.

Devices

keysets domain. Listing needs read-only; adding, changing, or health-checking devices needs read-write. Listing and adding work through the keyset (/keysets/{keysetId}/devices); everything else addresses the device directly (/devices/{deviceId}).

List devices

GET /devices — every device the user owns, active or not yet replaced. Returns Device[].

GET /keysets/{keysetId}/devices — the devices of one keyset, including inactive and replaced ones. Returns Device[]. Filter by location with ?locationType=b.

Add a device

POST /keysets/{keysetId}/devices — read-write. Registers a device in a keyset location that has no active device.

Body fieldRequiredMeaning
locationTypeyesThe keyset location to fill: b home, c office, d safe, f generic, g sixth.
deviceTypenoe.g. trezor, ledger, coldcard, keystone, passport, yubikey.
xpubnoThe device’s extended public key. Omit to create the device pending and supply it later.
labelnoA name for the device.

Returns 201 with the Device. Fails with 400 while the location still has an active device.

Complete or deactivate a device

PUT /devices/{deviceId} — read-write.

  • { "xpub": "xpub6…", "deviceType": "trezor" } completes a pending device by supplying its key.
  • { "active": false } deactivates a device so its location can take a replacement. Read the warning below before you send it.

Returns the updated Device.

Warning: deactivation cannot be undone through the API. A deactivated device stays inactive; there is no call that sets active back to true. The token’s user must own the device or hold the sign-and-create role for its location. Deactivating a device also:

  • deactivates every wallet that has a key on the device;
  • emails the keyset owner and that location’s transaction managers that the key is awaiting replacement, and sends the owner a push notification;
  • notifies the owner and recipients when the device is part of an inheritance plan.

For an Ethereum-only keyset, the call fails with 400 (code DEVICE_GROUP_DUPLICATE_SWAP_PREVENTED) while another device in the keyset is inactive or a key swap is still pending.

Delete a pending device

DELETE /devices/{deviceId} — read-write. Removes a device that never completed setup (no xpub). Active devices are deactivated with PUT, not deleted. Returns 204.

Health checks

A health check proves a device still holds its key. It works like a signature request, against a device instead of a transaction.

GET /devices/{deviceId}/signatures — read-only. The device’s signature requests; with a keysets-only token this lists health checks only.

Request a health check

POST /devices/{deviceId}/signatures — read-write, empty body. Returns 201 with a Signature of type: 'healthCheck'.

Complete a health check

PUT /signatures/{signatureId} — read-write. The message is always the health check’s id string, signed with the private key at path 0/0 under the device’s key. The signature format depends on the coin of the key Casa picked for the health check. Casa picks the device’s key in the first wallet by coinType order (BTC, ETH, ETH-C, TBTC, TETH, TETH-C), so a device with a BTC key always uses the Bitcoin format.

  • Bitcoin (BTC, TBTC): a Bitcoin signed message (the standard "Bitcoin Signed Message:\n" magic), submitted as base64.
  • Ethereum (ETH, TETH, and their contract wallets): an EIP-191 personal_sign signature from the address at that path, submitted as the 65-byte r‖s‖v hex string without the 0x prefix. For a contract wallet, Casa also checks that the signing address is a current owner of the wallet’s contract.

A Bitcoin example:

curl -X PUT "$CASA_API/signatures/$SIGNATURE_ID" \
  -H "x-api-key: $CASA_API_TOKEN" -H "content-type: application/json" \
  -d '{ "externalSignatures": ["H8Zk…base64…"] }'

Casa verifies the signature against each key in the keyset; if none matches it fails with 404 Health check failed. This device is not part of your wallet. On success the device’s lastUsedAt is updated and the Key returns to status: 'active'.

Interfaces

The shapes below are what the API returns today. Fields marked keysets domain are omitted from responses to tokens that do not hold the keysets domain.

Wallet

Returned by GET /wallets (one per wallet) and GET /wallets/{id}.

interface Wallet {
  // The wallet's unique ID
  id: string
  // The Casa user who owns the wallet
  userId: string
  // An arbitrary string to name the wallet
  label: string
  // The type of coin that is held by the wallet
  coinType: 'BTC' | 'TBTC' | 'ETH' | 'TETH'
  // The keyset that secures the wallet, and its type
  keysetId: string
  keysetType: 'phone' | 'basic' | 'advanced'
  // The current deposit address of the wallet
  currentAddress: string
  // Whether a signature request is currently pending on this wallet
  hasPendingSignature: boolean
  status: 'healthy' | 'rotation_transaction_required' | 'pending' | 'failed' | 'inactive'
  balance: Balance
  createdAt: string // ISO 8601

  // GET /wallets/{id} only, keysets domain: the full keyset that secures the wallet
  keyset?: Keyset | null
}

interface Balance {
  // Confirmed balance in the coin's base unit (satoshis for BTC), as a decimal string
  amount: string
  // Balance still awaiting confirmation, as a decimal string
  pending: string
  // Fiat conversions keyed by currency code, present when convertToCurrencies is requested
  fiat?: Record<string, string>
}

Transaction

Returned by the transaction endpoints. signatures includes one entry per signature request made against the transaction.

interface Transaction {
  id: string
  walletAccountId: string
  // The Casa user who created the transaction
  initiatingUserId: string
  toAddress: string
  // Amount sent, in the coin's base unit (satoshis for BTC)
  total: number
  // Fee paid, in the coin's base unit
  fee: number
  // Fee rate applied, in satoshis per kilobyte
  feeRate: number
  // The unsigned (or partially signed) transaction, hex encoded
  txData: string
  // The blockchain transaction id; null until the transaction is broadcast
  txId: string | null
  // Confirmation depth once broadcast; null while unconfirmed
  blockDepth: number | null
  memo: string | null
  amountCurrency: string
  signatures: Signature[]
}

Signature

A signature request against one key of a wallet (type: 'transaction') or a device health check (type: 'healthCheck').

interface Signature {
  id: string
  type: 'transaction' | 'healthCheck'
  // The key this request is for
  keyId: string
  // The user who will sign
  signingUserId: string
  // The signer's device type, e.g. 'trezor', 'ledger', 'coldcard', 'yubikey', 'iphone', 'android', 'passkey'
  deviceType: string | null
  // The completed signature; null until the request is fulfilled
  signedData: string | null
  // For type 'transaction': the transaction being signed
  transactionId: string | null
  // A minimal description of the key; xpub and derivation fields are keysets domain
  key: {
    id: string
    deviceId: string
    walletAccountId: string
    locationType: string
    device?: { id: string; deviceType: string; locationType: string; active: boolean }
    xpub?: string
  }
}

TransactionSummary

Returned by GET /transactions. A summary is a display-ready view of one transaction; Transaction is the raw record behind it.

interface TransactionSummary {
  // The transaction's id; use it with GET /transactions/{id} and the signing endpoints
  id: string
  // The keyset that holds the wallet, and the wallet that sent or received
  keysetId: string
  walletId: string
  createdAt: string // ISO 8601
  // inProgress: gathering signatures. signed: threshold reached, ready to broadcast.
  // unconfirmed: broadcast, not yet in a block. confirmed: in a block.
  // unconfirmed and confirmed appear only with scope=all.
  status: 'inProgress' | 'signed' | 'unconfirmed' | 'confirmed'
  // receive appears only with scope=all
  transactionType: 'send' | 'sendSelf' | 'keyRotation' | 'receive'
  direction: 'sent' | 'received'
  // Block depth of a broadcast transaction; null when unknown or not broadcast
  confirmations: number | null
  // Source label, e.g. "My Retirement Vault • 5-Key, Primary Account"
  walletDisplayLabel: string
  // The blockchain transaction id; null until broadcast
  txId: string | null
  // How many signatures the keyset requires, and the state of each signing location
  requiredSignatures: number
  signatures: SignatureSummary[]
  // Casa recovery involvement, when a recovery key must sign
  recoveryRequestType: 'questions' | 'photo' | 'inheritance' | 'teamSigningPhotos' | null
  recoveryRequestStatus: 'completed' | 'pending' | 'available' | 'notAvailable'
  destinationAddress: string
  // Saved-address label, or the destination keyset's label for key rotations
  destinationAddressLabel: string | null
  // Amount in base units (satoshis, wei, or token units) as a decimal string
  amountTotal: string
  // The coin or token symbol: BTC, TBTC, ETH, TETH, USDC, USDT, stETH
  amountTotalUnit: string
  // Formatted amount and fee, e.g. "0.0105 BTC", "3000 sats"
  amountTotalDisplay: string
  feeAmountDisplay: string | null
  // Formatted fee rate, e.g. "2000 sats/kb"; always null for Ethereum
  feeRateDisplay: string | null
  memo: string | null
  // Deep link that opens this transaction in the Casa app; the URL scheme is environment-specific
  appLinkUrl: string
  network: 'BTC' | 'ETH'
}

// One entry per signing location of the keyset. Once the threshold is reached,
// or the transaction is broadcast, only completed entries are returned.
// Received deposits have no entries.
interface SignatureSummary {
  // The signature request id; null when no signature has been started for this key
  id: string | null
  // The key for this location; pass it as keyId to POST /transactions/{id}/signatures
  keyId: string
  // Location code: a = mobile, b = home, c = office, d = safe, e = casa recovery, ...
  keyLocationType: string
  // e.g. "Home Key", "Office Key", "Casa Recovery Key"
  keyDisplayLabel: string
  // mobile keys sign in the Casa app, recovery keys are signed by Casa, hardware keys can sign on the web
  keyType: 'mobile' | 'recovery' | 'hardware'
  // The device behind the key: iphone, android, trezor, ledger, ...; null when unknown
  keyDeviceType: string | null
  status: 'completed' | 'requested' | 'available' | 'notAvailable'
}

Keyset

A keyset is the set of keys that secures a group of wallets. Casa’s apps call these “vaults”.

interface Keyset {
  id: string
  // The keyset's display title, e.g. "Key Shield"
  title: string
  label: string
  keysetType: 'phone' | 'basic' | 'advanced'
  keysetStatus: 'active' | 'needsReplacement' | 'recoveryInProgress' | 'archived' | 'notInitialized'
  // How many keys must sign a transaction
  signatureThreshold: number
  supportedNetworks: string[]
  recoveryType: 'photo' | 'questions' | null
  keys: Key[]
  // The wallets this keyset secures
  wallets: { id: string; label: string; coinType: string; balance: Balance }[] | null
  // Sum of the balances of the wallets above
  collectionBalance: Balance | null
  createdAt: string
  lastUsedAt: string
}

interface Key {
  id: string
  // The device (or, for a Casa recovery key, the offline key) that holds this key
  groupingId: string
  status: 'active' | 'needsHealthCheck' | 'notInitialized' | 'needsReplacement'
  deviceType: 'iphone' | 'android' | 'ledger' | 'trezor' | 'coldcard' | 'yubikey' | 'passkey' | 'casa'
  displayLabel: 'mobile' | 'home' | 'office' | 'safe' | 'casa recovery' | 'sixth' | 'hardware'
  // The device's account-level extended public key and its derivation path
  parentXpub?: string
  parentDerivationPath?: string
  // The key derived for this keyset's wallet
  childXpub?: string
  childDerivationPath?: string
  owners: { userId: string; displayLabel: string }[]
  createdAt: string
  lastUsedAt: string
}

Device

A physical or software signing device registered to a keyset location. Secret and integrity material is never returned.

interface Device {
  id: string
  label: string | null
  deviceType: string | null
  // The keyset location this device occupies: a=mobile, b=home, c=office, d=safe, e=casa, f=generic, g=sixth
  locationType: 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g'
  // False once the device has been deactivated
  active: boolean
  // Set when a replacement for this device has been created
  replacementDeviceId: string | null
  lastUsedAt: string | null
  // The device's extended public key; keysets domain, absent until setup completes
  xpub?: string
}