openapi: 3.0.0
info:
  contact:
    email: hello@biza.io
    name: Biza.io
    url: https://biza.io/
  description: >
    The Admin API gives a Data Holder access for back-office tooling with the
    intent over time to delivery everything available within HaaS Manager.
    Initially the focus is on delivering the metadata required to describe
    Grant's, particularly those pertaining to CDR Sharing Arrangements.


    The caller of this API is strictly a machine to machine client intended to
    be an internal application.


    ## Vocabulary

    **NOTE:** The authoritative definition of these terms sits within [Biza
    Guides](https://guides.biza.io/key-terms#user).


    A **Grant** is the term used by Biza to describe an established set of
    tokens  providing permissions to designated APIs and is essentially a record
    of the  permission given by the customer to use their information to execute
    actions.  Every Grant has a `grantType` that describes what type of Grant it
    is.


    Amending a Grant terminates the current consent and creates a new one. 
    **Grant history** is the event stream describing how the Grant changed. 


    A **Principal** is the core-system customer the Grant is held against - the
    grant's owner, identified by the holder's core-system customer identifier.
    In the context of the CDR this is the CDR Consumer: a Non-Individual
    (Business, Trust, Non-profit) or Individual CDR Consumer.


    A **User** is an authenticated person who can act on the Principal's behalf.
    In the context of the CDR this is someone who can authorise CDR data sharing
    for the CDR Consumer: the Consumer themselves, or another person named on
    the Grant, such as a joint account holder or an User.  A Grant always
    relates to both. The identifiers for these Principal and Users align to the
    `principalId` and `userId` utilised by the Data Adapter for the specified
    `realmName`.


    ## API Scope

    This version represents every Grant as `CDR_SHARING_ARRANGEMENT_V1` which 
    defines a CDR Consumer's Sharing Arrangement (`GrantV1.grantType`). 
    Machine-to-machine Grants and consumer dashboard logins are a different
    kind  of authorisation artifact and are not members of this collection, so a
    total never counts a Grant you cannot retrieve, and naming one directly
    returns **404**.

    #### CDR Data Sharing Arrangement

    In addition to the reading of CDR Arrangement details this API supports
    issuing  a single state change, revoking a grant. Amending a CDR Sharing
    Arrangement  otherwise requires the CDR Consumer to reauthorise the data
    disclosure, which  happens outside this API entirely. 


    Other systems can still change a Grant available here, for instance, a 
    joint-account owner withdrawing their account. These events create a
    `CDR_SHARING_ARRANGEMENT_V1_AMENDED` history entry carrying its
    `amendmentCause`.


    ## Versioning

    Every operation is versioned independently of every other, in both request
    and response, so a new version of one endpoint never forces a client to
    uplift the rest. Send the desired response version in `x-haas-v`; the served
    version is echoed in the `x-haas-v` response header and is also carried in
    the payload itself as the `version` discriminator. Call `GET
    /{realmName}/meta/endpoints` to discover which versions this deployment
    supports for each operation - the same path, `operationId` and
    `x-haas-max-v` request header as the HaaS Data Adapter specification's own
    endpoint discovery.



    ## Responses this document does not describe

    Not every response you receive on this host comes from this API. A proxy or
    load balancer sits in front of it and generates its own responses - on an
    outage, a route miss, a rate limit, or a TLS or protocol fault - and those
    are deliberately **not** described here, because this document describes
    what the application generates.

    While we try to document as many of the responses as possible it is entirely
    predictable that some errors may occur that cannot be described.
  license:
    name: Commercial
    url: https://biza.io/
  title: Admin API
  version: 0.0.1-alpha.18
servers:
  - url: https://admin.data.holder/dio-au/v1
security:
  - AdminApiOAuth:
      - biza-au:haas:admin:read
tags:
  - name: Grants
    description: Listing, retrieving and revoking any Grant in the realm.
  - name: Discovery
    description: What this deployment supports.
paths:
  /{realmName}/meta/endpoints:
    get:
      description: >-
        Report what this deployment supports for each operation, and which
        request and response versions it will accept and serve. Because every
        operation is versioned independently, this is how a client discovers
        whether an uplift it wants is available without attempting the call.


        This follows the HaaS Data Adapter specification's `/meta/endpoints`
        shape and naming - the same `operationId`, the same path, and the same
        `x-haas-max-v` request header - rather than this service's own
        `x-haas-v`/payload-discriminator pattern. The two specifications now
        describe their own capabilities the same way.
      operationId: getEndpointMeta
      parameters:
        - $ref: '#/components/parameters/PathRealmName'
        - $ref: '#/components/parameters/HeaderXHaasMaxV'
        - $ref: '#/components/parameters/HeaderXFapiInteractionId'
      responses:
        '200':
          $ref: '#/components/responses/AdminApiGetEndpointMeta'
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '401':
          $ref: '#/components/responses/ErrorUnauthorised'
        '403':
          $ref: '#/components/responses/ErrorForbidden'
        '404':
          $ref: '#/components/responses/ErrorNotFound'
        '406':
          $ref: '#/components/responses/ErrorUnsupportedVersion'
      security:
        - AdminApiOAuth:
            - biza-au:haas:admin:read
      summary: Get Endpoint Meta
      tags:
        - Discovery
  /{realmName}/grant:
    get:
      description: List every Grant in the realm's consent store.
      operationId: listGrants
      parameters:
        - $ref: '#/components/parameters/PathRealmName'
        - $ref: '#/components/parameters/QueryPrincipalId'
        - $ref: '#/components/parameters/QueryUserId'
        - $ref: '#/components/parameters/QueryGrantStatus'
        - $ref: '#/components/parameters/QueryPage'
        - $ref: '#/components/parameters/QueryPageSize'
        - $ref: '#/components/parameters/HeaderXHaasV'
        - $ref: '#/components/parameters/HeaderXFapiInteractionId'
      responses:
        '200':
          $ref: '#/components/responses/ListGrants'
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '401':
          $ref: '#/components/responses/ErrorUnauthorised'
        '403':
          $ref: '#/components/responses/ErrorForbidden'
        '404':
          $ref: '#/components/responses/ErrorNotFound'
        '406':
          $ref: '#/components/responses/ErrorUnsupportedVersion'
      security:
        - AdminApiOAuth:
            - biza-au:haas:admin:read
      summary: List Grants
      tags:
        - Grants
  /{realmName}/grant/{grantId}:
    get:
      description: >-
        Resolve a Grant identifier to the Grant it names, anywhere in the realm.


        A Grant identifier is unique within the realm, so no User or Principal
        is needed to address one. Use this when you hold an identifier and
        nothing else - from a log line, a support ticket or a notification - and
        need to discover whose Grant it is, or administer it directly.
      operationId: getGrant
      parameters:
        - $ref: '#/components/parameters/PathRealmName'
        - $ref: '#/components/parameters/PathGrantId'
        - $ref: '#/components/parameters/HeaderXHaasV'
        - $ref: '#/components/parameters/HeaderXFapiInteractionId'
      responses:
        '200':
          $ref: '#/components/responses/GetGrant'
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '401':
          $ref: '#/components/responses/ErrorUnauthorised'
        '403':
          $ref: '#/components/responses/ErrorForbidden'
        '404':
          $ref: '#/components/responses/ErrorNotFound'
        '406':
          $ref: '#/components/responses/ErrorUnsupportedVersion'
      security:
        - AdminApiOAuth:
            - biza-au:haas:admin:read
      summary: Get Grant
      tags:
        - Grants
  /{realmName}/grant/{grantId}/revoke:
    post:
      description: >-
        Revoke a Grant by identifier alone.

        Unlike the Consent API's user-grounded revoke, it does not require the
        name of the User who created the Grant because this endpoint is intended
        for internal administrative tooling rather than a consumer facing
        dashboards.


        The request payload identifies the initiator of the call: `SYSTEM`, for
        revocations triggered by automated actions, or `USER`, for
        identification of Holder personnel who trigger a revocation.

        The operation acts only on a Grant whose reported status is `ACTIVE`.
        For any other status it still returns **200** with the Grant unchanged,
        and writes no history entry. 


        #### CDR Arrangement V1

        In the CDR Arrangement scenario, the Data Recipient is notified using
        the  prescribed method. In addition a
        `CDR_SHARING_ARRANGEMENT_V1_REVOKED` history entry  is written with a
        `revocationCause` of `ADMIN`.
      operationId: revokeGrant
      parameters:
        - $ref: '#/components/parameters/PathRealmName'
        - $ref: '#/components/parameters/PathGrantId'
        - $ref: '#/components/parameters/HeaderXHaasV'
        - $ref: '#/components/parameters/HeaderXFapiInteractionId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RequestRevokeGrant'
      responses:
        '200':
          $ref: '#/components/responses/GetGrant'
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '401':
          $ref: '#/components/responses/ErrorUnauthorised'
        '403':
          $ref: '#/components/responses/ErrorForbidden'
        '404':
          $ref: '#/components/responses/ErrorNotFound'
        '406':
          $ref: '#/components/responses/ErrorUnsupportedVersion'
      security:
        - AdminApiOAuth:
            - biza-au:haas:admin:revoke
      summary: Revoke Grant
      tags:
        - Grants
  /{realmName}/grant/{grantId}/history:
    get:
      description: >-
        Read a grant's history based purely on the Grant Identifier.


        History is the **consent lifecycle**: how the Grant was created, every
        amendment to it, changes to its composition and its revocation. It does 
        not cover token or authorisation-code issuance; that is security
        telemetry  rather than consent history.


        Entries are returned oldest first, so replaying them in order
        reconstructs the grant's state. This endpoint is ungrounded: every entry
        on the Grant is returned and no entry is redacted, whichever User
        initiated it.
      operationId: getGrantHistory
      parameters:
        - $ref: '#/components/parameters/PathRealmName'
        - $ref: '#/components/parameters/PathGrantId'
        - $ref: '#/components/parameters/QueryPage'
        - $ref: '#/components/parameters/QueryPageSize'
        - $ref: '#/components/parameters/HeaderXHaasV'
        - $ref: '#/components/parameters/HeaderXFapiInteractionId'
      responses:
        '200':
          $ref: '#/components/responses/ListGrantHistory'
        '400':
          $ref: '#/components/responses/ErrorBadRequest'
        '401':
          $ref: '#/components/responses/ErrorUnauthorised'
        '403':
          $ref: '#/components/responses/ErrorForbidden'
        '404':
          $ref: '#/components/responses/ErrorNotFound'
        '406':
          $ref: '#/components/responses/ErrorUnsupportedVersion'
      security:
        - AdminApiOAuth:
            - biza-au:haas:admin:read
      summary: Get Grant History
      tags:
        - Grants
components:
  securitySchemes:
    AdminApiOAuth:
      type: oauth2
      description: >-
        OAuth 2.0 bearer token issued by Biza ID. The token is opaque to the
        caller: this specification states only which scopes an operation
        requires, never what the token contains. Tenancy is enforced by the
        deployment, not by the caller - a token is bound to the audience of the
        space it was issued for.


        Every operation on this surface is ungrounded: there is no narrower,
        grounded tier to accept as a superset the way `consent-api` does. A
        credential holding either scope reaches every Grant in the realm it is
        entitled to. Your realm entitlement is what separates you from other
        data holders - these scopes are a blast-radius control between your own
        tooling, not a confidentiality boundary.
      flows:
        clientCredentials:
          tokenUrl: https://id.biza.io/oauth/token
          scopes:
            biza-au:haas:admin:read: >-
              Read endpoint metadata, list every Grant in the realm, resolve a
              Grant identifier, and read any grant's history.
            biza-au:haas:admin:revoke: Revoke any Grant in the realm by identifier alone.
  parameters:
    PathRealmName:
      description: >-
        Realm name to bound the request to. A client is entitled to the realms
        of the space its token was issued for.
      in: path
      name: realmName
      required: true
      schema:
        type: string
        example: sandbox-holder
    HeaderXHaasMaxV:
      in: header
      name: x-haas-max-v
      required: true
      description: >-
        The highest response version your client understands. 

        **This is a ceiling, not an exact match** and is a bound rather than a
        single value.

        This deployment serves the highest version it supports that is at or
        below the ceiling provided, and never a version above it. If it supports
        no version at or below the provided ceiling the response is **406**
        `Header/UnsupportedVersion`.
      schema:
        type: string
        example: V1
    HeaderXFapiInteractionId:
      description: >-
        Caller-supplied correlation identifier, echoed on the response and
        recorded for the interaction.
      in: header
      name: x-fapi-interaction-id
      required: false
      schema:
        type: string
        format: uuid
        example: 6ba7b814-9dad-11d1-80b4-00c04fd430c8
    QueryPrincipalId:
      description: >-
        Narrow the visible Grants to those held against this Principal in
        addition to the path parameters specified.
      in: query
      name: principalId
      required: false
      schema:
        type: string
        example: 08c31a2a9016d6c517a95562228a37c0
    QueryUserId:
      description: >-
        Narrow the visible Grants to those held against this User in addition to
        the path parameters specified.
      in: query
      name: userId
      required: false
      schema:
        type: string
        example: 21a5472a3fd1467a901f8c86221c7ad9
    QueryGrantStatus:
      description: |-

        Restrict results to Grants with the input status. 

        Supports multiple types using exploded `form` style.  

        If not present will return Grants in all statuses.
      explode: true
      in: query
      name: status
      required: false
      style: form
      schema:
        type: array
        items:
          $ref: '#/components/schemas/EnumGrantStatusV1'
    QueryPage:
      description: Page of results to request, 1-based.
      in: query
      name: page
      required: false
      schema:
        type: integer
        format: int32
        default: 1
        minimum: 1
        example: 1
    QueryPageSize:
      description: Number of records to return per page.
      in: query
      name: page-size
      required: false
      schema:
        type: integer
        format: int32
        default: 25
        minimum: 1
        maximum: 1000
        example: 25
    HeaderXHaasV:
      description: >-
        The response version requested for this operation. The version actually
        served is returned in the `x-haas-v` response header and in the
        payload's `version` property.
      in: header
      name: x-haas-v
      required: true
      schema:
        type: string
        example: V1
    PathGrantId:
      description: >-
        The identifier of the grant. Unique within the realm, so a Grant is
        addressable without naming its User or Principal.
      in: path
      name: grantId
      required: true
      schema:
        type: string
        format: uuid
        example: dd488573-510f-42c1-82b7-e6ecaa735545
  headers:
    ResponseXHaasV:
      description: >-
        The version actually served for this operation. Always present, and
        always equal to the `version` property of the payload.
      required: true
      schema:
        type: string
        example: V1
    XFapiInteractionId:
      description: >-
        Echo of the request's `x-fapi-interaction-id` when one was supplied
        **and valid**, otherwise a server-generated correlation identifier. 
        Always present  on every response, including a 401, to be used in
        tracking for support requests. 
      required: true
      schema:
        type: string
        format: uuid
        example: 6ba7b814-9dad-11d1-80b4-00c04fd430c8
    ResponseWwwAuthenticate:
      description: Authentication required challenge.
      required: true
      schema:
        type: string
        example: Bearer error="insufficient_scope", scope="biza-au:haas:consent:revoke"
  schemas:
    EnumResponseListGrantsVersion:
      description: Supported Response Version
      enum:
        - V1
      type: string
      example: V1
    EndpointMetaListGrantsV1:
      type: object
      description: >-
        Whether this operation is available here, and which versions of it are
        understood. Follows the HaaS Data Adapter specification's convention of
        a dedicated leaf schema per operation, rather than one generic shape
        reused across every operation - the two conventions should converge the
        day they are the same operation, and nothing else should look alike by
        accident.
      properties:
        flags:
          type: array
          description: >-
            Reserved for future per-operation feature flags. Empty in V1: this
            operation has no optional behaviour to advertise yet.
          default: []
          maxItems: 0
          items:
            type: string
        responseVersions:
          type: array
          description: >-
            Response versions that may be asked using the `x-haas-v` header,
            lowest first.
          default:
            - V1
          items:
            $ref: '#/components/schemas/EnumResponseListGrantsVersion'
      required:
        - flags
        - responseVersions
      example:
        flags: []
        responseVersions:
          - V1
    EnumResponseGetGrantVersion:
      description: Supported Response Version
      enum:
        - V1
      type: string
      example: V1
    EndpointMetaGetGrantV1:
      type: object
      description: >-
        Whether this operation is available here, and which versions of it are
        understood. Follows the HaaS Data Adapter specification's convention of
        a dedicated leaf schema per operation, rather than one generic shape
        reused across every operation - the two conventions should converge the
        day they are the same operation, and nothing else should look alike by
        accident.
      properties:
        flags:
          type: array
          description: >-
            Reserved for future per-operation feature flags. Empty in V1: this
            operation has no optional behaviour to advertise yet.
          default: []
          maxItems: 0
          items:
            type: string
        responseVersions:
          type: array
          description: >-
            Response versions that may be asked using the `x-haas-v` header,
            lowest first.
          default:
            - V1
          items:
            $ref: '#/components/schemas/EnumResponseGetGrantVersion'
      required:
        - flags
        - responseVersions
      example:
        flags: []
        responseVersions:
          - V1
    EnumResponseGetGrantHistoryVersion:
      description: Supported Response Version
      enum:
        - V1
      type: string
      example: V1
    EndpointMetaGetGrantHistoryV1:
      type: object
      description: >-
        Whether this operation is available here, and which versions of it are
        understood. Follows the HaaS Data Adapter specification's convention of
        a dedicated leaf schema per operation, rather than one generic shape
        reused across every operation - the two conventions should converge the
        day they are the same operation, and nothing else should look alike by
        accident.
      properties:
        flags:
          type: array
          description: >-
            Reserved for future per-operation feature flags. Empty in V1: this
            operation has no optional behaviour to advertise yet.
          default: []
          maxItems: 0
          items:
            type: string
        responseVersions:
          type: array
          description: >-
            Response versions that may be asked using the `x-haas-v` header,
            lowest first.
          default:
            - V1
          items:
            $ref: '#/components/schemas/EnumResponseGetGrantHistoryVersion'
      required:
        - flags
        - responseVersions
      example:
        flags: []
        responseVersions:
          - V1
    EnumRequestRevokeGrantVersion:
      description: Supported Request Version
      enum:
        - V1
      type: string
      example: V1
    EnumResponseRevokeGrantVersion:
      description: Supported Response Version
      enum:
        - V1
      type: string
      example: V1
    EndpointMetaRevokeGrantV1:
      type: object
      description: >-
        Whether this operation is available here, and which versions of it are
        understood. Follows the HaaS Data Adapter specification's convention of
        a dedicated leaf schema per operation, rather than one generic shape
        reused across every operation - the two conventions should converge the
        day they are the same operation, and nothing else should look alike by
        accident.
      properties:
        flags:
          type: array
          description: >-
            Reserved for future per-operation feature flags. Empty in V1: this
            operation has no optional behaviour to advertise yet.
          default: []
          maxItems: 0
          items:
            type: string
        requestVersions:
          type: array
          description: >-
            Request versions this operation accepts for its actor body, lowest
            first - the only operation on either service with a request body, so
            the only one where this property is present at all; every bodyless
            operation omits it rather than declaring it vacuously empty.
          default:
            - V1
          items:
            $ref: '#/components/schemas/EnumRequestRevokeGrantVersion'
        responseVersions:
          type: array
          description: >-
            Response versions that may be asked using the `x-haas-v` header,
            lowest first.
          default:
            - V1
          items:
            $ref: '#/components/schemas/EnumResponseRevokeGrantVersion'
      required:
        - flags
        - requestVersions
        - responseVersions
      example:
        flags: []
        requestVersions:
          - V1
        responseVersions:
          - V1
    EndpointMetaAdminApiV1:
      type: object
      description: >-
        What this deployment supports, per operation. Keyed by `operationId` so
        a client can look up exactly the operation it is about to call.


        The key set is fixed rather than open: every operation this version of
        the payload knows about is a required property, so you can read them
        through typed accessors. A later version of this payload may add
        operations; a client pinned to `V1` will not see them, which is correct,
        because it cannot call an operation it does not know exists.


        Each operation has its own leaf schema, named
        `EndpointMeta<Operation>V1`, matching the HaaS Data Adapter
        specification's convention - every one of them is identical in shape
        today except `revokeGrant`'s, which is the only operation on either
        service with a request body. Naming them per operation rather than
        reusing one generic shape is what lets them diverge further later the
        way the adapter's own leaves already do.


        This response is **static**. It describes the service, identically for
        every caller, and is never filtered by your credential's scopes: a
        credential scoped only to `biza-au:haas:admin:revoke` sees every read
        operation listed here too, and receives 403 on calling one. To find out
        which scope an operation wanted, read the 403's `WWW-Authenticate`
        header.
      properties:
        listGrants:
          $ref: '#/components/schemas/EndpointMetaListGrantsV1'
        getGrant:
          $ref: '#/components/schemas/EndpointMetaGetGrantV1'
        getGrantHistory:
          $ref: '#/components/schemas/EndpointMetaGetGrantHistoryV1'
        revokeGrant:
          $ref: '#/components/schemas/EndpointMetaRevokeGrantV1'
      required:
        - listGrants
        - getGrant
        - getGrantHistory
        - revokeGrant
    AdminApiResponseGetEndpointMetaV1:
      type: object
      properties:
        version:
          type: string
          description: Discriminator for the response envelope version.
          enum:
            - V1
          example: V1
        data:
          $ref: '#/components/schemas/EndpointMetaAdminApiV1'
      required:
        - version
        - data
    AdminApiResponseGetEndpointMeta:
      description: >-
        Versioned response envelope. The `version` property is the
        discriminator: a later version of this operation adds a new member to
        the `oneOf` and leaves every existing member untouched, so a client that
        does not uplift is not affected.
      oneOf:
        - $ref: '#/components/schemas/AdminApiResponseGetEndpointMetaV1'
      discriminator:
        propertyName: version
        mapping:
          V1: '#/components/schemas/AdminApiResponseGetEndpointMetaV1'
    EnumErrorCodeV1:
      type: string
      description: >

        Error Codes


        | Value | HTTP status | Meaning |

        |-------|-------------|---------|

        | `urn:dio:error:dio-all:Field/Invalid` | 400 | A query parameter was
        supplied but its value is not one the parameter accepts - an
        unrecognised `status`, for example. |

        | `urn:dio:error:dio-all:Field/InvalidPage` | 400 | `page` is not a
        positive integer. |

        | `urn:dio:error:dio-all:Field/InvalidPageSize` | 400 | `page-size` is
        outside the range this operation accepts. |

        | `urn:dio:error:dio-all:Header/Invalid` | 400 | `x-haas-v` is absent,
        or present but malformed. The header is required on every operation that
        negotiates a response version. |

        | `urn:dio:error:dio-all:GeneralError/Expected` | 400, 401, 403 | A
        general-purpose code: a 400 not covered by a more specific code above,
        or the body accompanying a 401 or 403. On a 401 or 403 the code carries
        no detail you should branch on - read the `WWW-Authenticate` header
        instead, which names the failure as `invalid_token` or
        `insufficient_scope` per RFC 6750 §3.1. |

        | `urn:dio:error:dio-all:Resource/NotFound` | 404 | No resource with
        this identifier exists in this realm. Also carried when the realm itself
        is unknown, **or** is a realm your credential is not entitled to name -
        the two responses are byte-identical, so you cannot use this API to
        discover whether a realm you cannot reach exists. |

        | `urn:dio:error:dio-all:Header/UnsupportedVersion` | 406 | The
        requested `x-haas-v` is not supported for this operation. Call
        `getEndpointMeta` to discover which versions are. |

        | `urn:dio:error:dio-all:GeneralError/Unexpected` | 500 | An unhandled
        failure on the server side. No operation declares it, because no
        operation can predict it; handle it as you would any 5xx. |


        Every code above is in the `dio-all` namespace: none is specific to the
        consent surface.


        Note that the `dio` namespace identifier in these codes is **not** the
        `dio-au` that appears in this API's URL path. The two are independent
        namespaces and are not expected to match.
      enum:
        - urn:dio:error:dio-all:Field/Invalid
        - urn:dio:error:dio-all:Field/InvalidPage
        - urn:dio:error:dio-all:Field/InvalidPageSize
        - urn:dio:error:dio-all:Header/Invalid
        - urn:dio:error:dio-all:GeneralError/Expected
        - urn:dio:error:dio-all:Resource/NotFound
        - urn:dio:error:dio-all:Header/UnsupportedVersion
        - urn:dio:error:dio-all:GeneralError/Unexpected
      example: urn:dio:error:dio-all:Resource/NotFound
      x-enum-varnames:
        - FIELD_INVALID
        - FIELD_INVALID_PAGE
        - FIELD_INVALID_PAGE_SIZE
        - HEADER_INVALID
        - GENERAL_ERROR_EXPECTED
        - RESOURCE_NOT_FOUND
        - HEADER_UNSUPPORTED_VERSION
        - GENERAL_ERROR_UNEXPECTED
    ErrorV1:
      type: object
      properties:
        code:
          allOf:
            - $ref: '#/components/schemas/EnumErrorCodeV1'
          description: The error code. A closed enum - see EnumErrorCodeV1.
        title:
          type: string
          description: A short, human-readable summary, constant per code.
          example: Resource Not Found
        detail:
          type: string
          description: >-
            Human-readable explanation specific to this occurrence - with one
            exception that is part of the security contract.


            **For `Resource/NotFound` this string is constant.** Every cause of
            a 404 produces an identical body: an unknown realm, a realm your
            credential may not name, an unknown grant, a Grant the named subject
            has no claim on, and - on the User axis - a Grant the admission rule
            withholds. Do not vary it, and do not make it more helpful for one
            cause than another. The distinction belongs in your own logs;
            varying it here rebuilds the existence oracle that answering 404
            rather than 403 exists to prevent.
          example: The requested resource was not found
        meta:
          type: object
          description: >-
            Additional error data. Carries at most the offending parameter's
            name, and nothing else.
          properties:
            parameter:
              type: string
              description: >-
                The query parameter or header whose value caused this error,
                when a single one can be named. Present on `Field/*` and
                `Header/*` codes; absent otherwise.


                Never present on `Resource/NotFound`, which carries no `meta` at
                all - naming what was not found would defeat the constancy rule
                on `detail`.
              example: page-size
      required:
        - code
        - title
        - detail
    ResponseErrorList:
      type: object
      description: >-
        Error response. Follows the Consumer Data Standards error envelope so
        that a caller already handling CDR errors does not need a second error
        parser.
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorV1'
      required:
        - errors
    EnumGrantStatusV1:
      type: string
      description: >+

        Grant Status Types


        A Grant has a particular status at any point in time.


        | Value   |
        Description                                                                                                             
        |

        |---------|--------------------------------------------------------------------------------------------------------------------------|

        | ACTIVE  | Currently active and available for data sharing provided a
        suitable token is presented and verified to utilise the Grant |

        | EXPIRED | Grant naturally expired in accordance with the agreed end
        date/time.                                                     |

        | REVOKED | Grant was actively revoked by a User action. There will be
        suitable events available in the Grant History endpoints      |

      enum:
        - ACTIVE
        - EXPIRED
        - REVOKED
      example: ACTIVE
      x-enum-varnames:
        - ACTIVE
        - EXPIRED
        - REVOKED
    EnumGrantTypeV1:
      type: string
      description: The kind of authorisation artifact this Grant is.
      enum:
        - CDR_SHARING_ARRANGEMENT_V1
      example: CDR_SHARING_ARRANGEMENT_V1
      x-enum-varnames:
        - CDR_SHARING_ARRANGEMENT_V1
    GrantBaseV1:
      type: object
      description: >-

        A **Grant** is the term used by Biza to describe an established set of
        tokens  providing permissions to designated APIs and is essentially a
        record of the  permission given by the customer to use their information
        to execute actions.  Every Grant has a `grantType` that describes what
        type of Grant it is.


        There is currently a single `grantType` of `CDR_SHARING_ARRANGEMENT_V1`
        supported. Please review the documentation for `EnumGrantTypeV1` for
        further information.
      properties:
        grantId:
          type: string
          format: uuid
          description: >-
            The grant's identifier, unique within the realm. Stable for the life
            of the grant, including after revocation.
          example: dd488573-510f-42c1-82b7-e6ecaa735545
        grantType:
          $ref: '#/components/schemas/EnumGrantTypeV1'
        userId:
          type: string
          description: >-
            The User who authorised the grant in the first place. This is the
            `userId` that must be used to revoke the Grant.
          example: 7c4a8d09ca3762af61e59520943dc264
        principalId:
          type: string
          description: The Principal the Grant is held against.
          example: 08c31a2a9016d6c517a95562228a37c0
        status:
          $ref: '#/components/schemas/EnumGrantStatusV1'
        createdTime:
          type: string
          format: date-time
          description: When the Grant was created.
          example: '2021-01-01T12:30:00Z'
        expiryTime:
          type: string
          format: date-time
          description: >-
            The expiry time of the Grant.

            **NOTE:** Do not derive `status` from this field; see `status`. A
            revoked Grant keeps the expiry it was created with, so comparing
            this to the current time reports it as expired rather than revoked.
          example: '2022-01-01T12:30:00Z'
        latestTokenTime:
          type: string
          format: date-time
          description: >-
            When an access token was most recently issued against this grant.
            Absent if none ever has been. Useful for telling a dormant Grant
            from an actively used one.
          example: '2021-06-01T09:00:00Z'
      required:
        - grantId
        - grantType
        - userId
        - principalId
        - status
        - createdTime
        - expiryTime
    CdrScopeV1:
      type: object
      description: A single CDR scope, as requested by the Data Recipient.
      properties:
        name:
          type: string
          description: The CDR scope name.
          example: bank:accounts.detail:read
        description:
          type: string
          description: Human-readable description of the scope.
          example: Account balance and details
      required:
        - name
        - description
    CdrDataClusterV1:
      type: object
      description: >-
        A customer-facing data cluster: this is one or more authorisations
        scopes presented as a single statement according to the CDR CX
        Standards.
      properties:
        name:
          type: string
          description: The name of the Data Cluster.
          example: Account balance and details
        permissionLanguage:
          type: array
          items:
            type: string
          example:
            - Name of account;
            - Type of account;
            - Account balance;
            - Account number;
            - Interest rates;
            - Fees;
            - Discounts;
            - Account terms;
            - Account mail address;
        includedScopes:
          type: array
          description: The underlying CDR scopes collapsed into this one.
          example:
            - name: bank:accounts.basic:read
              description: Account name, type and balance
            - name: bank:accounts.detail:read
              description: Account balance and details
          items:
            $ref: '#/components/schemas/CdrScopeV1'
      required:
        - name
        - permissionLanguage
        - includedScopes
    CdrAccountV1:
      type: object
      description: >-
        An account currently shared under a grant.


        It carries your own identifier for the account and nothing else. Display
        names, nicknames and masked account numbers are not published here: they
        originate in your core system, so you can resolve any of them from the
        identifier.
      properties:
        accountId:
          type: string
          description: >-
            Account Identifier used by Data Adapter and reflected unmodified
            within responses.

            This identifier **is not** pairwised as this is an internal API not
            an externally facing one.
          example: 0b6d9c6e9d4a4e23a3b0a5d6c7e8f901
      required:
        - accountId
    EnumParticipantV1:
      type: string
      description: >+

        Participant Types


        This provides an enumeration of currently supported participants.


        | Value                   |
        Description                                                     |

        |-------------------------|-----------------------------------------------------------------|

        | CDR_SOFTWARE_PRODUCT_V1 | Consumer Data Right Software Product
        belonging to a Data Recipient |

      enum:
        - CDR_SOFTWARE_PRODUCT_V1
      example: CDR_SOFTWARE_PRODUCT_V1
      x-enum-varnames:
        - CDR_SOFTWARE_PRODUCT_V1
    ParticipantBaseV1:
      type: object
      description: Participant
      properties:
        participantId:
          type: string
          description: Participant Identifier
          example: 4c90de1f-5cea-4b87-8269-5235f34c4ce1
        participantType:
          $ref: '#/components/schemas/EnumParticipantV1'
    EnumCdrSoftwareProductStatusV1:
      type: string
      description: >-
        A Software Product's status on the CDR register. A product or brand that
        is not `ACTIVE` is why a Grant may be held or revoked without the
        customer acting.
      enum:
        - ACTIVE
        - INACTIVE
        - REMOVED
      example: ACTIVE
    EnumCdrDataRecipientBrandStatusV1:
      type: string
      description: >-
        A Data Recipient brand's status on the CDR register. A brand that is not
        `ACTIVE` is why a Grant may be held or revoked without the customer
        acting.
      enum:
        - ACTIVE
        - INACTIVE
        - REMOVED
      example: ACTIVE
    EnumCdrAccreditationLevelV1:
      type: string
      description: A legal entities Accreditation Level
      enum:
        - UNRESTRICTED
        - SPONSORED
      example: UNRESTRICTED
    CdrSoftwareProductV1:
      allOf:
        - $ref: '#/components/schemas/ParticipantBaseV1'
        - type: object
          description: The Data Recipient software product that holds the grant.
          properties:
            softwareProductId:
              type: string
              description: The CDR register software product identifier.
              example: 4f012edd-05e9-4129-8682-ede321fd46eb
            name:
              type: string
              description: The name of the software product.
              example: Hardship Hub Casebook
            description:
              type: string
              description: The Software Product description provided to the Register
              example: >-
                Case management for financial counsellors: lists every creditor
                from a client's consented bank, energy and loan data, drafts
                hardship requests, tracks creditor replies against deadlines,
                and gives the client a plain-language read-only copy.
            logoUri:
              type: string
              format: uri
              description: The URI of the logo for the Software Product
              example: https://mockco.sandbox.svc.2492.au/hardship-hub/logo-1to1.png
            websiteUri:
              type: string
              format: uri
              description: Website URI of the Software Product
              example: https://mockco.sandbox.svc.2492.au/hardship-hub/
            policyUri:
              type: string
              format: uri
              description: Policy URI of the Software Product
              example: https://mockco.sandbox.svc.2492.au/hardship-hub/cdr-policy
            status:
              $ref: '#/components/schemas/EnumCdrSoftwareProductStatusV1'
            brandName:
              type: string
              example: Hardship Hub
              description: The brand name of the Data Recipient.
            brandStatus:
              $ref: '#/components/schemas/EnumCdrDataRecipientBrandStatusV1'
            legalEntityName:
              type: string
              example: Hardship Hub Pty Ltd
            accreditationNumber:
              type: string
              example: BNK00000013
              description: The accreditation number of the Data Recipient.
            accreditationLevel:
              $ref: '#/components/schemas/EnumCdrAccreditationLevelV1'
          required:
            - participantId
            - participantType
            - softwareProductId
            - name
            - description
            - logoUri
            - websiteUri
            - policyUri
            - status
            - brandName
            - brandStatus
            - legalEntityName
            - accreditationNumber
            - accreditationLevel
    ParticipantV1:
      type: object
      description: >-

        An ecosystem participant. Currently we only support a CDR Software
        Product.
      oneOf:
        - $ref: '#/components/schemas/CdrSoftwareProductV1'
      discriminator:
        propertyName: participantType
        mapping:
          CDR_SOFTWARE_PRODUCT_V1: '#/components/schemas/CdrSoftwareProductV1'
    GrantCdrSharingArrangementV1:
      allOf:
        - $ref: '#/components/schemas/GrantBaseV1'
        - type: object
          description: >-
            A CDR consumer's sharing arrangement — the only Grant kind supported
            today. `grantType: CDR_SHARING_ARRANGEMENT_V1`.
          properties:
            scopes:
              type: array
              description: The scopes as requested by the Data Recipient.
              example:
                - name: bank:accounts.basic:read
                  description: Account name, type and balance
                - name: bank:accounts.detail:read
                  description: Account numbers and features
              items:
                $ref: '#/components/schemas/CdrScopeV1'
            dataClusters:
              type: array
              description: >-
                The scopes as they were presented to the customer, collapsed to
                satisfy the CDR CX Permission Language Guidelines. These are
                what the customer actually agreed to and are what should be
                shown when explaining a Grant back to them; `scopes` is what the
                Recipient asked for.
              items:
                $ref: '#/components/schemas/CdrDataClusterV1'
            accounts:
              type: array
              description: The accounts shared under this grant.
              items:
                $ref: '#/components/schemas/CdrAccountV1'
            accountsWithheld:
              type: boolean
              description: >-
                Whether this grant covers accounts other than the named user's,
                which have been omitted from `accounts`.
              example: true
            participant:
              $ref: '#/components/schemas/ParticipantV1'
          required:
            - scopes
            - dataClusters
            - accounts
            - participant
    GrantV1:
      type: object
      description: >-

        A **Grant** is the term used by Biza to describe an established set of
        tokens  providing permissions to designated APIs and is essentially a
        record of the  permission given by the customer to use their information
        to execute actions.  Every Grant has a `grantType` that describes what
        type of Grant it is.


        There is currently a single `grantType` of `CDR_SHARING_ARRANGEMENT_V1`
        supported. Please review the documentation for `EnumGrantTypeV1` for
        further information.
      oneOf:
        - $ref: '#/components/schemas/GrantCdrSharingArrangementV1'
      discriminator:
        propertyName: grantType
        mapping:
          CDR_SHARING_ARRANGEMENT_V1: '#/components/schemas/GrantCdrSharingArrangementV1'
    MetaPaginatedV1:
      type: object
      description: >-
        Pagination metadata for an offset-paged collection.


        Every member is present on every paged response, so a paginator always
        has both a record count and a jump-to-page target.
      properties:
        page:
          type: integer
          format: int32
          description: The page returned, 1-based.
          example: 1
        pageSize:
          type: integer
          format: int32
          description: >-
            The number of records per page. Note the casing convention: query
            parameters on this API are kebab-case (`page-size`) and JSON
            properties are camelCase.
          example: 25
        totalPages:
          type: integer
          format: int32
          description: >-
            The total number of pages available, counting the same records as
            `totalRecords`.
          example: 2
        totalRecords:
          type: integer
          format: int64
          description: >-
            The total number of records **the caller can retrieve**, which is
            not always the number of rows matching the filters.


            Excluded from the count, not merely from the page: Grants of a kind
            this collection does not represent, and - on the User axis - grants
            the admission rule withholds. Paging to the end of the collection
            always yields exactly `totalRecords` records.


            This is a disclosure control, not a convenience. A total larger than
            what the caller can page through would report that something exists
            which the withholding is there to conceal, so the count must be
            taken over the same predicate that selects the page, in the query
            rather than after it.
          example: 40
      required:
        - page
        - pageSize
        - totalPages
        - totalRecords
    LinksPaginatedV1:
      type: object
      description: >-
        Navigation links for an offset-paged collection, in the Consumer Data
        Standards' five-member shape.


        **Link values are opaque: follow them, do not construct or parse them.**
        This API may move to cursor-based paging in a later version without
        changing this object, and a client that derives `next` by incrementing
        `page` will break when it does. That is why no member below is described
        in terms of `page`.
      properties:
        self:
          type: string
          format: uri
          description: This page. Always present.
          example: >-
            https://consent.data.holder/dio-au/v1/sandbox-holder/principal/08c31a2a9016d6c517a95562228a37c0/grant?page=2&page-size=25
        first:
          type: string
          format: uri
          description: >-
            The first page of the collection. Absent when this page is the
            first.
        prev:
          type: string
          format: uri
          description: The previous page. Absent when this page is the first.
        next:
          type: string
          format: uri
          description: The next page. Absent when this page is the last.
        last:
          type: string
          format: uri
          description: >-
            The last page of the collection.


            **Optional.** Treat its absence as normal rather than as an error:
            it is the one member that cannot be computed under cursor-based
            paging, so it may stop being sent in a future version.
      required:
        - self
    ResponseListGrantV1:
      type: object
      properties:
        version:
          type: string
          description: Discriminator for the response envelope version.
          enum:
            - V1
          example: V1
        data:
          type: array
          description: A list of Grant entities
          items:
            $ref: '#/components/schemas/GrantV1'
        meta:
          $ref: '#/components/schemas/MetaPaginatedV1'
        links:
          $ref: '#/components/schemas/LinksPaginatedV1'
      required:
        - version
        - data
        - meta
        - links
    ResponseListGrant:
      description: >-
        Versioned response envelope. The `version` property is the
        discriminator: a later version of this operation adds a new member to
        the `oneOf` and leaves every existing member untouched, so a client that
        does not uplift is not affected.
      oneOf:
        - $ref: '#/components/schemas/ResponseListGrantV1'
      discriminator:
        propertyName: version
        mapping:
          V1: '#/components/schemas/ResponseListGrantV1'
    ResponseGetGrantV1:
      type: object
      properties:
        version:
          type: string
          description: Discriminator for the response envelope version.
          enum:
            - V1
          example: V1
        data:
          $ref: '#/components/schemas/GrantV1'
      required:
        - version
        - data
    ResponseGetGrant:
      description: >-
        Versioned response envelope. The `version` property is the
        discriminator: a later version of this operation adds a new member to
        the `oneOf` and leaves every existing member untouched, so a client that
        does not uplift is not affected.
      oneOf:
        - $ref: '#/components/schemas/ResponseGetGrantV1'
      discriminator:
        propertyName: version
        mapping:
          V1: '#/components/schemas/ResponseGetGrantV1'
    ActorSystemV1:
      type: object
      description: An automated process caused this, not a person.
      properties:
        actorType:
          type: string
          enum:
            - SYSTEM
          example: SYSTEM
      required:
        - actorType
    ActorUserV1:
      type: object
      description: >-
        A person caused this, acting through the calling software rather than
        through a HaaS interface directly. For instance a Holder operator
        working a support case, or customer facing staff acting on a Consumer
        instruction. Specify them as the `actorUserId` using an identifier that
        can be correlated to the internal authentication systems of the Holder.
      properties:
        actorType:
          type: string
          enum:
            - USER
          example: USER
        actorUserId:
          type: string
          description: Identifier for the person who triggered this action.
          example: a3f7c1e2-9b4d-4e6a-8c2f-1d5e7a9b3c0d
      required:
        - actorType
        - actorUserId
    ActorV1:
      description: >-
        Who or what triggered this call. Written as audit metadata onto the
        resulting history entry; it is never an authorization input.
      oneOf:
        - $ref: '#/components/schemas/ActorSystemV1'
        - $ref: '#/components/schemas/ActorUserV1'
      discriminator:
        propertyName: actorType
        mapping:
          SYSTEM: '#/components/schemas/ActorSystemV1'
          USER: '#/components/schemas/ActorUserV1'
    RequestRevokeGrantV1:
      type: object
      properties:
        version:
          type: string
          description: Discriminator for the request envelope version.
          enum:
            - V1
          example: V1
        data:
          $ref: '#/components/schemas/ActorV1'
      required:
        - version
        - data
    RequestRevokeGrant:
      description: >-
        Versioned request envelope. The `version` property is the discriminator:
        a later version of this operation adds a new member to the `oneOf` and
        leaves every existing member untouched, so a client that does not uplift
        is not affected.
      oneOf:
        - $ref: '#/components/schemas/RequestRevokeGrantV1'
      discriminator:
        propertyName: version
        mapping:
          V1: '#/components/schemas/RequestRevokeGrantV1'
    EnumGrantEventTypeV1:
      type: string
      description: >

        Grant Event Types


        Named with the Grant kind as a prefix, because this enum is shared
        across every

        grant kind the API may ever carry: a future kind's lifecycle events are
        new

        members here, not a reinterpretation of these five. See `GrantV1`'s

        description for why there is only one kind today.


        | Value                                      |
        Description                                                                             
        |

        |---------------------------------------------|------------------------------------------------------------------------------------------|

        | CDR_SHARING_ARRANGEMENT_V1_CREATED     | The customer authorised the
        grant. Carries the full initial state.                       |

        | CDR_SHARING_ARRANGEMENT_V1_AMENDED     | The Grant was changed.
        Carries the delta against the previous state.                     |

        | CDR_SHARING_ARRANGEMENT_V1_REVOKED     | The Grant was revoked.
        `revocationCause` says by whom or why.                            |

        | CDR_SHARING_ARRANGEMENT_V1_HELD        | Sharing was suspended without
        the Grant being revoked. `holdCause` says why.             |

        | CDR_SHARING_ARRANGEMENT_V1_REACTIVATED | A previously held Grant
        became shareable again. `holdCause` says which hold was lifted.  |
      enum:
        - CDR_SHARING_ARRANGEMENT_V1_CREATED
        - CDR_SHARING_ARRANGEMENT_V1_AMENDED
        - CDR_SHARING_ARRANGEMENT_V1_REVOKED
        - CDR_SHARING_ARRANGEMENT_V1_HELD
        - CDR_SHARING_ARRANGEMENT_V1_REACTIVATED
      example: CDR_SHARING_ARRANGEMENT_V1_AMENDED
      x-enum-varnames:
        - CDR_SHARING_ARRANGEMENT_V1_CREATED
        - CDR_SHARING_ARRANGEMENT_V1_AMENDED
        - CDR_SHARING_ARRANGEMENT_V1_REVOKED
        - CDR_SHARING_ARRANGEMENT_V1_HELD
        - CDR_SHARING_ARRANGEMENT_V1_REACTIVATED
    GrantEventBaseV1:
      type: object
      description: >-
        The fields every history entry carries.


        There is no free-text description: every entry is typed and its payload
        structured, so there is nothing a prose blob would add that you would
        have to parse out of it.
      properties:
        grantHistoryId:
          type: string
          format: uuid
          description: The identifier of this history entry.
          example: 9824d737-5787-4ab1-97bd-0a81fa2f20c2
        occurrenceTime:
          type: string
          format: date-time
          description: When the event happened.
          example: '2021-01-01T12:30:00Z'
        grantEventType:
          $ref: '#/components/schemas/EnumGrantEventTypeV1'
      required:
        - grantHistoryId
        - occurrenceTime
        - grantEventType
    GrantEventCdrArrangementCreatedV1:
      allOf:
        - $ref: '#/components/schemas/GrantEventBaseV1'
        - type: object
          description: >-
            Grant Creation Event.

            `accounts` carries only the accounts within the currently requested
            scope.

            That matters most on this type: `CDR_SHARING_ARRANGEMENT_V1_CREATED`
            is the snapshot every later `CDR_SHARING_ARRANGEMENT_V1_AMENDED`
            delta applies to, so replaying this history reconstructs **the named
            user's view** of the Grant rather than the Grant itself.
          properties:
            accountsWithheld:
              type: boolean
              description: >-
                Whether the Grant was created covering accounts other than the
                named user's, which have been omitted from `accounts`.
              example: true
          required:
            - accountsWithheld
    EnumGrantAmendmentCauseV1:
      type: string
      description: >-
        Why a Grant was amended.


        `CONSUMER` is the consenting customer changing their own arrangement.
        `JOINT_OWNER_WITHDRAWAL` is a *different* person - another owner of an
        account the arrangement covers - withdrawing that account from it, which
        shrinks somebody else's consent without their involvement. The
        distinction matters when explaining an amendment back to a customer.


        Tolerate values added in later versions of this payload.
      enum:
        - CONSUMER
        - JOINT_OWNER_WITHDRAWAL
      example: CONSUMER
      x-enum-varnames:
        - CONSUMER
        - JOINT_OWNER_WITHDRAWAL
    GrantEventCdrArrangementAmendedV1:
      allOf:
        - $ref: '#/components/schemas/GrantEventBaseV1'
        - type: object
          description: >-
            The Grant was amended. Expressed as a delta rather than a snapshot,
            so that what the customer actually changed is legible without
            diffing two states.


            Note that `userId` is the User who made *this* amendment, which is
            not necessarily the User who created the grant: on a joint account
            another account holder may amend it. `amendmentCause` tells you
            which of the two happened - without it, a joint owner withdrawing
            their account is indistinguishable from the consumer amending their
            own consent, and a dashboard would attribute the act to the wrong
            person.


            This API never causes an amendment. It only reports that one
            happened.
          properties:
            userId:
              type: string
              description: The User who made this amendment.
              example: 7c4a8d09ca3762af61e59520943dc264
            amendmentCause:
              $ref: '#/components/schemas/EnumGrantAmendmentCauseV1'
            scopesAdded:
              type: array
              items:
                $ref: '#/components/schemas/CdrScopeV1'
            scopesRemoved:
              type: array
              items:
                $ref: '#/components/schemas/CdrScopeV1'
            cxScopesAdded:
              type: array
              items:
                $ref: '#/components/schemas/CdrDataClusterV1'
            cxScopesRemoved:
              type: array
              items:
                $ref: '#/components/schemas/CdrDataClusterV1'
            accountsAdded:
              type: array
              items:
                $ref: '#/components/schemas/CdrAccountV1'
            accountsRemoved:
              type: array
              items:
                $ref: '#/components/schemas/CdrAccountV1'
            previousExpiryTime:
              type: string
              format: date-time
              description: The grant's expiry before this amendment.
              example: '2021-06-01T12:30:00Z'
            newExpiryTime:
              type: string
              format: date-time
              description: The grant's expiry after this amendment.
              example: '2022-01-01T12:30:00Z'
          required:
            - userId
            - amendmentCause
    EnumGrantRevocationCauseV1:
      type: string
      description: >

        Who or what revoked the grant.


        | Value            |
        Description                                                                
        |

        |------------------|-----------------------------------------------------------------------------|

        | ADMIN            | Revoked by the Data Holder's own administrative
        tooling.                    |

        | DASHBOARD        | Revoked by the customer through a consumer
        dashboard or app-to-app flow.    |

        | RECIPIENT        | Revoked by the Data
        Recipient.                                              |

        | CLOSED_PRINCIPAL | Revoked because the Principal was closed in the
        Holder's core system.       |

        | REGISTER_UPDATE  | Revoked because the Software Product was revoked on
        the CDR register.        |

        | USER_INELIGIBLE  | Revoked because the User ceased to be eligible to
        share.                    |
      enum:
        - ADMIN
        - DASHBOARD
        - RECIPIENT
        - CLOSED_PRINCIPAL
        - REGISTER_UPDATE
        - USER_INELIGIBLE
      example: DASHBOARD
      x-enum-varnames:
        - ADMIN
        - DASHBOARD
        - RECIPIENT
        - CLOSED_PRINCIPAL
        - REGISTER_UPDATE
        - USER_INELIGIBLE
    GrantEventCdrArrangementRevokedV1:
      allOf:
        - $ref: '#/components/schemas/GrantEventBaseV1'
        - type: object
          description: >-
            The Grant was revoked. The Grant itself remains readable with a
            status of `REVOKED`; revocation is not deletion.
          properties:
            revocationCause:
              $ref: '#/components/schemas/EnumGrantRevocationCauseV1'
            actor:
              allOf:
                - $ref: '#/components/schemas/ActorV1'
              description: >-
                Who actually revoked the Grant.


                Present when `revocationCause` is `ADMIN` or `DASHBOARD` - the
                two causes a named Holder-side actor, rather than an external
                party or the register, is responsible for. This is deliberately
                independent of who *created* the Grant: the admission rule that
                lets a request reach either revoke operation does not require
                the actor to be the Grant's own creator (for example, a
                nominated representative revoking a fellow representative's
                arrangement), so this is the only way to tell who actually
                acted.


                Absent for `RECIPIENT` - the Data Recipient's own arrangement
                revocation call has no Holder-side actor to name - and for
                `CLOSED_PRINCIPAL`, `REGISTER_UPDATE` and `USER_INELIGIBLE`,
                none of which originate from a request at all. Also absent on
                history entries written before this field existed.
            xFapiInteractionId:
              type: string
              format: uuid
              description: >-
                The `x-fapi-interaction-id` of the request that caused this
                revocation.


                Present when `revocationCause` is `ADMIN`, `DASHBOARD` or
                `RECIPIENT` - the three causes raised by an inbound request that
                carries one: a call to this estate's own revoke operations for
                the first two, and the Data Recipient's CDR
                arrangement-revocation call for the third. Absent for
                `CLOSED_PRINCIPAL`, `REGISTER_UPDATE` and `USER_INELIGIBLE`,
                none of which originate from a request at all.
              example: 6ba7b814-9dad-11d1-80b4-00c04fd430c8
          required:
            - revocationCause
    EnumGrantHoldCauseV1:
      type: string
      description: >-
        Why sharing was suspended, or which suspension was lifted. One cause
        exists today; tolerate values added in later versions of this payload.
      enum:
        - REGISTER_UPDATE
      example: REGISTER_UPDATE
      x-enum-varnames:
        - REGISTER_UPDATE
    GrantEventCdrArrangementHeldV1:
      allOf:
        - $ref: '#/components/schemas/GrantEventBaseV1'
        - type: object
          description: >-
            Sharing against the Grant was suspended without the Grant being
            revoked.


            This is in history because it is the answer to "why did data stop
            flowing against a Grant nobody revoked".
          properties:
            holdCause:
              $ref: '#/components/schemas/EnumGrantHoldCauseV1'
          required:
            - holdCause
    GrantEventCdrArrangementReactivatedV1:
      allOf:
        - $ref: '#/components/schemas/GrantEventBaseV1'
        - type: object
          description: >-
            A previously held Grant became shareable again. `holdCause` names
            the hold that was lifted.
          properties:
            holdCause:
              $ref: '#/components/schemas/EnumGrantHoldCauseV1'
          required:
            - holdCause
    GrantEventV1:
      description: >-
        One event in a Grant history extract.


        The type of event is discriminated based on `grantEventType` with the
        currently supported types provided below.
      oneOf:
        - $ref: '#/components/schemas/GrantEventCdrArrangementCreatedV1'
        - $ref: '#/components/schemas/GrantEventCdrArrangementAmendedV1'
        - $ref: '#/components/schemas/GrantEventCdrArrangementRevokedV1'
        - $ref: '#/components/schemas/GrantEventCdrArrangementHeldV1'
        - $ref: '#/components/schemas/GrantEventCdrArrangementReactivatedV1'
      discriminator:
        propertyName: grantEventType
        mapping:
          CDR_SHARING_ARRANGEMENT_V1_CREATED: '#/components/schemas/GrantEventCdrArrangementCreatedV1'
          CDR_SHARING_ARRANGEMENT_V1_AMENDED: '#/components/schemas/GrantEventCdrArrangementAmendedV1'
          CDR_SHARING_ARRANGEMENT_V1_REVOKED: '#/components/schemas/GrantEventCdrArrangementRevokedV1'
          CDR_SHARING_ARRANGEMENT_V1_HELD: '#/components/schemas/GrantEventCdrArrangementHeldV1'
          CDR_SHARING_ARRANGEMENT_V1_REACTIVATED: '#/components/schemas/GrantEventCdrArrangementReactivatedV1'
    ResponseListGrantHistoryV1:
      type: object
      properties:
        version:
          type: string
          description: Discriminator for the response envelope version.
          enum:
            - V1
          example: V1
        data:
          type: array
          description: >-
            A history of events related to a particular Grant restricted to the
            supported event types as described in `EnumGrantEventTypeV1`.
          items:
            $ref: '#/components/schemas/GrantEventV1'
        meta:
          $ref: '#/components/schemas/MetaPaginatedV1'
        links:
          $ref: '#/components/schemas/LinksPaginatedV1'
      required:
        - version
        - data
        - meta
        - links
    ResponseListGrantHistory:
      description: >-
        Versioned response envelope. The `version` property is the
        discriminator: a later version of this operation adds a new member to
        the `oneOf` and leaves every existing member untouched, so a client that
        does not uplift is not affected.
      oneOf:
        - $ref: '#/components/schemas/ResponseListGrantHistoryV1'
      discriminator:
        propertyName: version
        mapping:
          V1: '#/components/schemas/ResponseListGrantHistoryV1'
  responses:
    AdminApiGetEndpointMeta:
      description: Success
      headers:
        x-haas-v:
          $ref: '#/components/headers/ResponseXHaasV'
        x-fapi-interaction-id:
          $ref: '#/components/headers/XFapiInteractionId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AdminApiResponseGetEndpointMeta'
    ErrorBadRequest:
      description: >-
        A parameter or header this operation accepts was supplied with a value
        it does not accept for example, an out-of-range `page` or `page-size`,
        an unrecognised `status` or `event-type` or a malformed `x-haas-v`
      headers:
        x-fapi-interaction-id:
          $ref: '#/components/headers/XFapiInteractionId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResponseErrorList'
    ErrorUnauthorised:
      description: The bearer token is missing, expired or otherwise invalid
      headers:
        x-fapi-interaction-id:
          $ref: '#/components/headers/XFapiInteractionId'
        WWW-Authenticate:
          $ref: '#/components/headers/ResponseWwwAuthenticate'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResponseErrorList'
    ErrorForbidden:
      description: The token is valid but lacks a scope this operation requires.
      headers:
        x-fapi-interaction-id:
          $ref: '#/components/headers/XFapiInteractionId'
        WWW-Authenticate:
          $ref: '#/components/headers/ResponseWwwAuthenticate'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResponseErrorList'
    ErrorNotFound:
      description: >-
        The realm, or a resource named within it, does not exist or is not one
        this credential may access.
      headers:
        x-fapi-interaction-id:
          $ref: '#/components/headers/XFapiInteractionId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResponseErrorList'
    ErrorUnsupportedVersion:
      description: >-
        No version this operation can serve satisfies the version you asked for,
        either a `x-haas-v` naming an unavailable version or a `x-haas-max-v`
        ceiling below every version available. Call `getEndpointMeta` to
        discover which versions this deployment supports for each operation.
      headers:
        x-fapi-interaction-id:
          $ref: '#/components/headers/XFapiInteractionId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResponseErrorList'
    ListGrants:
      description: Success
      headers:
        x-haas-v:
          $ref: '#/components/headers/ResponseXHaasV'
        x-fapi-interaction-id:
          $ref: '#/components/headers/XFapiInteractionId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResponseListGrant'
    GetGrant:
      description: Success
      headers:
        x-haas-v:
          $ref: '#/components/headers/ResponseXHaasV'
        x-fapi-interaction-id:
          $ref: '#/components/headers/XFapiInteractionId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResponseGetGrant'
    ListGrantHistory:
      description: Success
      headers:
        x-haas-v:
          $ref: '#/components/headers/ResponseXHaasV'
        x-fapi-interaction-id:
          $ref: '#/components/headers/XFapiInteractionId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResponseListGrantHistory'
