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

# Consultar lote de payouts

> Consulta o lote por batchId para acompanhar status, totais e resultado por item.

## Caso de uso

Use esta rota para acompanhar o estado de um lote de payouts e atualizar conciliacao financeira no seu sistema.

## Autenticacao

* `x-client-id`
* `x-client-secret`
* `x-turbofy-timestamp`
* `x-turbofy-signature`

## Pre-condicoes e requisitos

* `batchId` deve pertencer ao merchant autenticado.
* Assinatura HMAC valida dentro da janela de tempo.

## Request

Parametro principal:

* `batchId` (path): identificador do lote.

## Response de sucesso

Em `200`, a API retorna:

* `id` e `status`
* `totalAmountCents`, `totalFeeCents`, `totalNetCents`
* `totalItems`, `paidItems`, `failedItems`
* `items[]` com status de cada transferencia
* `createdAt` e `updatedAt`

## Erros comuns reais

| HTTP  | code                  | Quando ocorre                                 |
| ----- | --------------------- | --------------------------------------------- |
| `401` | `INVALID_SIGNATURE`   | Assinatura ausente, invalida ou expirada.     |
| `401` | `INVALID_CREDENTIALS` | Credenciais ausentes ou invalidas.            |
| `404` | `BATCH_NOT_FOUND`     | Lote inexistente para o merchant autenticado. |

## Regras de negocio e observacoes operacionais

* A consulta retorna somente lotes do merchant autenticado.
* Para detalhamento por item, use `GET /v1/payouts/batches/{batchId}/items`.
* Se o lote iniciou processamento, contadores de itens refletem progresso real.

## Exemplo de codigo

```bash theme={null}
curl --request GET \
  --url https://api.turbofypay.com/v1/payouts/batches/4e5038b0-5f73-4e67-a6ad-54ab4106ac78 \
  --header "x-client-id: <client-id>" \
  --header "x-client-secret: <client-secret>" \
  --header "x-turbofy-timestamp: 1772805000000" \
  --header "x-turbofy-signature: <hmac-sha256>"
```

## Proximos passos

1. Para nova criacao, use [Criar lote de payouts](/reference/payouts/criar-lote-payouts).
2. Para itens individuais, use `GET /v1/payouts/batches/{batchId}/items` na secao de rotas publicas.


## OpenAPI

````yaml GET /v1/payouts/batches/{batchId}
openapi: 3.0.3
info:
  title: Turbofy Public API
  version: 2.0.0
  description: >-
    Especificacao publica da API TurbofyPay para Cobranca PIX, Saques, Webhooks
    e Payouts.
  contact:
    name: Turbofy Team
    email: suporte@turbofy.com
    url: https://turbofy.com
  license:
    name: Proprietary
    url: https://turbofy.com/terms
servers:
  - url: http://localhost:3030
    description: Development Server
  - url: https://api.turbofypay.com
    description: Production Server
security: []
tags:
  - name: Cobranca PIX
    description: Operacoes de cobranca PIX para integradores.
  - name: Saques
    description: Operacoes de saque para sellers.
  - name: Webhooks
    description: Cadastro e consulta de webhooks.
  - name: Payouts
    description: Gestao de lotes de payout.
externalDocs:
  description: Documentação completa
  url: https://docs.turbofy.com
paths:
  /v1/payouts/batches/{batchId}:
    get:
      tags:
        - Payouts
      summary: Consultar lote de payouts
      description: Consulta os detalhes de um lote de payouts.
      operationId: getPayoutBatch
      parameters:
        - schema:
            type: string
          in: path
          name: batchId
          required: true
        - $ref: '#/components/parameters/XClientId'
        - $ref: '#/components/parameters/XClientSecret'
        - $ref: '#/components/parameters/XTurbofyTimestamp'
        - $ref: '#/components/parameters/XTurbofySignature'
      responses:
        '200':
          description: Lote encontrado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayoutBatchDetailsResponse'
        '401':
          description: Credenciais ou assinatura invalidas.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Lote nao encontrado para o merchant autenticado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - clientCredentials: []
          clientSecret: []
components:
  parameters:
    XClientId:
      name: x-client-id
      in: header
      required: true
      schema:
        type: string
      description: Identificador do integrador.
    XClientSecret:
      name: x-client-secret
      in: header
      required: true
      schema:
        type: string
      description: Segredo de autenticacao do integrador.
    XTurbofyTimestamp:
      name: x-turbofy-timestamp
      in: header
      required: true
      schema:
        type: string
      description: Timestamp utilizado na assinatura HMAC.
    XTurbofySignature:
      name: x-turbofy-signature
      in: header
      required: true
      schema:
        type: string
      description: Assinatura HMAC SHA-256 da requisicao.
  schemas:
    PayoutBatchDetailsResponse:
      type: object
      required:
        - id
        - status
        - totalAmountCents
        - totalFeeCents
        - totalItems
        - paidItems
        - failedItems
        - createdAt
        - updatedAt
        - items
      properties:
        id:
          type: string
        status:
          type: string
        totalAmountCents:
          type: integer
        totalFeeCents:
          type: integer
        totalNetCents:
          type: integer
        totalItems:
          type: integer
        paidItems:
          type: integer
        failedItems:
          type: integer
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        items:
          type: array
          items:
            $ref: '#/components/schemas/PayoutBatchItemResponse'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: object
              additionalProperties: true
            traceId:
              type: string
    PayoutBatchItemResponse:
      type: object
      required:
        - id
        - status
        - amountCents
      properties:
        id:
          type: string
        status:
          type: string
        amountCents:
          type: integer
        feeCents:
          type: integer
        netAmountCents:
          type: integer
        recipientName:
          type: string
        pixKeyType:
          type: string
        referenceId:
          type: string
          nullable: true
        lastError:
          type: string
          nullable: true
        lastErrorCode:
          type: string
          nullable: true
        settledAt:
          type: string
          format: date-time
          nullable: true
        releasedAt:
          type: string
          format: date-time
          nullable: true
        rowIndex:
          type: integer
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
  securitySchemes:
    clientCredentials:
      type: apiKey
      in: header
      name: x-client-id
      description: Client ID fornecido pela TurbofyPay.
    clientSecret:
      type: apiKey
      in: header
      name: x-client-secret
      description: Client Secret fornecido pela TurbofyPay.

````