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

# Criar Saque

> Solicita um saque via PIX deduzido do saldo disponível.



## OpenAPI

````yaml POST /withdrawals
openapi: 3.1.0
info:
  title: Pixzy API
  version: 1.0.0
  description: >-
    API do Pixzy para processar pagamentos e saques via PIX de forma
    automatizada. Todos os valores monetários são representados em centavos (R$
    10,00 = 1000).
servers:
  - url: https://app.pixzypay.com/api
    description: Produção
security:
  - bearerAuth: []
paths:
  /withdrawals:
    post:
      tags:
        - Saques
      summary: Criar Saque
      description: >-
        Solicita um saque via PIX. O valor é deduzido do saldo disponível e
        enviado para a chave PIX informada.
      operationId: createWithdrawal
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWithdrawalRequest'
            example:
              amount: 5000
              pix_key: 123.456.789-00
              pix_key_type: cpf
              webhook_url: https://api.loja.com/saque
      responses:
        '201':
          description: Saque solicitado
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Saque solicitado com sucesso.
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        example: 019c7549-a1b2-73f1-9c4e-8a2b3c4d5e6f
                      amount:
                        type: integer
                        example: 5000
                      status:
                        type: string
                        example: pending
                      pix_key_type:
                        type: string
                        example: cpf
                      pix_key:
                        type: string
                        example: 123.456.789-00
                      created_at:
                        type: string
                        format: date-time
                        example: '2025-01-15T14:30:00.000000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationWithdrawal'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/GatewayUnavailable'
components:
  schemas:
    CreateWithdrawalRequest:
      type: object
      required:
        - amount
        - pix_key
        - pix_key_type
      properties:
        amount:
          type: integer
          minimum: 1000
          description: 'Valor em centavos (mínimo: 1000 = R$ 10,00).'
          example: 5000
        pix_key:
          type: string
          description: Chave PIX de destino.
          example: 123.456.789-00
        pix_key_type:
          type: string
          enum:
            - cpf
            - cnpj
            - email
            - phone
            - random
          description: Tipo da chave PIX.
          example: cpf
        webhook_url:
          type: string
          format: uri
          description: URL para receber a notificação do saque.
    GenericError:
      type: object
      properties:
        error:
          type: string
          description: Mensagem de erro.
  responses:
    Unauthorized:
      description: Token ausente ou inválido.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericError'
          example:
            error: Unauthenticated
    Forbidden:
      description: Conta inativa ou sem permissão.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericError'
          example:
            error: Account not active
    ValidationWithdrawal:
      description: Campos obrigatórios faltando ou inválidos (saques).
      content:
        application/json:
          schema:
            type: object
            properties:
              errors:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: string
          example:
            errors:
              amount:
                - O campo amount é obrigatório.
              pix_key:
                - O campo pix_key é obrigatório.
    RateLimited:
      description: Muitas requisições. Aguarde o tempo indicado no header Retry-After.
      headers:
        Retry-After:
          description: Segundos até poder tentar novamente.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericError'
          example:
            error: Too Many Requests
    GatewayUnavailable:
      description: Gateway de pagamento temporariamente indisponível.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericError'
          example:
            error: Service unavailable
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer Token gerado em Configurações > Tokens de API.

````