# Export daily account statement

> Export a daily account statement as a CSV file.

```yaml
openapi: 3.1.0
info:
  title: Export daily account statement
  version: 1.0.0
  description: Export a daily account statement as a CSV file.
paths:
  /api/v2/account/statement/daily/export:
    post:
      summary: Export daily account statement
      description: Export a daily account statement as a CSV file.
      parameters:
        - name: apikey
          in: header
          required: true
          description: Account service API key request header assigned by Onerway. Use the
            value for the same environment as the request base URL.
          schema:
            type: string
            description: Account service API key request header assigned by Onerway. Use the
              value for the same environment as the request base URL.
        - name: x-timestamp
          in: header
          required: true
          description: Request timestamp. The gateway uses it to identify replay attempts.
          schema:
            type: string
            description: Request timestamp. The gateway uses it to identify replay attempts.
            x-onerway-constraints:
              - kind: rule
                text: The timestamp must be within 10 minutes of the server time. Both 10-digit
                  seconds and 13-digit milliseconds are accepted.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                requestId:
                  type: string
                  description: Request ID used for idempotency control and request tracing.
                onBehalfOf:
                  type: string
                  description: Sub-merchant number when a platform merchant exports on behalf of
                    its sub-merchant. The caller merchant from `apikey` must be
                    the parent merchant.
                date:
                  type: string
                  description: Statement date in `yyyyMMdd` format.
                  x-onerway-constraints:
                    - kind: rule
                      text: Use the `yyyyMMdd` format without hyphens, for example `20260720`.
                currency:
                  type: string
                  description: Statement currency. Use a three-letter [ISO
                    4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes)
                    currency code.
                businessType:
                  type: string
                  description: Business type for the statement export. Defaults to `PAYOUT` when
                    omitted.
                  enum:
                    - ACQUIRING
                    - PAYOUT
                    - BAAS
                    - ISSUING
                  x-enum-descriptions:
                    ACQUIRING: Acquiring business statement.
                    PAYOUT: Payout business statement.
                    BAAS: BaaS business statement.
                    ISSUING: Issuing business statement.
              required:
                - requestId
                - date
                - currency
            examples:
              export-daily-payout-statement:
                summary: Export the USD payout statement for 2026-07-20
                value:
                  requestId: REQ-STMT-20260720-0001
                  date: "20260720"
                  currency: USD
                  businessType: PAYOUT
      responses:
        "200":
          description: USD payout statement CSV response
          content:
            application/json:
              schema:
                type: object
                properties:
                  respCode:
                    type: string
                    description: Standardized response code for JSON error responses.
                    x-onerway-value:
                      empty: true
                      when:
                        en: Returned in JSON error responses when the CSV stream has not been committed
                          yet. Successful CSV stream responses do not include a
                          JSON response envelope.
                        zh: 当 CSV 响应尚未提交且接口返回 JSON 错误结构时返回；成功的 CSV 文件流响应不包含 JSON 响应壳。
                  respMsg:
                    type: string
                    description: Human-readable response message aligned with `respCode`.
                    x-onerway-value:
                      empty: true
                      when:
                        en: Returned in JSON error responses when the CSV stream has not been committed
                          yet. Successful CSV stream responses do not include a
                          JSON response envelope.
                        zh: 当 CSV 响应尚未提交且接口返回 JSON 错误结构时返回；成功的 CSV 文件流响应不包含 JSON 响应壳。
                  file:
                    type: object
                    properties:
                      csv:
                        type: object
                        properties:
                          statementHeader:
                            type: object
                            properties:
                              Merchantid:
                                type: string
                                description: Merchant number resolved from the caller identity. For platform
                                  calls, this is the effective merchant selected
                                  by `onBehalfOf`.
                              Date:
                                type: string
                                description: Statement date rendered with the `GMT+8 yyyy/M/d` display format.
                              Currency:
                                type: string
                                description: Statement currency in three-letter [ISO
                                  4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes)
                                  format.
                            description: The first CSV section. The header row is
                              `Merchantid,Date,Currency`.
                          summaryRows:
                            type: array
                            description: The balance summary section. The header row is
                              `Balancetype,Openingbalance,Movementamount,Endingbalance`.
                              Rows are emitted for `Total Balance`, `Available`,
                              `Frozen`, `Risk Deposit`, and `Pending
                              Settlement`.
                            items:
                              type: object
                              properties:
                                Balancetype:
                                  type: string
                                  description: Balance bucket display name.
                                  enum:
                                    - Total Balance
                                    - Available
                                    - Frozen
                                    - Risk Deposit
                                    - Pending Settlement
                                  x-enum-descriptions:
                                    Total Balance: Total balance across all statement balance buckets.
                                    Available: Available balance.
                                    Frozen: Frozen balance.
                                    Risk Deposit: Risk deposit balance.
                                    Pending Settlement: Pending settlement balance.
                                Openingbalance:
                                  type: string
                                  description: Opening balance for the statement date.
                                Movementamount:
                                  type: string
                                  description: Net movement amount for the statement date. It is calculated as
                                    inbound amount minus outbound amount.
                                Endingbalance:
                                  type: string
                                  description: Ending balance for the statement date.
                          detailRows:
                            type: array
                            description: The transaction detail section. The header row is
                              `Time,Balancetype,Serialnumber,Activitytype,Moveamount,RelatedtransationID,Remark`.
                            items:
                              type: object
                              properties:
                                Time:
                                  type: string
                                  description: Balance update time rendered as `yyyy/M/d H:mm:ss`.
                                Balancetype:
                                  type: string
                                  description: Balance bucket display name derived from the account transaction
                                    sub-account type. If the sub-account type is
                                    not mapped, the raw sub-account type may be
                                    returned.
                                  enum:
                                    - Available
                                    - Frozen
                                    - Risk Deposit
                                    - Pending Settlement
                                  x-enum-descriptions:
                                    Available: Mapped from account transaction sub-account type `AVAIL`.
                                    Frozen: Mapped from account transaction sub-account type `FREEZE`.
                                    Risk Deposit: Mapped from account transaction sub-account type `DEPOSIT`.
                                    Pending Settlement: Mapped from account transaction sub-account type `UNSETTLE`.
                                Serialnumber:
                                  type: string
                                  description: Transaction order number. This value comes from `serviceId`.
                                Activitytype:
                                  type: string
                                  description: "Activity type derived from `txnType`. This is not a fixed enum in
                                    the CSV: when an English translation exists
                                    in the account transaction type dictionary,
                                    the CSV uses the English description;
                                    otherwise it falls back to the raw `txnType`
                                    value."
                                Moveamount:
                                  type: string
                                  description: Transaction movement amount. Increase entries are positive;
                                    decrease entries include a minus sign.
                                RelatedtransationID:
                                  type: string
                                  description: Related transaction ID from `externalOrderId`.
                                Remark:
                                  type: string
                                  description: Remark text. When a matching remark dictionary value exists, the
                                    CSV uses the dictionary description;
                                    otherwise it uses the raw remark.
                        description: UTF-8 encoded CSV statement file. The file contains a statement
                          header section, a balance summary section, and a
                          transaction detail section. Empty lines separate the
                          sections.
                    description: "Successful responses return a CSV file stream with `Content-Type:
                      text/csv; charset=UTF-8`. The `Content-Disposition` header
                      follows the pattern `attachment;
                      filename=statement_{date}_{currency}.csv`. Save the UTF-8
                      encoded content as a `.csv` file."
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        description: External business error code aligned with `respCode`.
                      declineCode:
                        type: string
                        description: Compatibility field that mirrors `code` for current account APIs.
                      message:
                        type: string
                        description: Human-readable error message.
                      type:
                        type: string
                        description: Standardized error category.
                      param:
                        type: string
                        description: Request parameter that caused the error, when applicable.
                      requestId:
                        type: string
                        description: Caller request id copied from body `requestId`.
                    description: Standardized error object. Returned only when the CSV stream has
                      not been committed yet; otherwise the failure is logged
                      and the partial CSV is sent to the caller.
              examples:
                export-daily-payout-statement:
                  summary: USD payout statement CSV response
                  value:
                    file:
                      csv:
                        statementHeader:
                          Merchantid: replace_with_merchant_no
                          Date: GMT+8 2026/7/20
                          Currency: USD
                        summaryRows:
                          - Balancetype: Total Balance
                            Openingbalance: "3000.00"
                            Movementamount: "400.00"
                            Endingbalance: "3400.00"
                          - Balancetype: Available
                            Openingbalance: "2500.00"
                            Movementamount: "500.00"
                            Endingbalance: "3000.00"
                        detailRows:
                          - Time: 2026/7/20 10:30:00
                            Balancetype: Available
                            Serialnumber: "20001"
                            Activitytype: Payout
                            Moveamount: "-100.00"
                            RelatedtransationID: replace_with_external_order_id
                            Remark: Payout to bank account
                export-daily-payout-statement-error:
                  summary: Failure response when CSV cannot be generated
                  value:
                    respCode: "10001"
                    respMsg: Invalid request parameter
                    error:
                      code: "10001"
                      declineCode: "10001"
                      message: currency must not be blank
                      type: invalid_request_error
                      param: currency
                      requestId: REQ-STMT-20260720-0001
            text/csv:
              schema:
                type: string
                format: binary
          headers:
            Content-Disposition:
              description: Provides the downloaded filename. The value follows the pattern
                `attachment; filename=statement_{date}_{currency}.csv`.
              schema:
                type: string
      x-onerway-lifecycle:
        phase: active
        access:
          description:
            en: Access to the Account service APIs is enabled by Onerway approval.
            zh: 账户服务 API 的访问权限需经 Onerway 审批后开通。
```
