Skip to content

Instantly share code, notes, and snippets.

@bsilva0x87
Last active December 4, 2025 19:34
Show Gist options
  • Select an option

  • Save bsilva0x87/6deab2a36a2d70aaaeb546c7f32480e8 to your computer and use it in GitHub Desktop.

Select an option

Save bsilva0x87/6deab2a36a2d70aaaeb546c7f32480e8 to your computer and use it in GitHub Desktop.
WS ZAPPYPAG - API Documentation

ZAPPY

PIX Transaction status mapping

  1. PIX (pix in)
Internal Status FitBank Variants Accepted Description
Created Created Receipt credited to receiving account
Registered Registered Transaction registered (intermediate state)
Settled Paid, Settled, Success Transaction completed successfully
Failed Failed, Error Transaction failed
Canceled Canceled, Cancel Transaction canceled
  1. PIX (withdraw | pix out)
Internal Status FitBank Variants Accepted Description
Created Created Transaction created
Registered Registered Transaction registered (intermediate state)
Settled Paid, Settled, Success Transaction completed successfully
Failed Failed, Error Transaction failed
Canceled Canceled, Cancel Transaction canceled
  1. PIX Refund (refund pix in | refund pix out)
Internal Status FitBank Variants Accepted Description
Created Created Refund created
Registering Registering Refund registration in progress
Registered Registered Refund registered
Canceled Cancel, Canceled Refund canceled
Settled Paid, Settled Refund completed
  1. QR Code Status
Internal Status FitBank Value Description
Created Created QR code created
Registering Registering Registration in progress
Processed Processed QR code processed
Settled Settled Payment completed
Error Error Error occurred
Canceled Canceled QR code canceled
Expired Expired QR code expired

Webhook event format

The system normalizes statuses to lowercase for webhook events:

Flow Event Pattern Example Events
PIX In pix.in.{status} pix.in.paid, pix.in.registered, pix.in.failed
PIX Out pix.out.{status} pix.out.paid, pix.out.canceled
Refund In pix.refund.in.{status} pix.refund.in.paid, pix.refund.in.registered
Refund Out pix.refund.out.{status} pix.refund.out.paid, pix.refund.out.canceled

Note: For BFF compatibility, settled is mapped to paid in webhook events.

ZAPPY

WS ZAPPYPAG - API Documentation

ZAPPY is a Banking as a Service (BaaS) platform. It provides a secure, compliant infrastructure for banking operations with a modern REST API interface.

The platform enables:

  • Digital Banking Operations: Account management, transactions, and comprehensive banking services
  • PIX Integration: Brazilian instant payment system with QR code generation, payments, and key management
  • Identity & Access Management: JWT-based authentication and session management
  • Webhook Processing: Event-driven architecture for real-time banking event distribution to customers

Architecture:

  1. IAM Service (Identity and Access Management): User authentication, JWT tokens, session management
  2. BaaS Service (Banking as a Service): Banking API integration, PIX operations, webhook reception and message transformation
  3. Relay Service (Webhook Relay): Distributes webhooks to customers via Pub/Sub (Internal Service - Not documented here)

Platform features:

  • Multi-tenant: Supports multiple customers on shared infrastructure
  • Event-driven: Uses Pub/Sub for asynchronous webhook processing
  • Secure: Defense-in-depth with load balancer, WAF, internal-only serverless services
  • Banking Compliant: Audit logging, data retention, and compliance-ready architecture
  • High Availability: Redundant infrastructure with in-memory caching and relational data storage

The platform provides a modern API interface for banking operations with robust security, scalability, and compliance features.


IAM: Identity and Access Management

The IAM (Identity and Access Management) Service provides authentication and session management for the ZAPPY platform. This service allows you to securely authenticate users, manage access tokens, and maintain user sessions throughout your application. All authentication requests are made through the /iam/v1 endpoint base path.

The service supports standard authentication workflows including user login, logout, and token refresh capabilities. When you successfully authenticate a user, you'll receive both an access token for making authenticated API requests and a refresh token for obtaining new access tokens when they expire. Access tokens are short-lived (15 minutes expiration) for security purposes and should be included in the Authorization header of subsequent API requests to protected endpoints. Refresh tokens are valid for 15 days and can be used to obtain new access tokens without requiring the user to log in again.

For applications using an external session management system, the IAM service provides a BFF (Backend For Frontend) integration endpoint that allows you to exchange your existing session identifiers for ZAPPY access tokens, enabling seamless integration with the platform's banking services.

Authentication

POST /iam/v1/auth/login

Authenticates a user and returns a JWT token and refresh token for subsequent requests. The access_token (JWT has 15 minutes expiration) is used for API requests, while the refresh_token (Hash has 15 days expiration) is used to obtain a new access_token when it expires.

Request:

{
    "username": "string",  // required, email format, min: 3, max: 128
    "password": "string"   // required, min: 8, max: 128
}

Response 200 OK:

{
    "access_token": "string",
    "refresh_token": "string",
    "type": "Bearer",
    "expires_at": 1234567890,
    "user": {
        "id": "string",
        "name": "string",
        "email": "string",
        "roles": ["string"]
    }
}

Response 401 Unauthorized:

{
    "code": 401,
    "message": "user credentials don't match with our records"
}

Refresh Token

POST /iam/v1/auth/refresh

Refreshes the access token using a valid refresh token. When your access token expires, use this endpoint to obtain a new access token without requiring the user to log in again. The refresh token itself will also be rotated for security purposes.

Request:

{
    "refresh_token": "string"  // required
}

Response 200 OK:

{
    "access_token": "string",
    "refresh_token": "string",
    "type": "Bearer",
    "expires_at": "2024-01-01T00:00:00Z",
    "user": {
        "id": "string",
        "name": "string",
        "email": "string",
        "roles": ["string"]
    }
}

Response 401 Unauthorized:

{
    "code": 401,
    "message": "the refresh token is invalid"
}

Logout

POST /iam/v1/auth/logout

Logs out the user by invalidating the refresh token. After calling this endpoint, both the access token and refresh token will no longer be valid, and the user will need to log in again to obtain new tokens.

Request:

{
    "refresh_token": "string"  // required
}

Response 200 OK:

{
    "code": 200,
    "message": "the user session has been successfully logged out"
}

Response 401 Unauthorized:

{
    "code": 401,
    "message": "the refresh token is invalid"
}

BFF Session Integration

POST /iam/v1/bff/session

Creates JWT tokens from an external BFF (Backend For Frontend) session ID. This endpoint enables integration with external session management systems by allowing you to exchange a valid BFF session identifier for ZAPPY access and refresh tokens. The session ID is validated against the external BFF service before tokens are issued.

Request:

{
    "session_id": "string"  // required, max: 255
}

Response 200 OK:

{
    "access_token": "string",
    "refresh_token": "string",
    "type": "Bearer",
    "expires_at": "2024-01-01T00:00:00Z",
    "user": {
        "id": "string",
        "name": "string",
        "email": "string",
        "roles": ["string"]
    }
}

Response 401 Unauthorized:

{
    "error": "invalid_session",
    "message": "Session validation failed",
    "details": {
        "reason": "session invalid or expired"
    }
}

Response 503 Service Unavailable:

{
    "error": "bff_unavailable",
    "message": "BFF service unavailable or endpoint not implemented",
    "details": {
        "error": "string"
    }
}

Create User

POST /iam/v1/users

Creates a new user account in the ZAPPY platform. This endpoint requires JWT authentication and allows you to provision new user accounts with their credentials. The password must meet strong password requirements including a mix of letters, numbers, and special characters.

Authentication Required: Authorization: Bearer <access_token>

Request:

{
    "first_name": "string",  // required, min: 2, max: 128
    "last_name": "string",   // required, min: 2, max: 128
    "email": "string",       // required, email format, max: 240
    "password": "string"     // required, strong password: 8-64 chars, must contain letter, number, and special character
}

Response 201 Created:

{
    "id": "string",
    "first_name": "string",
    "last_name": "string",
    "email": "string"
}

Response 422 Unprocessable Entity:

{
    "code": 422,
    "message": "user already exists"
}

Health Check

GET /iam/health

Returns the health status of the IAM service. This endpoint can be used for monitoring and health checks by load balancers or monitoring systems.

Request: None

Response 200 OK:

{
    "status": "OK",
    "message": "string"
}

Service Information

GET /iam/v1/

Returns basic information about the IAM service including its name, description, and version number.

Request: None

Response 200 OK:

{
    "name": "iam",
    "description": "Identity and Access Management service.",
    "version": "1.0.0"
}

BaaS: Banking as a Service

The BaaS (Banking as a Service) Service provides comprehensive banking operations and instant payment capabilities through the /baas/v1 endpoint base path. This service enables you to perform account management operations such as retrieving account balances, transaction history, and detailed financial reports. All account-specific requests to this service require a valid access token obtained from the IAM service, and the account-specific operations must include the account ID in the request path.

The service offers complete PIX integration, Brazil's instant payment system, allowing you to generate dynamic QR codes for receiving payments, execute withdrawals (outgoing transfers to other banks via PIX or traditional bank transfers), manage PIX keys, and process refunds. PIX operations include real-time transaction tracking, the ability to cancel pending transactions, and comprehensive transaction history queries with flexible filtering options. Each account can have multiple registered PIX keys that enable simplified payment identification and collection.

The BaaS service also provides webhook endpoints for receiving real-time notifications about transaction events. These webhooks notify your application immediately when PIX payments are received, withdrawals are completed, refunds are processed, or PIX key status changes occur. This event-driven architecture ensures your application stays synchronized with all banking activities without the need for constant polling.


Reference Data

The Reference Data endpoints provide access to enumerated types and lookup values used throughout the BaaS API. These public endpoints do not require authentication and return standardized lists of valid values for operation types and transaction subtypes.

Get Operation Types

GET /baas/v1/operation/types

Returns a list of all valid operation types supported by the platform. Operation types categorize the nature of banking operations (e.g., PIX transfers, boleto payments, account operations). Use these values to filter transactions via the operation_type parameter in the Get Account Transactions endpoint.

Authentication Required: None (Public endpoint)

Request: None

Response 200 OK:

[
    {
        "id": 0,
        "name": "Purchase boleto"
    },
    {
        "id": 1,
        "name": "Purchase card"
    },
    {
        "id": 40,
        "name": "Pix out"
    },
    {
        "id": 41,
        "name": "Pix in"
    }
]

Common Operation Types:

  • 0 - Purchase boleto
  • 40 - Pix out (withdrawals)
  • 41 - Pix in (incoming payments)
  • 42 - Refund Pix in
  • 43 - Refund Pix out
  • 44 - QR Code

Note: The complete list includes 44 operation types. Use this endpoint to retrieve all current values.


Get Transaction Subtypes

GET /baas/v1/operation/subtypes

Returns a list of all valid transaction subtypes supported by the platform. Subtypes provide detailed categorization of transactions within each operation type (e.g., "Credit Pix in", "Pre-debit Pix out", "Manual credit"). Each transaction in your account history includes a subtype that describes the specific nature of the banking operation.

Authentication Required: None (Public endpoint)

Request: None

Response 200 OK:

[
    {
        "id": 0,
        "name": "Pre-credit payment of boleto"
    },
    {
        "id": 9,
        "name": "Manual credit"
    },
    {
        "id": 21,
        "name": "Initial balance"
    },
    {
        "id": 22,
        "name": "Final balance"
    },
    {
        "id": 222,
        "name": "Credit Pix in"
    },
    {
        "id": 242,
        "name": "Pre-debit Pix out"
    }
]

Common Subtypes:

  • 9 - Manual credit
  • 20 - Manual debit
  • 21 - Initial balance (filtered by default in transactions)
  • 22 - Final balance (filtered by default in transactions)
  • 222 - Credit Pix in
  • 242 - Pre-debit Pix out
  • 244 - Debit Pix out

Note: The complete list includes 380+ subtypes (IDs 0-379). Use this endpoint to retrieve all current values and their descriptions.


Account Management

Get Account Transactions

POST /baas/v1/account/:id/transactions

Retrieves the transaction history for a specific account within a date range. This endpoint returns paginated transaction data along with current account balance and account details. By default, balance entries (Initial/Final Balance) are filtered out unless the raw parameter is set to true.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)

Request:

{
    "init_date": "2024-01-01",      // required, format: YYYY-MM-DD
    "ends_date": "2024-01-31",      // required, format: YYYY-MM-DD
    "page": 1,                      // required, min: 1
    "limit": 50,                    // required, min: 1, max: 100
    "raw": false,                   // optional, default: false. If true, includes balance entries (subtypes 21, 22)
    "operation_type": 41            // optional, filter by operation type (0-109). Example: 41 = Pix in, 40 = Pix out
}

Response 200 OK:

{
    "data": [
        {
            "id": "1976159309",
            "type": "CreditPixIn",
            "subtype": "Credit Pix in",
            "operation": "Pix in",
            "details": "Crédito Recebimento via Pix John Doe - 12345678901",
            "description": "CreditPixIn",
            "document_number": 245188468,
            "date": "2024-09-18T17:12:34.287",
            "value": 5.00,
            "tags": ["245188468", "6a10967d-b764-46d7-9609-f27279619d10"]
        }
    ],
    "meta": {
        "page": 1,
        "limit": 50,
        "total": 250
    },
    "balance": {
        "total": 1500.00,
        "blocked": 0.00,
        "updated_at": "2024-01-01T12:00:00Z"
    },
    "account": {
        "bank_number": "450",
        "bank_branch": "0001",
        "bank_account": "201953902",
        "bank_account_digit": "2"
    }
}

Important Notes:

  • The data array is always present, even when empty ([])
  • The operation field returns a human-readable string (e.g., "Pix in") instead of an integer
  • The tags array includes the document number as the first element
  • Balance entries (Initial Balance, Final Balance) are excluded by default. Set raw=true to include them
  • Use the /baas/v1/operation/types endpoint to get all valid operation type IDs and names
  • Use the /baas/v1/operation/subtypes endpoint to get all valid subtype IDs and names

Response 404 Not Found:

{
    "code": 404,
    "message": "Account not found"
}

Get Account Balance

GET /baas/v1/account/:id/balance

Retrieves the current balance for a specific account, including total available balance, blocked amounts, and the last update timestamp.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)

Request: None

Response 200 OK:

{
    "balance": 1500.00,
    "blocked": 0.00,
    "updated_at": "2024-01-01T12:00:00Z"
}

Response 404 Not Found:

{
    "code": 404,
    "message": "Account not found"
}

Generate Account Report

POST /baas/v1/account/:id/report

Generates a detailed account balance report for a specific date range. The report is generated asynchronously and will be sent to the provided email address once processing is complete. This is useful for generating monthly statements or financial reports.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)

Request:

{
    "init_date": "2024-01-01",  // required, format: YYYY-MM-DD
    "ends_date": "2024-01-31",  // required, format: YYYY-MM-DD
    "email": "string"           // required, email format
}

Response 202 Accepted:

{
    "message": "Your account report request has been received and is being processed. You will receive the report file at the provided email address shortly.",
    "status": "processing",
    "updated_at": "2024-01-01T12:00:00Z"
}

Response 404 Not Found:

{
    "code": 404,
    "message": "Account not found"
}

PIX QR Code Operations

Generate PIX QR Code

POST /baas/v1/account/:id/pix/qrcode

Generates a dynamic PIX QR code for receiving payments. The QR code can be configured with a specific value, expiration date, and payer information. Once generated, the QR code can be presented to customers who can scan it with their banking app to complete the payment. The account must have at least one registered PIX key to generate QR codes.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)

Request:

{
    "reference": "string",      // required, unique identifier for this QR code
    "payer": {
        "tax_number": "string", // required, CPF (11 digits) or CNPJ (14 digits) format
        "name": "string",       // required, payer name
        "message": "string"     // optional, message to payer
    },
    "value": 100.50,            // required, min: 1, max: 999999
    "expires_at": "2024-01-01 15:30", // optional, format: YYYY-MM-DD HH:MM (America/Sao_Paulo timezone), default: now + 15 minutes
    "data": {}                  // optional, additional metadata as key-value pairs
}

Response 200 OK:

{
    "reference": "string",
    "payer": {
        "tax_number": "string",
        "name": "string",
        "message": "string"
    },
    "value": 100.50,
    "expires_at": "2024-01-01 15:30",
    "qr_code": "string",
    "base64": "string",
    "document_number": 123456,
    "conciliation_id": "string"
}

Response 422 Unprocessable Entity:

{
    "code": 422,
    "message": "No PIX key registered for this account"
}

Get PIX QR Code

GET /baas/v1/account/:id/pix/qrcode/:reference

Retrieves detailed information about a previously generated PIX QR code using its reference identifier. This includes the QR code hash, payer and receiver information, location details, status, and expiration date.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)
  • reference - QR code reference identifier (required)

Request: None

Response 200 OK:

{
    "reference": "string",
    "type": "dynamic",
    "key": "string",
    "payer": {
        "name": "string",
        "tax_number": "string",
        "message": "string"
    },
    "receiver": {
        "name": "string",
        "tax_number": "string"
    },
    "location": {
        "city": "string",
        "zip_code": "string"
    },
    "qrcode": {
        "hash": "string"
    },
    "reusable": false,
    "expires_at": "2024-01-01T15:30:00Z",
    "value": 100.50,
    "status": "string",
    "created_at": "2024-01-01T12:00:00Z"
}

Response 404 Not Found:

{
    "code": 404,
    "message": "The qrcode reference 'string' not found or expired."
}

Cancel PIX QR Code

DELETE /baas/v1/account/:id/pix/qrcode/:reference

Cancels a previously generated PIX QR code by its reference identifier. Once canceled, the QR code can no longer be used to receive payments. This is useful when you need to invalidate a QR code before its expiration date.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)
  • reference - QR code reference identifier (required)

Request: None

Response 200 OK:

{
    "reference": "string",
    "document_number": 123456,
    "conciliation_id": "string",
    "status": "canceled",
    "canceled_at": "2024-01-01T12:00:00Z"
}

Response 404 Not Found:

{
    "code": 404,
    "message": "The qrcode reference 'string' not found or expired."
}

PIX Transactions

Get PIX Transactions

POST /baas/v1/account/:id/pix/transactions

Retrieves the history of incoming PIX payments (PIX In) for a specific account within a date range. This endpoint returns paginated transaction data including payer information, QR code details, end-to-end IDs, and payment status.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)

Request:

{
    "init_date": "2024-01-01",  // required, format: YYYY-MM-DD, length: 10
    "ends_date": "2024-01-31",  // required, format: YYYY-MM-DD, length: 10
    "page": 0,                  // required, min: 0
    "limit": 50                 // required, min: 1, max: 100
}

Response 200 OK:

{
    "data": [
        {
            "document_number": "string",
            "e2e_id": "string",
            "origin": {
                "name": "string",
                "tax_number": "string",
                "bank_account": "string",
                "bank_account_digit": "string",
                "bank_branch": "string",
                "bank_number": "string",
                "ispb": "string",
                "spb": "string"
            },
            "destination": {
                "bank_account": "string",
                "bank_account_digit": "string",
                "bank_branch": "string",
                "bank_number": "string",
                "ispb": "string",
                "spb": "string"
            },
            "payer": {
                "name": "string",
                "tax_number": "string",
                "message": "string"
            },
            "qrcode": {
                "type": "string",
                "document_number": "string",
                "conciliation_id": "string"
            },
            "paid_at": "2024-01-01T12:00:00Z",
            "status": "string",
            "value": 100.50
        }
    ],
    "meta": {
        "page": 0,
        "limit": 50,
        "total": 100
    }
}

Response 404 Not Found:

{
    "code": 404,
    "message": "Account not found"
}

Refund PIX In

POST /baas/v1/account/:id/pix/refund

Processes a refund for a previously received PIX payment. You can refund the full or partial amount of the original transaction. The refund is processed immediately and the funds are returned to the payer's account.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)

Request:

{
    "reference": "string",      // required, unique refund reference
    "document_number": 123456,  // required, original transaction document number
    "value": 100.50,            // required, min: 1, refund amount
    "message": "string"         // optional, refund reason/message
}

Response 200 OK:

{
    "reference": "string",
    "document_number": 123456,
    "value": 100.50,
    "status": "approved",
    "refunded_at": "2024-01-01T12:00:00Z"
}

Response 404 Not Found:

{
    "code": 404,
    "message": "Account not found"
}

Get PIX Refunds

POST /baas/v1/account/:id/pix/refunds

Retrieves the history of PIX refund transactions for a specific account within a date range. This includes both refunds you've processed (outgoing) and refunds you've received (incoming).

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)

Request:

{
    "init_date": "2024-01-01",  // required, format: YYYY-MM-DD, length: 10
    "ends_date": "2024-01-31",  // required, format: YYYY-MM-DD, length: 10
    "page": 1,                  // required, min: 1
    "limit": 50                 // required, min: 1, max: 100
}

Response 200 OK:

{
    "data": [
        {
            "reference": "string",
            "document_number": "string",
            "e2e_id": "string",
            "origin": {
                "bank_account": "string",
                "bank_account_digit": "string",
                "bank_branch": "string",
                "bank_number": "string",
                "ispb": "string",
                "spb": "string"
            },
            "destination": {
                "bank_account": "string",
                "bank_account_digit": "string",
                "bank_branch": "string",
                "bank_number": "string",
                "ispb": "string",
                "spb": "string"
            },
            "reason": "string",
            "refund_date": "2024-01-01T12:00:00Z",
            "message": "string",
            "status": "string",
            "value": 100.50
        }
    ],
    "meta": {
        "page": 1,
        "limit": 50,
        "total": 10
    }
}

Response 400 Bad Request:

{
    "code": 400,
    "message": "The ends_date must be greater than or equal to init_date"
}

Get PIX Refund

GET /baas/v1/account/:id/pix/refund/:reference

Retrieves detailed information about a specific PIX refund transaction using its reference identifier.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)
  • reference - Refund reference identifier (required)

Request: None

Response 200 OK:

{
    "reference": "string",
    "document_number": "string",
    "e2e_id": "string",
    "origin": {
        "bank_account": "string",
        "bank_account_digit": "string",
        "bank_branch": "string",
        "bank_number": "string",
        "ispb": "string",
        "spb": "string"
    },
    "destination": {
        "bank_account": "string",
        "bank_account_digit": "string",
        "bank_branch": "string",
        "bank_number": "string",
        "ispb": "string",
        "spb": "string"
    },
    "reason": "string",
    "refund_date": "2024-01-01T12:00:00Z",
    "message": "string",
    "status": "string",
    "value": 100.50
}

Response 404 Not Found:

{
    "code": 404,
    "message": "The refund reference 'string' not found."
}

Webhook Configuration for PIX In Transactions:

To receive real-time notifications for PIX In payments and refunds, configure your account to listen to these webhook event types:

  • pix.in.paid - Incoming PIX payment settled
  • pix.refund.in.paid - Incoming refund completed
  • pix.refund.in.canceled - Incoming refund canceled

See the Webhooks section for complete documentation on webhook configuration, authentication, and payload examples.


PIX Key Management

Supported PIX Key Types

The ZAPPY platform supports the following PIX key types as defined by the Brazilian Central Bank. Each account can register multiple PIX keys to facilitate payment reception.

Accepted Key Types:

Type Description Format Example
SocialSecurity Brazilian CPF (Individual Taxpayer ID) 12345678901 (11 digits)
TaxNumber Brazilian CNPJ (Corporate Taxpayer ID) 12345678000199 (14 digits)
Email Email address user@example.com
PhoneNumber Phone number with country code +5511999999999
RandomKeyCode Random UUID key generated by the system 123e4567-e89b-12d3-a456-426614174000

Important Notes:

  • These key type values are case-sensitive and must be used exactly as shown above
  • SocialSecurity corresponds to CPF (Cadastro de Pessoas Físicas)
  • TaxNumber corresponds to CNPJ (Cadastro Nacional da Pessoa Jurídica)
  • Each PIX key must be unique across the entire PIX ecosystem
  • Keys must be validated and registered with the Brazilian Central Bank before they can be used

Get PIX Keys

GET /baas/v1/account/:id/pix/keys

Retrieves all PIX keys registered for a specific account. PIX keys are identifiers that can be used to receive payments without sharing bank account details. Supported key types include CPF/CNPJ (SocialSecurity/TaxNumber), email, phone number, and random keys.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)

Request: None

Response 200 OK:

{
    "data": [
        {
            "id": "019a3252-3bd5-73c0-b1d9-c490939e0709",
            "type": "string",
            "key": "string",
            "status": "string",
            "updated_at": "2024-01-01T12:00:00Z"
        }
    ],
    "meta": {
        "total": 2
    }
}

Response 404 Not Found:

{
    "code": 404,
    "message": "Account not found"
}

Get PIX Key Status

GET /baas/v1/account/:id/pix/key/:keyId

Retrieves the current status of a specific PIX key. PIX keys can have various statuses during their lifecycle including "registering", "registered", "canceling", and "canceled".

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)
  • keyId - PIX key identifier (required)

Request: None

Response 200 OK:

{
    "id": "019a3252-3bd5-73c0-b1d9-c490939e0709",
    "type": "string",
    "key": "string",
    "status": "string",
    "updated_at": "2024-01-01T12:00:00Z"
}

Response 400 Bad Request:

{
    "code": 400,
    "message": "Missing PIX key ID"
}

Get PIX Key Info

GET /baas/v1/account/:id/pix/key/:keyId/info

Retrieves detailed information about a PIX key including the receiver's bank details, name, and tax identification number. This information is retrieved from the Brazilian Central Bank's PIX key directory.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)
  • keyId - PIX key identifier (required)

Request: None

Response 200 OK:

{
    "search_protocol": 123456,
    "type": "string",
    "key": "string",
    "receiver": {
        "bank_name": "string",
        "name": "string",
        "ispb": "string",
        "bank": "string",
        "bank_branch": "string",
        "bank_account": "string",
        "bank_account_digit": "string",
        "tax_number": "string"
    },
    "updated_at": "2024-01-01T12:00:00Z"
}

Response 404 Not Found:

{
    "code": 404,
    "message": "PIX key not found"
}

Cancel PIX Key

DELETE /baas/v1/account/:id/pix/key/:keyId

Cancels a PIX key registration. Once canceled, the key can no longer be used to receive payments. The cancellation process may take some time to be confirmed by the Brazilian Central Bank's PIX infrastructure.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)
  • keyId - PIX key identifier (required)

Request: None

Response 200 OK:

{
    "type": "string",
    "key": "string",
    "status": "canceled",
    "canceled_at": "2024-01-01T12:00:00Z"
}

Response 404 Not Found:

{
    "code": 404,
    "message": "PIX key not found"
}

Withdrawals (PIX Out & Bank Transfers)

Status Information

Withdrawal transactions progress through different statuses during their lifecycle. Understanding these statuses is essential for tracking transaction processing and handling webhook notifications.

Possible Statuses:

  • Created: Transaction has been initiated and will be processed
  • Registered: Intermediate state - Transaction was registered in the SPI (Brazilian Instant Payment System) but not yet settled. This is not a final state.
  • Paid / Settled: Final state - Transaction settled successfully
  • Canceled: Final state - Transaction canceled

Important Notes:

  • Intermediate vs Final States: Registered is an intermediate processing state, not a completion status. Transactions in Registered state are still being processed. Only Paid/Settled and Canceled are final states indicating transaction completion.

  • Webhook Behavior: Only final states (Paid and Canceled) are sent via webhooks. You will not receive webhook notifications for intermediate states like Registered or Created.

  • Status Normalization: All status values in webhooks are normalized to lowercase (e.g., paid, canceled). The system automatically handles variations in status naming from the payment processor.

Webhook vs API Naming Differences:

While both webhooks and APIs report transaction statuses, there are key naming differences to be aware of:

  • Paid status in webhooks corresponds to Settled status in API responses (both indicate successful PIX payment settlement)
  • Canceled status in webhooks may appear as Cancel in some raw responses but is always normalized to canceled

Scheduled PixOut Behavior:

When a PixOut operation is scheduled for a future date, the transaction follows a specific workflow:

  1. Transaction is stored with Created status immediately upon creation
  2. No webhook notification is received at creation time
  3. You must use the Get Withdrawal endpoint to query the transaction status during the waiting period
  4. When the scheduled payment date arrives, the transaction is processed and a webhook with Paid status is sent

Note: To monitor scheduled withdrawals, implement regular polling using the Get Withdrawal endpoint or wait for the webhook notification when the scheduled date is reached.


Withdraw

POST /baas/v1/account/:id/withdraw

Initiates a withdrawal from the account to an external destination. Withdrawals can be made via PIX (instant transfer) or traditional bank transfer. For PIX withdrawals, you can specify a PIX key as the destination. For bank transfers, you must provide complete bank account details. The withdrawal will be processed according to the specified date.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)

Request (Bank Account Method):

{
    "method": "bank_account",           // required, values: "bank_account" or "pix"
    "reference": "string",              // required, unique reference identifier
    "destination": {
        "name": "string",               // required, receiver name
        "tax_number": "string"          // required, CPF (11 digits) or CNPJ (14 digits)
    },
    "bank_account": {
        "type": "Current",              // required, values: Current, Salary, Saving, or Payment
        "bank_number": "string",        // required, 3-digit bank code
        "bank_branch": "string",        // required, branch number
        "bank_account": "string",       // required, account number
        "bank_account_digit": "string"  // required, account check digit
    },
    "description": "string",            // optional, max: 1024 characters
    "message": "string",                // optional, max: 1024 characters
    "date": "2024-01-01",              // required, format: YYYY-MM-DD, length: 10
    "value": 100.50                     // required, must be greater than 0
}

Request (PIX Method):

{
    "method": "pix",
    "reference": "string",
    "destination": {
        "name": "string",
        "tax_number": "string"
    },
    "pix": {
        "type": "Email",                // required, values: SocialSecurity, TaxNumber, Email, PhoneNumber, RandomKeyCode
        "key": "string",                // required, PIX key value
        "account_type": "current"       // optional, values: current, salary, saving, payment
    },
    "description": "string",
    "message": "string",
    "date": "2024-01-01",
    "value": 100.50
}

PIX Account Type Values

The account_type field specifies the destination bank account type. If not provided, the system will attempt to use the account type from the PIX key lookup, or default to current.

Value Description
current Current account (Conta Corrente)
salary Salary account (Conta Salário)
saving Savings account (Conta Poupança)
payment Payment account (Conta de Pagamento)

Important: Destination Tax Number for PIX Transfers

The destination.tax_number field is critical for PIX withdrawals using Email, PhoneNumber, or RandomKeyCode key types. Since these PIX key types don't directly contain the receiver's CPF/CNPJ, the system uses the destination.tax_number you provide as the receiver's tax identification.

  • For SocialSecurity or TaxNumber PIX keys: The PIX key itself is the tax number
  • For Email, PhoneNumber, or RandomKeyCode PIX keys: The destination.tax_number is used

Always ensure destination.tax_number contains the unmasked, valid CPF or CNPJ of the payment receiver.

Response 200 OK:

{
    "reference": "string",
    "method": "string",
    "value": 100.50,
    "document_number": 123456,
    "status": "string",
    "updated_at": "2024-01-01T12:00:00Z"
}

Response 400 Bad Request:

{
    "code": 400,
    "message": "Validation failed",
    "details": {
        "errors": "Bank account details are required when method is 'bank_account'; Bank number is required for bank account transfers"
    }
}

Get Withdrawal

GET /baas/v1/account/:id/withdraw/:reference

Retrieves detailed information about a specific withdrawal transaction using its reference identifier. This includes the origin and destination bank details, end-to-end ID (for PIX), payment date, and current status.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)
  • reference - Withdrawal reference identifier (required)

Request: None

Response 200 OK:

{
    "reference": "string",
    "document_number": 123456,
    "e2e_id": "string",
    "origin": {
        "bank_account": "string",
        "bank_account_digit": "string",
        "bank_branch": "string",
        "bank_number": "string",
        "ispb": "string",
        "spb": "string"
    },
    "destination": {
        "bank_account": "string",
        "bank_account_digit": "string",
        "bank_branch": "string",
        "bank_number": "string",
        "ispb": "string",
        "spb": "string"
    },
    "payment_date": "2024-01-01T12:00:00Z",
    "status": "string"
}

Response 404 Not Found:

{
    "code": 404,
    "message": "The withdrawal reference 'string' not found."
}

Get Withdrawals

POST /baas/v1/account/:id/withdraws

Retrieves a paginated list of withdrawal transactions for a specific account within a date range. This includes both PIX transfers and traditional bank transfers.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)

Request:

{
    "init_date": "2024-01-01",  // required, format: YYYY-MM-DD, length: 10
    "ends_date": "2024-01-31",  // required, format: YYYY-MM-DD, length: 10
    "page": 1,                  // required, min: 1
    "limit": 50                 // required, min: 1, max: 100
}

Response 200 OK:

{
    "data": [
        {
            "reference": "string",
            "document_number": 123456,
            "e2e_id": "string",
            "origin": {
                "bank_account": "string",
                "bank_account_digit": "string",
                "bank_branch": "string",
                "bank_number": "string",
                "ispb": "string",
                "spb": "string"
            },
            "destination": {
                "bank_account": "string",
                "bank_account_digit": "string",
                "bank_branch": "string",
                "bank_number": "string",
                "ispb": "string",
                "spb": "string"
            },
            "payment_date": "2024-01-01T12:00:00Z",
            "status": "string",
            "value": 100.50
        }
    ],
    "meta": {
        "page": 1,
        "limit": 50,
        "total": 5
    }
}

Response 404 Not Found:

{
    "code": 404,
    "message": "Account not found"
}

Cancel Withdrawal

DELETE /baas/v1/account/:id/withdraw/:reference

Cancels a pending withdrawal transaction by its reference identifier. Only withdrawals that have not yet been processed can be canceled. Once a withdrawal is confirmed or completed, it cannot be canceled.

Authentication Required: Authorization: Bearer <access_token>

Path Parameters:

  • id - Account UUID (required)
  • reference - Withdrawal reference identifier (required)

Request: None

Response 200 OK:

{
    "reference": "string",
    "document_number": 123456,
    "status": "canceled",
    "canceled_at": "2024-01-01T12:00:00Z"
}

Response 422 Unprocessable Entity:

{
    "code": 422,
    "message": "Failed to cancel withdrawal"
}

Webhook Configuration for Withdrawals

To receive real-time notifications about withdrawal transaction events, your account must be configured to listen to the following webhook event types:

PIX Out Withdrawal Events:

  • pix.out.paid - Sent when withdrawal is paid/settled
  • pix.out.canceled - Sent when withdrawal is canceled

Configuration:

Use your BFF (Backend For Frontend) webhook settings to subscribe to these event types. You can subscribe to individual events or use wildcard patterns for broader coverage:

  • pix.out.* - Receive all PIX Out events
  • pix.out.paid - Receive only paid/settled notifications
  • pix.out.canceled - Receive only cancellation notifications

Important: Webhook notifications only include Paid and Canceled statuses. Other statuses (Created, Registered) are only available through API queries. Remember that Paid in webhooks corresponds to Settled in API responses.

Related Documentation:

  • See the Webhooks section for complete webhook documentation, payload examples, authentication methods, and retry policies
  • See the PIX Out Webhook Events section for detailed payload structure

Webhooks

The ZAPPY platform sends real-time webhook notifications to your configured endpoints when banking events occur. These webhooks enable your application to react immediately to PIX payments, withdrawals, refunds, and PIX key status changes without polling our APIs.

Overview

How It Works:

  1. Banking events occur (e.g., PIX payment received, withdrawal completed)
  2. ZAPPY transforms the event to a clean, consistent format
  3. Event is published to Google Cloud Pub/Sub for reliable delivery
  4. Your configured webhook endpoint receives the notification
  5. Automatic retries with exponential backoff on failures

Key Features:

  • Reliable Delivery: Google Cloud Pub/Sub with automatic retries
  • Event Filtering: Subscribe to specific event types using wildcards (e.g., pix.in.*)
  • Idempotency: 5-minute deduplication window prevents duplicate processing
  • Correlation IDs: Track events across distributed systems
  • Dead Letter Queue: Failed deliveries are logged for investigation

Authentication

Webhooks are authenticated using one of two methods configured in your BFF webhook settings:

Basic Authentication:

Authorization: Basic base64(username:password)

Bearer Token:

Authorization: Bearer {your-token}

Common Headers

All webhook requests include these headers:

Content-Type: application/json
Accept: application/json
User-Agent: ZAPPY-RELAY/1.0

Event Types and Filtering

You can subscribe to specific event types using flexible pattern matching:

Pattern Description Example Events Matched
* All events All PIX In, PIX Out, Refunds, Keys
pix.in.* All PIX In events pix.in.paid, pix.in.registered, etc.
pix.out.* All PIX Out events pix.out.paid, pix.out.completed, etc.
pix.*.paid All paid events pix.in.paid, pix.out.paid
pix.refund.in.* All PIX In refunds pix.refund.in.paid, pix.refund.in.canceled
pix.key.* All PIX Key events pix.key.created, pix.key.registered, etc.
pix.in.paid Exact match Only pix.in.paid

PIX In Webhook Events

Sent when PIX payments are received in your accounts.

Event Types:

  • pix.in.paid - Payment received and settled
  • pix.in.registered - Payment registered
  • pix.in.canceled - Payment canceled
  • pix.in.error - Payment error

Payload Example:

{
  "id": 123456,
  "document_number": 3573432,
  "end_to_end_id": "E12345678202401011200abcdef123456",
  "origin": {
    "name": "John Doe",
    "identifier": "12345678901",
    "bank": "001",
    "bank_branch": "0001",
    "bank_account": "12345",
    "bank_account_digit": "6",
    "ispb": "00000000",
    "spb": "001"
  },
  "destination": {
    "name": "Your Account Name",
    "identifier": "98765432100",
    "bank": "450",
    "bank_branch": "0001",
    "bank_account": "67890",
    "bank_account_digit": "1",
    "ispb": "00000000",
    "spb": "450",
    "pix_key": "customer@example.com"
  },
  "qrcode": {
    "id": "unique-qrcode-id",
    "type": "dynamic",
    "document_number": 3573432,
    "reference": "your-reference-123",
    "payer": {
      "name": "John Doe",
      "identifier": "12345678901"
    },
    "value": {
      "principal": 100.00,
      "rebate": 0.00,
      "discount": 5.00,
      "interest": 0.00,
      "fine": 0.00
    }
  },
  "receipt_url": "https://fitbank.com/receipt/123456",
  "value": 100.00,
  "status": "paid",
  "tags": ["account_id=your-account-uuid"],
  "message": "Payment for order #123",
  "transfer_date": "2024-01-01",
  "initiation_type": "DICT"
}

PIX Out Webhook Events

Sent when PIX withdrawals are processed from your accounts.

Event Types:

  • pix.out.paid - Withdrawal completed successfully (final state)
  • pix.out.canceled - Withdrawal canceled (final state)

Note: Only final transaction states trigger webhook notifications. Intermediate processing states (such as registration or validation) do not generate webhook events.

Payload Example:

{
  "document_number": 123456,
  "reference": "your-withdrawal-ref-456",
  "end_to_end_id": "E12345678202401011200xyz789",
  "origin": {
    "name": "Your Account Name",
    "identifier": "98765432100",
    "bank": "450",
    "bank_branch": "0001",
    "bank_account": "67890",
    "bank_account_digit": "1",
    "ispb": "00000000",
    "spb": "450"
  },
  "destination": {
    "name": "Jane Smith",
    "identifier": "11122233344",
    "bank": "001",
    "bank_branch": "0002",
    "bank_account": "54321",
    "bank_account_digit": "9",
    "ispb": "00000000",
    "spb": "001",
    "pix_key": "jane@example.com"
  },
  "receipt_url": "https://fitbank.com/receipt/456",
  "value": 250.50,
  "status": "paid",
  "tags": ["account_id=your-account-uuid"],
  "payment_date": "2024-01-01T14:30:00Z"
}

PIX Refund Webhook Events

Sent when refunds are processed (both incoming and outgoing).

Event Types:

  • pix.refund.in.paid - Refund of incoming PIX completed
  • pix.refund.in.canceled - Refund canceled
  • pix.refund.out.paid - Refund of outgoing PIX received
  • pix.refund.out.canceled - Refund canceled

Payload: Similar to PIX In/Out payloads with additional refund-specific fields:

{
  "refund_date": "2024-01-02",
  "refund_code": "RF123",
  "initiation_e2e_id": "E12345678202401011200original",
  "initiation_document_number": "3573431",
  "method": "REFUND",
  "error": {
    "code": "ERR001",
    "description": "Error description"
  },
  "rate_value": 1.50
}

PIX Key Webhook Events

Sent when PIX key registration status changes.

Event Types:

  • pix.key.created - PIX key created
  • pix.key.registered - PIX key successfully registered with Central Bank
  • pix.key.status.updated - PIX key status changed
  • pix.key.changed - PIX key ownership changed
  • pix.key.canceled - PIX key canceled
  • pix.key.claiming - PIX key claim initiated
  • Additional claim-related events

Payload Example:

{
  "document_number": 3573432,
  "type": "Email",
  "key": "customer@example.com",
  "action": "pix.key.registered",
  "method": "CreatePixKey",
  "status": "registered",
  "business_unit_id": 1234
}

Webhook Response

Your endpoint must respond with a 2xx status code to acknowledge receipt:

Success Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "success": true,
  "message": "Webhook received"
}

Important:

  • Respond within 30 seconds to avoid timeouts
  • Return 2xx for successful processing
  • Return 5xx to trigger automatic retries
  • Return 4xx for permanent failures (no retries)

Retry Policy

Automatic Retries:

  • Triggered on 5xx responses or network errors
  • Exponential backoff strategy
  • Managed by Google Cloud Pub/Sub
  • Maximum retry duration configurable

Dead Letter Queue: Failed deliveries are sent to a dead letter queue with detailed information:

{
  "original_event_type": "pix.in.paid",
  "account_id": "your-account-uuid",
  "webhook_url": "https://your-app.com/webhook",
  "failure_reason": "webhook returned non-2xx status: 500",
  "attempts": 1,
  "last_error": "connection timeout",
  "failed_at": "2024-01-01T12:00:00Z",
  "correlation_id": "correlation-uuid",
  "payload": "{...webhook payload...}"
}

Best Practices

  1. Idempotency: Use end_to_end_id or document_number to prevent duplicate processing
  2. Async Processing: Acknowledge receipt immediately (200 OK), process asynchronously
  3. Correlation IDs: Use for distributed tracing and debugging
  4. Secure Endpoints: Use HTTPS with valid SSL certificates
  5. Monitor Failures: Check dead letter queue for failed deliveries
  6. Timeout Handling: Respond within 30 seconds maximum

Health Check

GET /baas/health

Returns the health status of the BaaS service. This endpoint can be used for monitoring and health checks by load balancers or monitoring systems.

Request: None

Response 200 OK:

{
    "status": "OK",
    "message": "string"
}

Service Information

GET /baas/v1/

Returns basic information about the BaaS service including its name, description, and version number.

Request: None

Response 200 OK:

{
    "name": "baas",
    "description": "Banking as a Service integration service.",
    "version": "1.0.0"
}

Common Error Responses

All endpoints may return the following error responses in addition to their specific error scenarios:

400 Bad Request

Returned when request validation fails or required parameters are missing/invalid.

{
    "code": 400,
    "message": "Validation failed",
    "details": {
        "errors": "string"
    }
}

401 Unauthorized

Returned when authentication fails or the access token is invalid/expired.

{
    "code": 401,
    "message": "string"
}

404 Not Found

Returned when the requested resource or route is not found.

{
    "code": 404,
    "message": "The resource route was not found."
}

422 Unprocessable Entity

Returned when the request is valid but cannot be processed due to business logic constraints.

{
    "code": 422,
    "message": "string"
}

500 Internal Server Error

Returned when an unexpected server error occurs.

{
    "code": 500,
    "message": "internal server error"
}

Authentication Guide

Getting Started

  1. Login: Call POST /iam/v1/auth/login with your credentials to obtain an access token and refresh token.

  2. Using Access Tokens: Include the access token in the Authorization header of all protected endpoint requests:

    Authorization: Bearer <access_token>
    
  3. Token Expiration: Access tokens expire after 15 minutes. When an access token expires, use the refresh token to obtain a new one.

  4. Refreshing Tokens: Call POST /iam/v1/auth/refresh with your refresh token to get a new access token. Refresh tokens are valid for 15 days.

  5. Logout: Call POST /iam/v1/auth/logout with your refresh token to invalidate all tokens and end the session.

BFF Integration

If you have an external session management system, you can use the BFF integration endpoint to obtain ZAPPY tokens:

  1. Call POST /iam/v1/bff/session with your BFF session ID
  2. Receive ZAPPY access and refresh tokens
  3. Use these tokens for subsequent BaaS API calls

Date and Time Formats

  • Date: YYYY-MM-DD (e.g., "2024-01-01")
  • DateTime: YYYY-MM-DD HH:mm (e.g., "2024-01-01 15:30") for input
  • ISO 8601: YYYY-MM-DDTHH:mm:ssZ (e.g., "2024-01-01T15:30:00Z") for responses

Pagination

List endpoints that return paginated results include a meta object in the response:

{
    "data": [...],
    "meta": {
        "page": 1,
        "limit": 50,
        "total": 250
    }
}
  • page: Current page number
  • limit: Number of items per page
  • total: Total number of items available

Support

For technical support or questions about the ZAPPY API, please contact your account manager or refer to the platform documentation.

ZAPPY

WS ZAPPYPAG - API Error Codes

Complete reference of all error codes with their default messages and HTTP status mappings.

Format

  • Code: ZPY.<CATEGORY>.<NUMBER>
  • Category: Max 3 characters
  • Number: 3-digit numeric code

AUT - Authentication & Authorization

Code Constant Message HTTP Status
ZPY.AUT.001 CodeAutMissingToken Authorization token is required 401
ZPY.AUT.002 CodeAutInvalidFormat Invalid authorization token format 401
ZPY.AUT.003 CodeAutTokenExpired The authentication token has expired 401
ZPY.AUT.004 CodeAutTokenNotYetValid The authentication token is not yet valid 401
ZPY.AUT.005 CodeAutInvalidSignature Invalid token signature 401
ZPY.AUT.006 CodeAutInvalidCreds Invalid username or password 401
ZPY.AUT.007 CodeAutInvalidRefresh Invalid or expired refresh token 401
ZPY.AUT.008 CodeAutSessionFailed Session validation failed 401
ZPY.AUT.009 CodeAutInvalidScheme Invalid authorization scheme 401
ZPY.AUT.010 CodeAutUnauthorized You are not authorized to access this resource 401

VAL - Validation

Code Constant Message HTTP Status
ZPY.VAL.001 CodeValRequired One or more required fields are missing 400
ZPY.VAL.002 CodeValInvalidEmail Invalid email address format 400
ZPY.VAL.003 CodeValInvalidPass Password must be 8-64 characters with at least one letter, number, and special character 400
ZPY.VAL.004 CodeValLength Field length does not meet requirements 400
ZPY.VAL.005 CodeValInvalidEnum Invalid value provided for field 400
ZPY.VAL.006 CodeValInvalidUUID Invalid UUID format 400
ZPY.VAL.007 CodeValInvalidDate Invalid date format 400
ZPY.VAL.008 CodeValInvalidRange Invalid date range provided 400
ZPY.VAL.009 CodeValInvalidNumeric Invalid numeric value 400
ZPY.VAL.010 CodeValInvalidZip Invalid ZIP code format (must be 8 digits) 400
ZPY.VAL.011 CodeValInvalidPayload Request payload is malformed or invalid 400

ACC - Account Management

Code Constant Message HTTP Status
ZPY.ACC.001 CodeAccNotFound Account not found 404
ZPY.ACC.002 CodeAccNotActive Account is not active 400
ZPY.ACC.003 CodeAccNotVerified Account is not verified 400
ZPY.ACC.004 CodeAccInvalidStatus Account status is invalid for this operation 400
ZPY.ACC.005 CodeAccFetchFailed Failed to retrieve account information 502
ZPY.ACC.006 CodeAccBalanceFailed Failed to retrieve account balance 502
ZPY.ACC.007 CodeAccTransactionFailed Failed to retrieve account transactions 502

USR - User Management

Code Constant Message HTTP Status
ZPY.USR.001 CodeUsrNotFound User not found 404
ZPY.USR.002 CodeUsrAlreadyExists A user with this email already exists 409
ZPY.USR.003 CodeUsrCreateFailed Failed to create user 500
ZPY.USR.004 CodeUsrUpdateFailed Failed to update user 500

PIX - PIX Operations

Code Constant Message HTTP Status
ZPY.PIX.001 CodePixKeyNotRegistered No PIX key registered for this account 400
ZPY.PIX.002 CodePixKeyNotFound PIX key not found 404
ZPY.PIX.003 CodePixInvalidKeyType Invalid PIX key type 400
ZPY.PIX.004 CodePixQRCreateFailed Failed to generate PIX QR code 502
ZPY.PIX.005 CodePixQRNotFound QR code not found or has expired 404
ZPY.PIX.006 CodePixQRCancelFailed Failed to cancel QR code 502
ZPY.PIX.007 CodePixTxFetchFailed Failed to retrieve PIX transactions 502
ZPY.PIX.008 CodePixRefundFailed Failed to process PIX refund 502
ZPY.PIX.009 CodePixRefundNotFound Refund transaction not found 404
ZPY.PIX.010 CodePixWithdrawFailed Failed to process withdrawal 502
ZPY.PIX.011 CodePixWithdrawNotFound Withdrawal transaction not found 404
ZPY.PIX.012 CodePixInvalidMethod Invalid payment method 400
ZPY.PIX.013 CodePixMissingBankInfo Bank account information is required for this payment method 400
ZPY.PIX.014 CodePixMissingKeyInfo PIX key information is required for this payment method 400
ZPY.PIX.015 CodePixKeyStatusFailed Failed to retrieve PIX key status 502
ZPY.PIX.016 CodePixKeyCancelFailed Failed to cancel PIX key 502

BNK - FitBank Integration

Code Constant Message HTTP Status
ZPY.BNK.001 CodeBnkUnavailable Banking service is temporarily unavailable 503
ZPY.BNK.002 CodeBnkRequestFailed Banking service request failed 502
ZPY.BNK.003 CodeBnkReturnedError Banking service returned an error 502
ZPY.BNK.004 CodeBnkParseFailed Failed to process banking service response 502
ZPY.BNK.005 CodeBnkTimeout Banking service request timed out 502
ZPY.BNK.006 CodeBnkInvalidCreds Invalid banking service credentials 502

BFF - Backend For Frontend Integration

Code Constant Message HTTP Status
ZPY.BFF.001 CodeBFFUnavailable BFF service is temporarily unavailable 503
ZPY.BFF.002 CodeBFFRequestFailed BFF service request failed 502
ZPY.BFF.003 CodeBFFReturnedError BFF service returned an error 502
ZPY.BFF.004 CodeBFFParseFailed Failed to process BFF service response 502
ZPY.BFF.005 CodeBFFTimeout BFF service request timed out 502

WHK - Webhook Processing

Code Constant Message HTTP Status
ZPY.WHK.001 CodeWhkInvalidPayload Invalid webhook payload 400
ZPY.WHK.002 CodeWhkMissingAttrs Missing required webhook attributes 400
ZPY.WHK.003 CodeWhkProcessFailed Webhook processing failed 500
ZPY.WHK.004 CodeWhkDuplicate Duplicate webhook message detected 500
ZPY.WHK.005 CodeWhkDeliveryFailed Failed to deliver webhook 500
ZPY.WHK.006 CodeWhkTimeout Webhook delivery timed out 500
ZPY.WHK.007 CodeWhkResolveFailed Failed to resolve account from webhook 500
ZPY.WHK.008 CodeWhkDLQDetected Dead letter queue message detected 500

RLY - Message Relay Operations

Code Constant Message HTTP Status
ZPY.RLY.001 CodeRlyPublishFailed Failed to publish message to relay 500
ZPY.RLY.002 CodeRlyInvalidFormat Invalid relay message format 400
ZPY.RLY.003 CodeRlyDecodeFailed Failed to decode relay message 400
ZPY.RLY.004 CodeRlyResolveFailed Failed to resolve account UUID 500
ZPY.RLY.005 CodeRlyDeliveryFailed Relay delivery failed 500

SYS - System/Internal Errors

Code Constant Message HTTP Status
ZPY.SYS.001 CodeSysInternal An internal server error occurred 500
ZPY.SYS.002 CodeSysUnavailable Service is temporarily unavailable 503
ZPY.SYS.003 CodeSysConfig Configuration error 500
ZPY.SYS.004 CodeSysUnexpected An unexpected error occurred 500
ZPY.SYS.005 CodeSysMarshalFailed Data serialization failed 500
ZPY.SYS.006 CodeSysTimeout Operation timed out 500
ZPY.SYS.007 CodeSysDBConnFailed Database connection failed 500
ZPY.SYS.008 CodeSysDBQueryFailed Database query failed 500
ZPY.SYS.009 CodeSysDBTxFailed Database transaction failed 500
ZPY.SYS.010 CodeSysDBNotFound Record not found in database 404
ZPY.SYS.011 CodeSysDBDuplicate Record already exists in database 409
ZPY.SYS.012 CodeSysDBConstraint Database constraint violation 500
ZPY.SYS.013 CodeSysCacheUnavail Cache service unavailable 503
ZPY.SYS.014 CodeSysCacheFailed Cache operation failed 500
ZPY.SYS.015 CodeSysCacheParseFailed Failed to parse cached data 500

Response Format

{
  "code": "ZPY.AUT.006",
  "message": "Invalid username or password"
}

With details:

{
  "code": "ZPY.ACC.001",
  "message": "Account not found",
  "details": {
    "account_id": "123e4567-e89b-12d3-a456-426614174000"
  }
}

Validation error:

{
  "code": "ZPY.VAL.001",
  "message": "One or more required fields are missing",
  "details": {
    "errors": {
      "username": ["Username is required"],
      "password": ["Password is required"]
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment