openapi: 3.0.1 info: title: AbacatePay API description: >- REST API for AbacatePay, a Brazilian payment gateway focused on instant Pix payments. Create billings and charges, generate and check Pix QR Codes, manage customers and coupons, and request withdrawals. All responses follow the {data, error} envelope and authenticate with a Bearer API key. termsOfService: https://www.abacatepay.com/termos contact: name: AbacatePay Support url: https://docs.abacatepay.com version: v1 servers: - url: https://api.abacatepay.com/v1 description: AbacatePay API v1 production server security: - bearerAuth: [] tags: - name: Billing description: Create and list billings (charges) with a shareable checkout URL. - name: Pix QR Code description: Create, check, and simulate dynamic Pix QR Code payments. - name: Customer description: Create and list customers (clients). - name: Coupon description: Create and list discount coupons. - name: Withdraw description: Create, retrieve, and list withdrawals (payouts) to a Pix key. paths: /billing/create: post: operationId: createBilling tags: - Billing summary: Create a new billing description: >- Creates a billing (charge) backed by a shareable checkout URL, supporting Pix and other payment methods, products, coupons, and customer association. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateBillingRequest' responses: '200': description: Billing created content: application/json: schema: $ref: '#/components/schemas/BillingResponse' '401': $ref: '#/components/responses/Unauthorized' /billing/list: get: operationId: listBillings tags: - Billing summary: List billings description: Returns the list of billings created for the authenticated store. responses: '200': description: A list of billings content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Billing' error: nullable: true '401': $ref: '#/components/responses/Unauthorized' /pixQrCode/create: post: operationId: createPixQrCode tags: - Pix QR Code summary: Create a Pix QR Code description: >- Creates a dynamic Pix QR Code returning the BR Code (copy-and-paste string) and a base64-encoded QR Code image for immediate collection. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreatePixQrCodeRequest' responses: '200': description: Pix QR Code created content: application/json: schema: $ref: '#/components/schemas/PixQrCodeResponse' '401': $ref: '#/components/responses/Unauthorized' /pixQrCode/check: get: operationId: checkPixQrCode tags: - Pix QR Code summary: Check Pix QR Code status description: Returns the current status and expiration of a Pix QR Code. parameters: - name: id in: query required: true description: The Pix QR Code identifier. schema: type: string responses: '200': description: Pix QR Code status content: application/json: schema: type: object properties: data: type: object properties: status: $ref: '#/components/schemas/PixStatus' expiresAt: type: string format: date-time error: nullable: true '401': $ref: '#/components/responses/Unauthorized' /pixQrCode/simulate-payment: post: operationId: simulatePixPayment tags: - Pix QR Code summary: Simulate a Pix payment description: >- Simulates payment of a Pix QR Code. Available in dev mode only, for testing webhooks and payment flows. parameters: - name: id in: query required: true description: The Pix QR Code identifier. schema: type: string requestBody: required: false content: application/json: schema: type: object properties: metadata: type: object additionalProperties: true responses: '200': description: Payment simulated content: application/json: schema: $ref: '#/components/schemas/PixQrCodeResponse' '401': $ref: '#/components/responses/Unauthorized' /customer/create: post: operationId: createCustomer tags: - Customer summary: Create a new customer description: Creates a customer (client) to associate with billings and charges. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateCustomerRequest' responses: '200': description: Customer created content: application/json: schema: $ref: '#/components/schemas/CustomerResponse' '401': $ref: '#/components/responses/Unauthorized' /customer/list: get: operationId: listCustomers tags: - Customer summary: List customers description: Returns the list of customers for the authenticated store. responses: '200': description: A list of customers content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Customer' error: nullable: true '401': $ref: '#/components/responses/Unauthorized' /coupon/create: post: operationId: createCoupon tags: - Coupon summary: Create a new coupon description: Creates a discount coupon with a percentage or fixed-amount discount. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateCouponRequest' responses: '200': description: Coupon created content: application/json: schema: $ref: '#/components/schemas/CouponResponse' '401': $ref: '#/components/responses/Unauthorized' /coupon/list: get: operationId: listCoupons tags: - Coupon summary: List coupons description: Returns the list of coupons for the authenticated store. responses: '200': description: A list of coupons content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Coupon' error: nullable: true '401': $ref: '#/components/responses/Unauthorized' /withdraw/create: post: operationId: createWithdraw tags: - Withdraw summary: Create a new withdrawal description: Requests a withdrawal (payout) of available balance to a Pix key. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateWithdrawRequest' responses: '200': description: Withdrawal created content: application/json: schema: $ref: '#/components/schemas/WithdrawResponse' '401': $ref: '#/components/responses/Unauthorized' /withdraw/get: get: operationId: getWithdraw tags: - Withdraw summary: Get a withdrawal description: Retrieves a withdrawal transaction by external ID. parameters: - name: externalId in: query required: true description: The external identifier supplied when the withdrawal was created. schema: type: string responses: '200': description: Withdrawal found content: application/json: schema: $ref: '#/components/schemas/WithdrawResponse' '401': $ref: '#/components/responses/Unauthorized' '404': description: Withdrawal not found content: application/json: schema: $ref: '#/components/schemas/Error' /withdraw/list: get: operationId: listWithdraws tags: - Withdraw summary: List withdrawals description: Returns the list of withdrawal transactions for the authenticated store. responses: '200': description: A list of withdrawals content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Transaction' error: nullable: true '401': $ref: '#/components/responses/Unauthorized' components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: API Key description: >- Authenticate with your AbacatePay API key as a Bearer token: `Authorization: Bearer `. responses: Unauthorized: description: Missing or invalid API key content: application/json: schema: $ref: '#/components/schemas/Error' schemas: Error: type: object properties: data: nullable: true error: type: string description: Human-readable error message. Metadata: type: object description: Arbitrary key/value metadata attached to a resource. additionalProperties: true Product: type: object required: - externalId - name - quantity - price properties: externalId: type: string description: Your identifier for the product. name: type: string description: type: string quantity: type: integer minimum: 1 price: type: integer description: Unit price in cents (BRL centavos). CustomerData: type: object properties: name: type: string cellphone: type: string email: type: string format: email taxId: type: string description: Brazilian tax identifier (CPF or CNPJ). CreateBillingRequest: type: object required: - frequency - methods - products - returnUrl - completionUrl properties: frequency: type: string description: Billing frequency. enum: - ONE_TIME - MULTIPLE_PAYMENTS methods: type: array items: type: string enum: - PIX description: Accepted payment methods. products: type: array items: $ref: '#/components/schemas/Product' returnUrl: type: string format: uri description: URL the customer is sent to when they click "back". completionUrl: type: string format: uri description: URL the customer is redirected to after payment. customerId: type: string description: Existing customer ID to associate with the billing. customer: $ref: '#/components/schemas/CustomerData' allowCoupons: type: boolean coupons: type: array items: type: string externalId: type: string metadata: $ref: '#/components/schemas/Metadata' Billing: type: object properties: id: type: string url: type: string format: uri description: Shareable checkout URL. amount: type: integer description: Total amount in cents. status: type: string enum: - PENDING - EXPIRED - CANCELLED - PAID - REFUNDED frequency: type: string methods: type: array items: type: string products: type: array items: $ref: '#/components/schemas/Product' metadata: $ref: '#/components/schemas/Metadata' BillingResponse: type: object properties: data: $ref: '#/components/schemas/Billing' error: nullable: true CreatePixQrCodeRequest: type: object required: - amount properties: amount: type: integer description: Amount to charge in cents (BRL centavos). expiresIn: type: integer description: Seconds until the QR Code expires. description: type: string customer: $ref: '#/components/schemas/CustomerData' metadata: $ref: '#/components/schemas/Metadata' PixStatus: type: string enum: - PENDING - PAID - EXPIRED - CANCELLED - REFUNDED PixQrCode: type: object properties: id: type: string amount: type: integer status: $ref: '#/components/schemas/PixStatus' brCode: type: string description: Pix copy-and-paste payload (BR Code). brCodeBase64: type: string description: Base64-encoded QR Code image. expiresAt: type: string format: date-time metadata: $ref: '#/components/schemas/Metadata' PixQrCodeResponse: type: object properties: data: $ref: '#/components/schemas/PixQrCode' error: nullable: true CreateCustomerRequest: type: object required: - name - cellphone - email - taxId properties: name: type: string cellphone: type: string email: type: string format: email taxId: type: string description: Brazilian tax identifier (CPF or CNPJ). Customer: type: object properties: id: type: string metadata: $ref: '#/components/schemas/CustomerData' CustomerResponse: type: object properties: data: $ref: '#/components/schemas/Customer' error: nullable: true CreateCouponRequest: type: object required: - code - discount - discountKind - notes properties: code: type: string discount: type: number description: Discount value (percentage or fixed amount per discountKind). discountKind: type: string enum: - PERCENTAGE - FIXED notes: type: string maxRedeems: type: integer description: Maximum number of redemptions; -1 for unlimited. metadata: $ref: '#/components/schemas/Metadata' Coupon: type: object properties: id: type: string code: type: string discount: type: number discountKind: type: string status: type: string enum: - ACTIVE - DISABLED maxRedeems: type: integer redeemsCount: type: integer notes: type: string metadata: $ref: '#/components/schemas/Metadata' CouponResponse: type: object properties: data: $ref: '#/components/schemas/Coupon' error: nullable: true PixKey: type: object required: - type - key properties: type: type: string enum: - PIX key: type: string description: The destination Pix key (CPF, CNPJ, email, phone, or random key). CreateWithdrawRequest: type: object required: - externalId - method - amount - pix properties: externalId: type: string description: Your identifier for the withdrawal, used for idempotency and lookup. method: type: string enum: - PIX amount: type: integer description: Amount to withdraw in cents (BRL centavos). pix: $ref: '#/components/schemas/PixKey' description: type: string Transaction: type: object properties: id: type: string externalId: type: string status: type: string enum: - PENDING - PROCESSING - COMPLETED - FAILED kind: type: string description: Transaction kind (e.g. WITHDRAW). amount: type: integer createdAt: type: string format: date-time WithdrawResponse: type: object properties: data: $ref: '#/components/schemas/Transaction' error: nullable: true