> ## 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.

# Create REST discovery connection

> Use this endpoint to create a REST connection to a payment provider: PagBank, Stripe, or Pix BCB. The credential fields each connector type requires are listed as `requiredFields` on GET /v1/discovery/connector-types. An optional `baseURL` replaces the default provider address for this connection. After you create it, the connection appears in GET /v1/discovery/connections; an update to a REST connection accepts only `configName`.



## OpenAPI

````yaml /pt/openapi/v3-current/matcher.yaml post /v1/discovery/rest-connections
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/rest-connections:
    post:
      tags:
        - Discovery
      summary: Create REST discovery connection
      description: >-
        Use this endpoint to create a REST connection to a payment provider:
        PagBank, Stripe, or Pix BCB. The credential fields each connector type
        requires are listed as `requiredFields` on GET
        /v1/discovery/connector-types. An optional `baseURL` replaces the
        default provider address for this connection. After you create it, the
        connection appears in GET /v1/discovery/connections; an update to a REST
        connection accepts only `configName`.
      operationId: createRESTDiscoveryConnection
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RESTConnectionRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponse'
          description: Created
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
          description: Error
      security:
        - BearerAuth: []
components:
  schemas:
    RESTConnectionRequest:
      additionalProperties: false
      properties:
        apiKey:
          description: Stripe restricted API key
          maxLength: 512
          type: string
        baseURL:
          description: >-
            Optional per-connection API base URL (http/https); when omitted the
            deployment default for the connector type is used
          examples:
            - https://sandbox.provider.example
          format: uri
          maxLength: 2048
          type: string
        clientCert:
          description: PEM-encoded Pix client certificate
          maxLength: 8192
          type: string
        clientID:
          description: Pix OAuth2 client id
          maxLength: 512
          type: string
        clientKey:
          description: PEM-encoded Pix client private key
          maxLength: 8192
          type: string
        clientSecret:
          description: Pix OAuth2 client secret
          maxLength: 512
          type: string
        configName:
          description: Unique connection config name (tenant-scoped)
          examples:
            - pagbank-prod
          maxLength: 255
          minLength: 1
          type: string
        connectorType:
          description: REST connector type this connection serves
          enum:
            - PAGBANK
            - STRIPE
            - PIX_BCB
          examples:
            - PAGBANK
          minLength: 1
          type: string
        ediToken:
          description: PagBank EDI token
          maxLength: 512
          type: string
        establishmentID:
          description: PagBank establishment id
          maxLength: 512
          type: string
      required:
        - configName
        - connectorType
      type: object
    ConnectionResponse:
      additionalProperties: false
      properties:
        baseURL:
          description: >-
            Per-connection API base URL of a REST connector connection; absent
            when the deployment default applies and for database connectors
          examples:
            - https://sandbox.provider.example
          format: uri
          type: string
        configName:
          description: Connection configuration name
          examples:
            - prod-ledger-db
          type: string
        databaseName:
          description: Database name
          examples:
            - ledger
          type: string
        databaseType:
          description: Database engine type (canonical engine token as stored)
          examples:
            - POSTGRESQL
          type: string
        host:
          description: >-
            Database host; empty for REST connector connections, whose service
            address is reported as baseURL
          examples:
            - db.internal.example.com
          type: string
        id:
          description: Internal Matcher connection identifier
          examples:
            - 3fa85f64-5717-4562-b3fc-2c963f66afa6
          type: string
        lastSeenAt:
          description: Timestamp the connection was last observed healthy (RFC 3339)
          examples:
            - '2026-06-17T14:32:05Z'
          format: date-time
          type: string
        port:
          description: Database port
          examples:
            - 5432
          format: int64
          type: integer
        schema:
          description: Schema/namespace within the database, when set
          examples:
            - public
          type: string
        schemaDiscovered:
          description: Whether table schemas have been discovered for this connection
          type: boolean
        status:
          description: >-
            Current lifecycle status of the connection as reported by the
            extraction engine
          examples:
            - available
          type: string
        userName:
          description: Database user name the connection authenticates as
          examples:
            - matcher_ro
          type: string
      required:
        - id
        - configName
        - databaseType
        - host
        - port
        - databaseName
        - userName
        - status
        - schemaDiscovered
        - lastSeenAt
      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.