Skip to main content
Connect your application to Pagsmile Open API v3 with a signed request. This guide takes you from the credentials you receive to a first account lookup, then explains how to handle responses and receive event notifications. Your integration path: Confirm access → select an account → sign and send a request → handle the result → connect webhooks.

Send your first request

Retrieve account information with a signed account lookup.

Explore API operations

Find the endpoints and fields for your use case.
Open API v3 authenticates requests with HMAC-SHA256 signatures, not OAuth bearer tokens. All public v3 operations documented here use HTTP POST with JSON bodies, including lookups.

Before you begin

Complete account registration and activation if you are onboarding your business. Before sending API traffic, confirm the following with your Pagsmile integration representative: Account activation and API access are separate prerequisites for this guide. If you have not received your base URL or credential scope, contact your integration representative before proceeding.

Configure your environment

The documented base URL for live traffic is:
If the integration team provides a different URL for onboarding or validation, use it with the matching credentials. See Environments for configuration and isolation rules.
The URL above is a production endpoint. Use the environment and credentials assigned to you; do not send live customer data to an endpoint intended for onboarding or validation.
Keep separate secret configuration, logs, and nonce stores for each endpoint. Store the API secret securely on your server. Never send it in a request or include it in logs, browser code, or shared examples.

Choose the right credential

Your credential determines which operations you can call and how you select an account.
The account-target headers are X-ISPB and X-Account-Number.
  • Always send them together with non-empty values when explicit targeting is required or allowed.
  • The selected account must be active, belong to the authenticated user, and have a valid account hierarchy.
  • When the headers are present, include both exact trimmed values in the canonical headers before calculating the signature.
  • Do not add account-target headers to platform operations or user-owned managed-account operations.
Check each endpoint’s Authentication and target section before calling it.

Sign your request

A signature proves that the request was created using your API secret and has not changed since it was signed. Calculate it from the same method, path, query, headers, and raw body that you send.
1

Prepare the body and headers

Serialize the JSON body once and retain its exact raw bytes. Generate a fresh nonce for each call and a Unix timestamp in milliseconds.Requests outside the five-minute timestamp window are rejected. Nonces are retained for ten minutes to prevent replay.
2

Build the canonical string

Calculate the lowercase hexadecimal SHA-256 hash of the raw body, even if you omit the optional X-Content-Hash header.Join the following seven components with a single line feed (\n). Do not add a trailing line feed:
An empty query still occupies its blank line. For a documented path such as /v3/bank_account, use the path without the base URL.Canonical headers: use lowercase names, trim values, and sort names lexically. Always include content-type, x-client-id, x-nonce, and x-timestamp. Include x-content-hash, x-account-number, and x-ispb only when those headers are sent. Do not include X-Signature itself.Canonical query: sort parameter names lexically, preserve the original value order for repeated names, and encode names and values using Go url.QueryEscape semantics.
3

Calculate the signature

Calculate HMAC-SHA256 over the canonical string using your API secret. Encode the result as 64 lowercase hexadecimal characters and send it as X-Signature.Send the exact raw body used to calculate the hash. Changing whitespace, property order, or other body bytes after signing changes the signature input.
For an account-level operation with a USER credential, add both target headers before calculating the signature. These are illustrative values; generate a current timestamp, fresh nonce, body hash, and signature for your request.
For this header set, the canonical names are ordered as content-type, x-account-number, x-client-id, x-content-hash, x-ispb, x-nonce, and x-timestamp. Omit x-content-hash from the canonical headers only if you omit that request header.

Send your first request

Use Get Bank Account to retrieve account information without initiating a payment. It accepts an empty JSON object and requires an ACCOUNT credential or a USER credential with both account-target headers.
The following request template uses an ACCOUNT credential bound to the account you want to retrieve. Set BASE_URL and CLIENT_ID from your issued configuration, then calculate TIMESTAMP_MS, NONCE, CONTENT_HASH, and SIGNATURE using the signing steps above. The body to hash and send is exactly {}.
Using a USER credential? Add X-ISPB and X-Account-Number to both the request and canonical headers, then recalculate the signature. A PLATFORM credential cannot call this endpoint.
A successful response contains account identifiers, balances, active PIX keys, limits, webhooks, and fee information. See the endpoint reference for the complete response and fallback behavior.

Handle the response

Normal API processing returns a JSON envelope. The example below illustrates its structure; data varies by endpoint.
HTTP 200 does not necessarily mean the operation succeeded. Enveloped errors also use HTTP 200. Treat the outer JSON code as the business result: 200 means success; every other value means failure.
  1. Check the HTTP response and whether it contains a JSON envelope.
  2. For an envelope, read the outer code. On failure, data is null.
  3. Choose your error-handling action by code, not by the localized message text.
  4. Handle non-envelope responses separately. Malformed input can return HTTP 400 with plain text; unhandled failures can return plain text, normally with HTTP 500.
Historical error or result fields nested inside data do not override the outer result. Use Error Catalog for the full response contract.
For every retry, generate a fresh timestamp, nonce, body hash, and signature. Follow the endpoint’s retry and duplicate-handling rules before repeating an operation.

Connect webhooks

Webhooks notify your application about transaction, KYB, and MED events. Pagsmile sends signed HTTP POST requests to your callback URL.
1

Choose your events and subscription scope

Use Webhooks to identify the event family and permitted owner scope. For the supported PIX and KYB event values, see Webhook Management. MED uses a separate subscription family; it is not represented by the numeric event values accepted by the management API.
2

Verify each delivery

Retain the raw request body and verify the content hash, signature, timestamp, and nonce before processing the event. Follow Signature Verification.
3

Accept and process events reliably

Store the event with its documented idempotency key, then return HTTP 200 after durable acceptance. Process asynchronously and handle duplicate or out-of-order deliveries. Use a callback URL that returns HTTP 200 directly, without redirects. See Delivery and Retries.

Before handling live operations

  • Confirm the assigned environment, credential scope, and target account for each operation.
  • Check both successful and failed responses; do not infer success from HTTP status alone.
  • Use decimal strings and decimal arithmetic for monetary values. See Object & Enums References.
  • Verify webhook signatures and duplicate handling before relying on event notifications.
  • Keep API secrets and one-time credential values out of logs.

Choose an API operation

Explore endpoints for accounts, transfers, charges, and refunds.

Handle errors consistently

Map business result codes to the right client behavior.