{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/akahu/main/json-schema/akahu-status-schema.json",
  "title": "Status",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/akahu-one-off-rest-api-openapi.yml#/components/schemas/Status",
  "type": "object",
  "required": [
    "connection",
    "status",
    "available_results",
    "expires_at",
    "created_at"
  ],
  "properties": {
    "connection": {
      "type": "object",
      "description": "Information about institution that the user connected their accounts from (eg. ANZ bank).",
      "required": [
        "_id",
        "name",
        "logo"
      ],
      "properties": {
        "_id": {
          "type": "string",
          "description": "A unique identifier for this institution, prefixed by `conn_`."
        },
        "name": {
          "type": "string",
          "description": "The name of the institution."
        },
        "logo": {
          "type": "string",
          "format": "uri",
          "description": "A URL pointing to a .png image of the institution's logo."
        }
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "PROCESSING",
        "COMPLETE",
        "ERROR"
      ],
      "description": "The status of the one-off data retrieval process:\n\n- `PROCESSING` → Akahu is still processing the result. Expect the status to shortly progress to either `COMPLETE` or `ERROR`.\n- `COMPLETE` → Akahu has finished processing the result and it is available for your application to retrieve.\n- `ERROR` → There was an error that meant the result could not be processed. See `status_reason` for more detail."
    },
    "status_reason": {
      "type": "string",
      "enum": [
        "TIMEOUT",
        "PROCESSING_ERROR"
      ]
    },
    "available_results": {
      "type": "object",
      "description": "A collection of boolean flags to indicate which results are available for fetching.\n\nWhile the result has a status of `PROCESSING`, these flags will be updated as data becomes available. This allows your application to fetch data and provide progress feedback to the user as quickly as possible.\n\nIn general, `accounts`, `parties`, and `pdfs` results will be available almost immediately. Transactions undergo additional asynchronous processing, so may take a few seconds to become available.\n\nOnce the result is assigned the `COMPLETE` state, these flags will no longer change.",
      "properties": {
        "accounts": {
          "type": "boolean",
          "description": "Account data is available to be fetched"
        },
        "parties": {
          "type": "boolean",
          "description": "Party data is available to be fetched"
        },
        "transactions": {
          "type": "boolean",
          "description": "Transaction data is available to be fetched"
        },
        "pdfs": {
          "type": "boolean",
          "description": "PDF files are available to be fetched"
        }
      }
    },
    "available_accounts_count": {
      "type": "integer",
      "deprecated": true,
      "description": "**Deprecated**\n\nThis field is not available for official open banking connections.\n\nThe total number of accounts that were available for the user to share with your application. They may have chosen a subset of these to share, which will be available from the [`GET /accounts/{code}`](/reference/get_accounts-code) endpoint."
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "When this result expires. After expiry it will no longer be accessible. Formatted as an ISO 8601 timestamp."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Formatted as an ISO 8601 timestamp."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Formatted as an ISO 8601 timestamp."
    }
  }
}