How to get quotes
This guide explains how to use the Quotes API to retrieve exchange rates for international transactions. You'll learn how to construct a request, authenticate it, and handle the response.
Prerequisites
Before you begin, ensure you have:
- A valid API Key and Secret Key. See Authentication for details.
- Access to the Sandbox environment for testing.
Step 1: Prepare the request
The Quotes API requires three mandatory query parameters to identify the currency pair and the target market.
| Parameter | Required | Description |
|---|---|---|
country | Yes | The ISO 3166-1 alpha-2 code of the target country (e.g., BR, MX). |
from | Yes | The source currency (ISO 4217 code) you are converting from (e.g., USD). |
to | Yes | The target currency (ISO 4217 code) you are converting to (e.g., BRL). |
Step 2: Authenticate and send the request
Use Basic Authentication to secure your request. The following example demonstrates a GET request using curl:
curl --location --request GET 'https://api.sandbox.international.pagseguro.com/v1/quotes?country=BR&from=USD&to=BRL' \
--header 'Authorization: Basic YOUR_BASE64_CREDENTIALS' \
--header 'Content-Type: application/json'
Replace YOUR_BASE64_CREDENTIALS with your encoded api-key:secret-key.
Step 3: Handle the response
On success, the API returns a 200 OK status with the quote details.
{
"country": "BR",
"from": "USD",
"to": "BRL",
"quotation": "5.94",
"date": "2025-05-09T14:25:00Z"
}
The following table lists common error codes you may receive from the API:
| Status Code | Description | Action |
|---|---|---|
400 | Bad Request | Check if your parameters (country, from, to) are valid and supported. |
401 | Unauthorized | Verify your API credentials and Authorization header format. |
429 | Too Many Requests | You have exceeded the rate limit. Wait before sending more requests. |
Transition to productionOnce you have validated your integration in the Sandbox environment, switch to Production:
- Use your Production credentials (API Key and Secret Key).
- Change the base URL to
https://api.international.pagseguro.com/v1/quotes.It's important to notice that credentials for Sandbox and Production are different. Do not use Sandbox keys in the Production environment.
Updated about 18 hours ago
