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

# Create Settlement Report Export

> Create an asynchronous settlement report export job for a batch or merchant scope.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/aggregators/{raast-aggregator-id}/settlements/report-exports
openapi: 3.1.0
info:
  title: Raast Wire
  version: 1.0.0
  description: ''
servers:
  - url: https://api.getsafepay.com/raastwire
security: []
tags:
  - name: Aggregators
  - name: Access Keys
  - name: Merchants
  - name: Raast Merchants
  - name: Payments
  - name: Refunds
  - name: QRs
  - name: Utilities
  - name: Aliases
  - name: Ledgers
  - name: Webhooks
paths:
  /v1/aggregators/{raast-aggregator-id}/settlements/report-exports:
    post:
      tags:
        - Settlement Reports
      summary: Create Settlement Report Export
      description: >-
        Create an asynchronous settlement report export job for a batch or
        merchant scope.
      parameters:
        - name: aggregator_id
          in: path
          required: true
          description: Aggregator identifier that owns the settlement report exports.
          schema:
            type: string
            example: agg_b49985f2-e099-412e-8eb2-98756059cc0d
      requestBody:
        $ref: '#/components/requestBodies/CreateSettlementReportExport'
      responses:
        '200':
          $ref: '#/components/responses/CreateSettlementReportExportResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - apiKey: []
components:
  requestBodies:
    CreateSettlementReportExport:
      description: Request body to create a settlement report export job.
      content:
        application/json:
          schema:
            type: object
            properties:
              settlement_batch_id:
                type: string
                description: Settlement batch identifier to export.
                example: sb_6eb80843-eb2b-4df2-b85f-25d50f03d2a1
              merchant_id:
                type: string
                description: >-
                  Optional merchant identifier for merchant-level report exports
                  type REPORT_KIND_MERCHANT. Empty if the report exports are of
                  type REPORT_KIND_BATCH.
                example: mer_e1a38d10-0064-4d7b-a700-f4ba483efb05
              kind:
                type: string
                description: Export scope kind.
                enum:
                  - REPORT_KIND_BATCH
                  - REPORT_KIND_MERCHANT
                example: REPORT_KIND_BATCH
            required:
              - settlement_batch_id
              - kind
          examples:
            CreateSettlementReportExport:
              value:
                settlement_batch_id: sb_6eb80843-eb2b-4df2-b85f-25d50f03d2a1
                merchant_id: mer_e1a38d10-0064-4d7b-a700-f4ba483efb05
                kind: REPORT_KIND_BATCH
  responses:
    CreateSettlementReportExportResponse:
      description: Settlement report export job created successfully.
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLengthHeader'
        Date:
          $ref: '#/components/headers/DateHeader'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/StandardResponse'
              - type: object
                properties:
                  data:
                    type: object
                    properties:
                      report_export:
                        $ref: '#/components/schemas/SettlementReportExport'
          examples:
            SettlementReportExportCreated:
              value:
                api_version: v1
                data:
                  report_export:
                    id: '55'
                    token: rpt_e71265de-6699-4a02-b99b-b985edb9b915
                    settlement_batch_id: sb_6eb80843-eb2b-4df2-b85f-25d50f03d2a1
                    merchant_id: ''
                    kind: REPORT_KIND_SEED
                    status: REPORT_STATUS_SEEDED
                    attempts: 1
                    error_message: ''
                    s3_key: ''
                    record_count: '0'
                    file_size: '0'
                    started_at: '2026-04-03T11:30:09Z'
                    finished_at: null
                    created_at: '2026-04-03T11:30:04Z'
                    updated_at: '2026-04-03T11:30:09Z'
                    partner_id: partner_37e414c3-c0cc-4541-9bea-ab5a22964bd8
                    version: 0
    BadRequest:
      description: Bad request
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLengthHeader'
        Date:
          $ref: '#/components/headers/DateHeader'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/ErrorResponse'
              - type: object
                properties:
                  code:
                    example: error.bad_request
                  message:
                    example: Invalid request parameters
    Unauthorized:
      description: Unauthorized
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLengthHeader'
        Date:
          $ref: '#/components/headers/DateHeader'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorEnvelope'
          examples:
            Unauthorized:
              value:
                api_version: v1
                error:
                  code: error.unauthorized_access
                  message: partner access key is required in request header
    InternalError:
      description: Internal server error response
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLengthHeader'
        Date:
          $ref: '#/components/headers/DateHeader'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorEnvelope'
          examples:
            InternalServerError:
              value:
                api_version: v1
                error:
                  code: error.internal_server_error
                  message: rpc error code Internal desc = something went wrong
  headers:
    ContentLengthHeader:
      schema:
        type: string
        example: '256'
    DateHeader:
      schema:
        type: string
        example: Sat, 12 Aug 2023 08:55:04 GMT
  schemas:
    StandardResponse:
      type: object
      description: Standard response structure for successful operations
      properties:
        api_version:
          type: string
          example: v1
          description: The current version of the API spec
        data:
          type: object
          description: Contains the response data
    SettlementReportExport:
      type: object
      description: Settlement report export job metadata and processing status.
      properties:
        id:
          type: string
          example: '58'
        token:
          type: string
          example: rpt_7670f587-0396-4939-ba4b-585ca67983a2
        settlement_batch_id:
          type: string
          example: sb_6eb80843-eb2b-4df2-b85f-25d50f03d2a1
        merchant_id:
          type: string
          example: mer_0e4b3a32-754b-483a-9c85-80581dbef4cf
        kind:
          type: string
          example: REPORT_KIND_MERCHANT
        status:
          type: string
          example: REPORT_STATUS_SUCCEEDED
        attempts:
          type: integer
          example: 1
        error_message:
          type: string
          example: ''
        s3_key:
          type: string
          example: >-
            reports/partner_37e414c3-c0cc-4541-9bea-ab5a22964bd8/sb_6eb80843-eb2b-4df2-b85f-25d50f03d2a1/mer_0e4b3a32-754b-483a-9c85-80581dbef4cf/merchant-settlement-report-1775215823-v1.csv
        record_count:
          type: string
          example: '2'
        file_size:
          type: string
          example: '1234'
        started_at:
          allOf:
            - $ref: '#/components/schemas/Timestamp'
          nullable: true
        finished_at:
          allOf:
            - $ref: '#/components/schemas/Timestamp'
          nullable: true
        created_at:
          $ref: '#/components/schemas/Timestamp'
        updated_at:
          $ref: '#/components/schemas/Timestamp'
        partner_id:
          type: string
          example: partner_37e414c3-c0cc-4541-9bea-ab5a22964bd8
        version:
          type: integer
          example: 1
    ErrorResponse:
      type: object
      description: Standard error response structure
      properties:
        code:
          type: string
          description: Error code identifying the type of error
        message:
          type: string
          description: Human-readable error message
    ApiErrorEnvelope:
      type: object
      description: Error wrapper that includes the API version and error metadata
      properties:
        api_version:
          type: string
          description: Indicates the API version associated with the response
          example: v1
        error:
          description: Structured error details describing why the request failed
          allOf:
            - $ref: '#/components/schemas/ErrorResponse'
          example:
            code: error.unauthorized_access
            message: partner access key is required in request header
    Timestamp:
      type: string
      format: date-time
      description: ISO 8601 timestamp in UTC
      example: '2025-03-13T09:12:34.000Z'
  securitySchemes:
    apiKey:
      type: apiKey
      name: X-SFPY-AGGREGATOR-SECRET-KEY
      in: header

````