> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Mint aggregator consent token

> Use this endpoint to get the consent token that the aggregator's own consent widget (Pluggy Connect or the Belvo widget) needs for this connection. The request has no body: Matcher reads the vendor from the stored connection. For a connection already bound to a vendor item or link, the token starts a re-consent. After the end customer completes the widget, bind the item or link id to the connection with an update that sets `accountRef`.



## OpenAPI

````yaml /en/openapi/v3-current/matcher.yaml post /v1/discovery/aggregator-connections/{id}/connect-token
openapi: 3.1.0
info:
  title: Matcher APIs
  description: >-
    Complete API reference for the Matcher reconciliation engine, providing
    automated transaction matching between Midaz Ledger and external systems.
  version: 5.0.0
  license:
    name: Lerian Studio General License
servers:
  - url: https://matcher.sandbox.lerian.net
security: []
paths:
  /v1/discovery/aggregator-connections/{id}/connect-token:
    post:
      tags:
        - Discovery
      summary: Mint aggregator consent token
      description: >-
        Use this endpoint to get the consent token that the aggregator's own
        consent widget (Pluggy Connect or the Belvo widget) needs for this
        connection. The request has no body: Matcher reads the vendor from the
        stored connection. For a connection already bound to a vendor item or
        link, the token starts a re-consent. After the end customer completes
        the widget, bind the item or link id to the connection with an update
        that sets `accountRef`.
      operationId: mintAggregatorConsentToken
      parameters:
        - description: Opaque aggregator connection id
          in: path
          name: id
          required: true
          schema:
            description: Opaque aggregator connection id
            type: string
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AggregatorConsentTokenResponse'
          description: Created
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      security:
        - BearerAuth: []
components:
  schemas:
    AggregatorConsentTokenResponse:
      additionalProperties: false
      properties:
        accountRef:
          description: >-
            Vendor item/link id this token was scoped to (the stored binding);
            empty on a first consent. Pass it to the vendor widget's update mode
            alongside the token — do not substitute a locally cached value.
          examples:
            - a1b2c3d4-5678-90ab-cdef-1234567890ab
          type: string
        configName:
          description: Config name of the connection the token was minted for
          examples:
            - pluggy-main
          type: string
        expiresAt:
          description: UTC instant after which the vendor rejects this consent token
          examples:
            - '2026-08-23T12:30:00Z'
          format: date-time
          type: string
        reconsent:
          description: >-
            Whether the token re-authorizes the connection's existing vendor
            item/link (true) or will create a new one (false)
          examples:
            - false
          type: boolean
        token:
          description: Consent token for the vendor widget. Pass it to the widget.
          examples:
            - eyJhbGciOi...
          type: string
        vendor:
          description: Aggregator vendor the consent token was minted against
          enum:
            - pluggy
            - belvo
          examples:
            - pluggy
          type: string
      required:
        - vendor
        - configName
        - token
        - expiresAt
        - reconsent
        - accountRef
      type: object
    Detail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          examples:
            - ERR-0001
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: 'Bearer token authentication (format: "Bearer {token}")'
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.