{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/akahu/main/json-schema/akahu-pending-transaction-schema.json",
  "title": "PendingTransaction",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/akahu-enduring-api-openapi.yml#/components/schemas/PendingTransaction",
  "type": "object",
  "properties": {
    "_account": {
      "type": "string",
      "description": "The Akahu Account ID that this transaction belongs to"
    },
    "_connection": {
      "type": "string",
      "description": "The Akahu Connection ID that this transaction belongs to"
    },
    "_user": {
      "type": "string",
      "description": "The Akahu User ID that this transaction belongs to"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "The ISO 8601 timestamp of when this transaction was last updated by Akahu"
    },
    "date": {
      "type": "string",
      "format": "date-time",
      "description": "The ISO 8601 timestamp for the transaction from the bank."
    },
    "description": {
      "type": "string",
      "description": "The raw transaction description, essentially what you see on a bank statement"
    },
    "amount": {
      "type": "number",
      "description": "How much money this transaction was for"
    },
    "type": {
      "$ref": "#/$defs/TransactionType"
    },
    "meta": {
      "type": "object",
      "description": "Additional metadata we manage to retrieve for the transaction. Only present when you have permission to view enriched transactions. All fields are optional and provided on a \"best-effort\" basis.",
      "properties": {
        "particulars": {
          "type": "string",
          "description": "The particulars field set on this transaction."
        },
        "code": {
          "type": "string",
          "description": "The code field set on this transaction."
        },
        "reference": {
          "type": "string",
          "description": "The reference field set on this transaction."
        },
        "other_account": {
          "type": "string",
          "description": "The formatted NZ bank account number of the other party to this transaction."
        },
        "conversion": {
          "type": "object",
          "description": "If this transaction was made in another currency, details about the currency conversion.",
          "properties": {
            "amount": {
              "type": "number",
              "description": "The amount transacted in the foreign currency"
            },
            "currency": {
              "type": "string",
              "description": "The (3 letter ISO 4217 currency code)[https://www.xe.com/iso4217.php] that was used for this transaction."
            },
            "rate": {
              "type": "number",
              "description": "The foreign currency conversion rate applied to this transaction."
            }
          }
        },
        "card_suffix": {
          "type": "string",
          "description": "If this transaction was made with a credit or debit card, the last four digits of the card number."
        }
      }
    }
  },
  "$defs": {
    "TransactionType": {
      "type": "string",
      "enum": [
        "CREDIT",
        "DEBIT",
        "PAYMENT",
        "TRANSFER",
        "STANDING ORDER",
        "EFTPOS",
        "INTEREST",
        "FEE",
        "TAX",
        "CREDIT CARD",
        "DIRECT CREDIT",
        "DIRECT DEBIT",
        "ATM",
        "LOAN"
      ],
      "description": "Type of the transaction:\n\n  - `CREDIT` → Money has entered the account.\n\n  - `DEBIT` → Money has left the account.\n\n  - `PAYMENT` → Payment to an external account.\n\n  - `TRANSFER` → Transfer between accounts that are associated with the same credentials.\n\n  - `STANDING ORDER` → Automatic payment.\n\n  - `EFTPOS` → Payment made via an EFTPOS system.\n\n  - `INTEREST` → An interest payment.\n\n  - `FEE` → Fee payment to the account provider.\n\n  - `TAX` → Tax payment.\n\n  - `CREDIT CARD` → Credit card payment.\n\n  - `DIRECT DEBIT` → Direct debit payment.\n\n  - `DIRECT CREDIT` → Direct credit (someone paying into the account).\n\n  - `ATM` → ATM deposit or withdrawal.\n\n  - `LOAN` → Loan payment."
    }
  }
}