Consents API

The Consents API allows you to create and manage customer consent requests. Consents are required before accessing any customer data or initiating payments.

Overview

Open Banking requires explicit customer consent for all data access and payment operations. The consent lifecycle involves:

  1. 1
    Create Consent

    TPP creates a consent request specifying required permissions

  2. 2
    Customer Authorization

    Customer is redirected to authorize the consent

  3. 3
    Use Consent

    Pass consent ID in X-Consent-ID header for API requests

  4. 4
    Manage Lifecycle

    Monitor expiry, handle revocation

Consent Types

There are four types of consents, each for different use cases:

TypeCodePurposeMax Duration
Account Accessaccount-accessRead account details, balances, transactions90 days
PaymentpaymentInitiate a single paymentSingle use
Funds Confirmationfunds-confirmationCheck if funds are available90 days
Enduring Paymentenduring-paymentMultiple payments to fixed beneficiary (NZ)As specified

Create Consent

Create a new consent request. The consent starts in awaiting_authorization status until the customer authorizes it.

Account Access Consent

POST/consents

Create an account access consent for reading account data.

Request

{
  "consent_type": "account-access",
  "permissions": [
    "ReadAccounts",
    "ReadBalances",
    "ReadTransactions"
  ],
  "expiration_date": "2024-03-15T00:00:00Z",
  "transaction_from_date": "2023-01-01T00:00:00Z",
  "transaction_to_date": "2024-12-31T23:59:59Z"
}

Response

{
  "consent_id": "consent_ais_abc123",
  "consent_type": "account-access",
  "status": "awaiting_authorization",
  "permissions": [
    "ReadAccounts",
    "ReadBalances",
    "ReadTransactions"
  ],
  "expiration_date": "2024-03-15T00:00:00Z",
  "transaction_from_date": "2023-01-01T00:00:00Z",
  "transaction_to_date": "2024-12-31T23:59:59Z",
  "created_at": "2024-01-15T10:30:00Z",
  "authorization_url": "https://api.hamsterbank.ai/oauth/authorize?consent_id=consent_ais_abc123&..."
}

Payment Consent

POST/consents

Create a payment consent for initiating a single payment.

Request

{
  "consent_type": "payment",
  "payment_details": {
    "instructed_amount": {
      "amount": "100.00",
      "currency": "GBP"
    },
    "creditor_account": {
      "scheme": "SortCodeAccountNumber",
      "id": "123456-87654321",
      "name": "Jane Smith"
    },
    "remittance_information": {
      "reference": "Invoice-123"
    }
  }
}

Response

{
  "consent_id": "consent_pis_xyz789",
  "consent_type": "payment",
  "status": "awaiting_authorization",
  "payment_details": {
    "instructed_amount": {
      "amount": "100.00",
      "currency": "GBP"
    },
    "creditor_account": {
      "scheme": "SortCodeAccountNumber",
      "id": "123456-87654321",
      "name": "Jane Smith"
    }
  },
  "created_at": "2024-01-15T10:30:00Z",
  "expiration_date": "2024-01-16T10:30:00Z",
  "authorization_url": "https://api.hamsterbank.ai/oauth/authorize?consent_id=consent_pis_xyz789&..."
}

Funds Confirmation Consent

POST/consents

Create a consent for checking funds availability.

Request

{
  "consent_type": "funds-confirmation",
  "permissions": ["FundsConfirmation"],
  "expiration_date": "2024-03-15T00:00:00Z"
}

Response

{
  "consent_id": "consent_cof_def456",
  "consent_type": "funds-confirmation",
  "status": "awaiting_authorization",
  "permissions": ["FundsConfirmation"],
  "created_at": "2024-01-15T10:30:00Z",
  "expiration_date": "2024-03-15T00:00:00Z",
  "authorization_url": "https://api.hamsterbank.ai/oauth/authorize?consent_id=consent_cof_def456&..."
}

Get Consent

Retrieve the current status and details of a consent.

GET/consents/{consentId}

Get consent details by ID.

Request

GET /consents/consent_ais_abc123
Authorization: Bearer {access_token}

Response

{
  "consent_id": "consent_ais_abc123",
  "consent_type": "account-access",
  "status": "authorized",
  "tpp_client_id": "tpp_12345",
  "customer_id": "cust_67890",
  "permissions": [
    "ReadAccounts",
    "ReadBalances",
    "ReadTransactions"
  ],
  "account_ids": [
    "acc_111",
    "acc_222"
  ],
  "expiration_date": "2024-03-15T00:00:00Z",
  "transaction_from_date": "2023-01-01T00:00:00Z",
  "transaction_to_date": "2024-12-31T23:59:59Z",
  "created_at": "2024-01-15T10:30:00Z",
  "authorized_at": "2024-01-15T10:35:00Z"
}

Delete Consent

Revoke a consent. This immediately invalidates the consent and any tokens associated with it.

DELETE/consents/{consentId}

Revoke a consent.

Request

DELETE /consents/consent_ais_abc123
Authorization: Bearer {access_token}

Response

HTTP/1.1 204 No Content

Consent Revocation

Customers can also revoke consents directly through their banking app or online banking. Your application should handle 403 errors gracefully in case a consent has been revoked.

Consent Status

Consents transition through the following statuses:

StatusDescriptionUsable
awaiting_authorizationConsent created, waiting for customer approvalNo
authorizedCustomer has approved the consentYes
rejectedCustomer declined the consentNo
revokedConsent revoked by customer or TPPNo
expiredConsent has passed its expiration dateNo
consumedSingle-use consent has been used (payment consents)No

Permissions Reference

Available permissions for account-access consents:

Account Permissions

PermissionDescriptionGrants Access To
ReadAccountsView account list and detailsList Accounts, Get Account
ReadAccountsBasicView basic account information onlyList Accounts (limited fields)
ReadAccountsDetailView full account detailsGet Account with all fields

Balance Permissions

PermissionDescriptionGrants Access To
ReadBalancesView account balancesGet Balances, Get All Balances

Transaction Permissions

PermissionDescriptionGrants Access To
ReadTransactionsView transaction historyGet Transactions, Get All Transactions
ReadTransactionsBasicView basic transaction infoTransactions without merchant details
ReadTransactionsDetailView full transaction detailsTransactions with all fields

Other Permissions

PermissionDescriptionGrants Access To
ReadStandingOrdersView standing ordersGet Standing Orders
ReadDirectDebitsView direct debit mandatesGet Direct Debits
ReadBeneficiariesView saved payeesGet Beneficiaries
ReadProductsView product informationGet Products
FundsConfirmationCheck funds availabilityConfirm Funds (CoF consents only)

Best Practices

  • Request only the permissions you need - customers are more likely to approve minimal scopes
  • Store consent IDs securely and associate them with customer sessions
  • Implement consent expiry monitoring and prompt re-authorization before expiry
  • Handle consent revocation gracefully - check for 403 errors on every API call
  • For AIS consents, cache the account list to reduce unnecessary API calls
  • Use webhooks (when available) to be notified of consent status changes

Error Responses

Common error responses for the Consents API:

400
invalid_request

Missing or invalid request parameters

400
invalid_permissions

Requested permissions not valid for consent type

401
invalid_client

Client authentication failed

403
unauthorized_client

Client not authorized for this consent type

404
consent_not_found

Consent does not exist

409
consent_already_authorized

Cannot modify an authorized consent