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

# Start a connection extraction

> Use this endpoint to create an extraction request for a discovered connection and submit it to Fetcher for the authenticated tenant.



## OpenAPI

````yaml /en/openapi/v3-current/matcher.yaml post /v1/discovery/connections/{connectionId}/extractions
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: v2.1.1
  license:
    name: Elastic License 2.0
    url: https://www.elastic.co/licensing/elastic-license
servers:
  - url: https://matcher.sandbox.lerian.net
security: []
paths:
  /v1/discovery/connections/{connectionId}/extractions:
    post:
      tags:
        - Discovery
      summary: Start a connection extraction
      description: >-
        Use this endpoint to create an extraction request for a discovered
        connection and submit it to Fetcher for the authenticated tenant.
      operationId: startDiscoveryExtraction
      parameters:
        - description: A unique identifier for tracing the request across services.
          in: header
          name: X-Request-Id
          schema:
            type: string
        - description: The unique identifier of the connection.
          in: path
          name: connectionId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StartExtractionRequest'
        description: Extraction request payload
        required: true
      responses:
        '201':
          description: Extraction request created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtractionRequestResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: The request lacks valid authentication credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: You do not have permission to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Connection not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: An unexpected error occurred on the server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Fetcher service is unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    StartExtractionRequest:
      description: >-
        Request payload for starting a data extraction from a discovered
        connection
      properties:
        tables:
          description: Tables to extract data from, keyed by table name
          additionalProperties:
            $ref: '#/components/schemas/ExtractionTableRequest'
          type: object
        startDate:
          description: Start of the date range to extract (RFC 3339)
          type: string
        endDate:
          description: End of the date range to extract (RFC 3339)
          type: string
        filters:
          $ref: '#/components/schemas/ExtractionFilters'
      required:
        - tables
      type: object
    ExtractionRequestResponse:
      description: An extraction request submitted to Fetcher
      properties:
        id:
          description: Internal identifier for the extraction request
          type: string
        connectionId:
          description: Connection this extraction was submitted to
          type: string
        status:
          description: Current lifecycle status of the extraction
          type: string
        ingestionJobId:
          description: Job identifier returned by Fetcher
          type: string
        startDate:
          description: Start of the extracted date range
          type: string
        endDate:
          description: End of the extracted date range
          type: string
        tables:
          description: Per-table extraction status
          additionalProperties:
            $ref: '#/components/schemas/ExtractionTableResponse'
          type: object
        filters:
          $ref: '#/components/schemas/ExtractionFilters'
        errorMessage:
          description: Error details if the extraction failed
          type: string
        createdAt:
          description: Timestamp when the extraction was requested
          type: string
        updatedAt:
          description: Timestamp of the last status update
          type: string
        bridgeAttempts:
          description: >-
            Number of times the Matcher bridge pipeline has attempted to
            retrieve and ingest this extraction
          example: 0
          type: integer
        bridgeLastError:
          description: Error class of the last bridge pipeline failure
          example: ''
          type: string
        bridgeLastErrorMessage:
          description: >-
            Appended-history error message from the bridge pipeline; primary
            failure stays at the head
          example: ''
          type: string
        bridgeFailedAt:
          description: >-
            Timestamp of the first terminal bridge failure; omitted when no
            failure has occurred
          format: date-time
          type:
            - string
            - 'null'
        custodyDeletedAt:
          description: >-
            Timestamp when the custody object was deleted; omitted when still
            held
          format: date-time
          type:
            - string
            - 'null'
      type: object
    ErrorResponse:
      description: Standard error response returned by all API endpoints
      type: object
      required:
        - code
        - title
        - message
      properties:
        code:
          type: string
          description: HTTP status code as a string.
          example: '404'
        title:
          type: string
          description: Error type identifier.
          example: not_found
        message:
          type: string
          description: Human-readable error message with details.
          example: context not found
        error:
          type: string
          description: Deprecated. Error message for backward compatibility.
          deprecated: true
        details:
          description: Additional error context as key-value pairs
          additionalProperties: {}
          type: object
    ExtractionTableRequest:
      description: Column selection for a single table in an extraction request
      properties:
        columns:
          description: Column names to include in the extraction
          items:
            type: string
          minItems: 1
          type: array
      required:
        - columns
      type: object
    ExtractionFilters:
      description: Optional row-level filters for an extraction
      properties:
        equals:
          description: >-
            Key-value pairs where all specified fields must equal the given
            values
          additionalProperties:
            type: string
          type: object
      type: object
    ExtractionTableResponse:
      description: Extraction status for a single table
      properties:
        columns:
          description: Columns included in the extraction
          items:
            type: string
          type: array
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Bearer token authentication (format: "Bearer {token}")'

````