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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# 创建报告

> 请求生成支付、交易或结算报告，并返回报告的 ID 和状态。

此 endpoint 用于请求生成特定类型的报告。`start_date` 必须早于 `end_date`，否则 API 会返回 400 `REPORT_RANGE_ERROR`。`start_date` 还必须早于当前时间，但 `AGENDA` 和 `CASHFLOW` 报告除外，它们接受未来的日期。对于 `TRANSACTIONS`、`PAYMENTS`、`FRAUD_TRANSACTIONS`、`PAYOUTS`、`AGENDA` 和 `CASHFLOW` 以外的报告类型，`start_date` 与 `end_date` 之间的范围最多为 62 天，超出该范围会以 `400` 被驳回。此 endpoint 的响应会提供一个对象，其中包含：

* 报告生成的 `status`。
* 报告 `id`。

报告生成后，使用报告 id 通过[下载报告](https://docs.y.uno/zh-hans/reference/reports/download-a-report.md) endpoint 下载报告。


## OpenAPI

````yaml openapi/zh-hans/reports/create-a-report.json POST /reports
openapi: 3.1.0
info:
  title: reports
  version: 1.0.2
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
paths:
  /reports:
    post:
      summary: 创建报表
      operationId: create-a-report
      parameters:
        - name: X-Organization-Code
          in: header
          required: true
          schema:
            type: string
          description: 与请求关联的组织代码。
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - type
                - start_date
                - end_date
              properties:
                type:
                  type: string
                  description: >-
                    要运行的报表类型（最多 255，最少 3）。SETTLEMENT_PAYOUTS 适用于使用 Yuno
                    新对账引擎的商户。
                  enum:
                    - PAYOUTS
                    - PAYMENTS
                    - TRANSACTIONS
                    - SETTLEMENTS_FEES
                    - RECONCILIATION_OVERVIEW
                    - COMMUNICATIONS
                    - SETTLEMENT_PAYOUTS
                user_code:
                  type: string
                  description: 与该报表请求关联的用户标识符。
                start_date:
                  type: string
                  description: >-
                    报表运行所包含数据的起始时间戳（最多 24，最少 24；[ISO
                    8601](https://en.wikipedia.org/wiki/ISO_8601)）。必须早于
                    `end_date`，否则 API 会返回 400
                    REPORT_RANGE_ERROR。同时必须早于当前时间，AGENDA 和 CASHFLOW
                    报表除外，它们接受未来日期。对于
                    TRANSACTIONS、PAYMENTS、FRAUD_TRANSACTIONS、PAYOUTS、AGENDA 和
                    CASHFLOW 以外的报表类型，`start_date` 与 `end_date` 之间的范围最多为 62
                    天；超出该范围会被拒绝并返回 400。
                  format: date-time
                end_date:
                  type: string
                  description: >-
                    报表运行所包含数据的结束时间戳（最多 24，最少 24；[ISO
                    8601](https://en.wikipedia.org/wiki/ISO_8601)）。必须晚于
                    `start_date`，否则 API 会返回 400 REPORT_RANGE_ERROR。
                  format: date-time
                merchant_reference_id:
                  type: string
                  description: 商户侧报表的唯一标识符（最多 255，最少 3）。
                account_id:
                  type: string
                  description: >-
                    账户标识符。省略则包含所有账户。多个账户请发送以逗号分隔的列表。对于 Settlement Payouts
                    报表，该值会与提供商账户名称匹配；对于使用 Yuno 新对账引擎的商户，还会通过结算批次与 Yuno
                    账户匹配。payout 通过单独 endpoint 到达的提供商（例如
                    Pagar.me）在按此方式筛选时不会返回任何行。<br>
                    示例：`19d28762-c714-4fb0-9ef6-4e1953ed334b,
                    91d82267-c714-4fb0-9ef6-4e1953ed334b`
                acquirer:
                  type: string
                  description: >-
                    按收单机构筛选 Settlements 报表。接受单个值（不区分大小写；习惯上使用大写）。对于 Settlement
                    Payouts 报表，此筛选条件接受以逗号分隔的值列表，且为大写。<br> 示例：`BAC_CREDOMATIC`
                provider_id:
                  type: string
                  description: >-
                    对于 Settlement Payouts 报表，按提供商筛选行。以逗号分隔的列表，值为大写。<br>
                    示例：`ADYEN,CIELO`
                payment_status:
                  type: string
                  description: >-
                    支付的状态（最多 255，最少
                    3；[支付状态](/zh-hans/reference/payments/status-and-response-codes/payment#payments-status)）。如需为所有支付状态创建报表，请不要发送此参数。否则，请指明您要包含的所有状态。<br>
                    示例：`CREATED,READY_TO_PAY,DECLINED`
                payment_sub_status:
                  type: string
                  description: >-
                    支付的子状态（最多 255，最少
                    3；[支付子状态](/zh-hans/reference/payments/status-and-response-codes/payment#payments-status)）。如需为所有支付子状态创建报表，请不要发送此参数。否则，请指明您要包含的所有子状态。<br>
                    示例：`READY_TO_PAY,PENDING_FRAUD_REVIEW,EXPIRED`
                payment_method:
                  type: string
                  description: >-
                    客户选择的支付方式类型（最多 255，最少
                    3；[支付方式](/zh-hans/reference/payment-type-list)）。如需为所有支付方式创建报表，请不要发送此参数。否则，请指明您要包含的所有支付方式。<br>
                    示例：`ADDI,ACUOTAZ,PIX`
                currency:
                  type: string
                  description: >-
                    支付所用的币种（最多 3，最少 3；[ISO
                    4217](/zh-hans/reference/country-reference)）。如需为所有币种创建报表，请不要发送此参数。否则，请指明您要包含的所有币种。对于
                    Settlement Payouts 报表，按结算币种筛选（以逗号分隔的列表）。<br>
                    示例：`ARS,BRL,COP`
                country:
                  type: string
                  description: >-
                    交易必须在其中处理的国家（最多 2，最少 2；[ISO
                    3166-1](/zh-hans/reference/country-reference)）。如需为所有国家创建报表，请不要发送此参数。否则，请指明您要包含的所有国家。<br>
                    示例：`AR,BR,CO`
                transaction_type:
                  type: string
                  description: >-
                    交易类型（最多 255，最少
                    3；[交易类型](/zh-hans/reference/payments/status-and-response-codes/transaction#types-of-transactions)）。如需为所有交易类型创建报表，请不要发送此参数。否则，请指明您要包含的所有交易类型。<br>
                    示例：`PURCHASE,REFUND,VERIFY`
                transaction_status:
                  type: string
                  description: >-
                    交易的状态（最多 255，最少
                    3；[交易状态](/zh-hans/reference/payments/status-and-response-codes/payment#payments-status)）。如需为所有交易状态创建报表，请不要发送此参数。否则，请指明您要包含的所有交易状态。<br>
                    示例：`SUCCEEDED,CREATED,EXPIRED`
                updated_at_start:
                  type: string
                  description: >-
                    按操作的更新日期，报表运行所包含数据的起始时间戳（最多 27，最少 27；[ISO
                    8601](https://en.wikipedia.org/wiki/ISO_8601)）。
                  format: date-time
                updated_at_end:
                  type: string
                  description: >-
                    按操作的更新日期，报表运行所包含数据的结束时间戳（最多 27，最少 27；[ISO
                    8601](https://en.wikipedia.org/wiki/ISO_8601)）。
                  format: date-time
                columns:
                  type: string
                  description: >-
                    要包含的列（仅适用于 Payment、Transaction 或 Settlement Payouts
                    报表）。可用字段请参见[报表字段](/zh-hans/reference/reports/reports-fields)。对于
                    Settlement Payouts
                    报表，此参数会替换默认的列选择，而不是在其基础上扩展：如需添加可选列，您还必须列出所有要保留的默认列。<br>
                    示例：`account_id,amount_value,card_category`。不属于所选报表类型的列的名称会返回
                    400 INVALID_COLUMNS。
                metadata_fields:
                  type: string
                  description: >-
                    要包含的列（仅当商户导出 metadata 字段时适用）。此选项仅适用于 Transaction 和
                    Settlement 报表。
            examples:
              Create a report:
                value:
                  type: PAYMENTS
                  start_date: '2023-07-28T21:09:03.327Z'
                  end_date: '2023-07-29T21:09:03.327Z'
                  merchant_reference_id: test_id
                  account_id: >-
                    19d28762-c714-4fb0-9ef6-4e1953ed334b,
                    91d82267-c714-4fb0-9ef6-4e1953ed334b
                  payment_status: CREATED,READY_TO_PAY,DECLINED
                  payment_sub_status: READY_TO_PAY,PENDING_FRAUD_REVIEW,EXPIRED
                  payment_method: ADDI,ACUOTAZ,PIX
                  currency: ARS,BRL,COP
                  country: AR,BR,CO
                  transaction_type: PURCHASE,REFUND,VERIFY
                  transaction_status: SUCCEEDED,CREATED,EXPIRED
                  updated_at_start: '2023-07-28T21:09:03.327Z'
                  updated_at_end: '2023-07-28T21:09:03.327Z'
                  columns: account_id,amount_value,card_category
      responses:
        '201':
          description: '201'
          content:
            application/json:
              examples:
                Result:
                  value:
                    id: 6d905149-b388-4522-8c0a-759fed1f39da
                    type: PAYMENTS
                    start_date: '2023-07-01T00:00:00.000000Z'
                    end_date: '2023-07-12T00:00:00.000000Z'
                    merchant_reference_id: payments_1
                    created_at: '2023-07-12T20:10:30.311048Z'
                    updated_at: '2023-07-12T20:10:30.311048Z'
                    expires_at: ''
                    status: IN_PROCESS
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: 6d905149-b388-4522-8c0a-759fed1f39da
                  type:
                    type: string
                    example: PAYMENTS
                  start_date:
                    type: string
                    example: 2023-07-01 00:00:00 +0000 UTC
                  end_date:
                    type: string
                    example: 2023-07-12 00:00:00 +0000 UTC
                  merchant_reference_id:
                    type: string
                    example: payments_1
                  created_at:
                    type: string
                    example: 2023-07-12 20:10:30.311048496 +0000 UTC
                  updated_at:
                    type: string
                    example: 2023-07-12 20:10:30.311048496 +0000 UTC
                  expires_at:
                    type: string
                    example: ''
                  status:
                    type: string
                    example: IN_PROCESS
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: INVALID_REQUEST
                    messages:
                      - Invalid request
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_REQUEST
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid request
        '401':
          description: '401'
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: INVALID_CREDENTIALS
                    messages:
                      - Invalid credentials
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_CREDENTIALS
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid credentials
        '403':
          description: '403'
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: AUTHORIZATION_REQUIRED
                    messages:
                      - The merchant has no authorization to use this API.
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: AUTHORIZATION_REQUIRED
                  messages:
                    type: array
                    items:
                      type: string
                      example: The merchant has no authorization to use this API.
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: public-api-key
      x-default: <Your public-api-key>
    sec1:
      type: apiKey
      in: header
      name: private-secret-key
      x-default: <Your private-secret-key>

````

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