Skip to main content

Quote

A quote is a calculation that determines how much someone will receive in exchange for a certain amount of money or assets. It provides a fixed or estimated price for a transaction before it happens, allowing users to know the exact cost, fees, and potential variations in value.

In the context of Avenia, a quote helps users understand the exchange rate, applied fees, and any additional charges before completing a operation. This ensures transparency and predictability, whether the transaction involves traditional currencies (fiat), cryptocurrencies, or other digital assets.

Before diving in, let's break down everything you need to know about how a quote works

About Quote

All inputs here are URL Parameters as this is a GET endpoint

info

A expiration of a quote is 15 seconds!

QUERY PARAMETERS

FieldTypeDescription
inputCurrencystringThe currency the user is paying with. Example: BRL, USD, USDC... More examples here
inputPaymentMethodstringThe payment method used for the transaction. Example: PIX, BLOCKCHAIN... More examples here
inputAmountdecimal.DecimalThe amount the user wants to pay/deposit. Required if outputAmount is not provided.
outputCurrencystringThe currency the user wants to receive. Example: BRL, USD, USDT... More examples here
outputPaymentMethodstringThe method in which the user wants to receive the funds. Example: PIX, BLOCKCHAIN... More examples here
outputAmountdecimal.DecimalThe amount the user wants to receive. Required if inputAmount is not provided.
markupFloatingFeedecimal.DecimalA percentage fee added on top of the transaction. Example: 0.01 for 1%.
markupInputFixedFeedecimal.DecimalA fixed fee applied to the input amount. Example: 10.00in all input operation.
markupOutputFixedFeedecimal.DecimalA fixed fee applied to the output amount. Example: 5.00 in all output operation.
markupCurrencystringThe currency in which the markup fee will be charged. Example: BRLA, USDCor USDT More examples here
inputThirdPartyboolSpecifies whether the input is coming from a third party. true or false.
outputThirdPartyboolSpecifies whether the output is going to a third party. true or false.
blockchainSendMethodstringDefines the blockchain transaction type. Can be TRANSFER or PERMIT. Required for blockchain inputs.
outputBrCodestringbrCode to be paid
warning

Either inputAmount or outputAmount must be provided, but not both at the same time.

warning

Some BrCodes do not have a specified value. In such cases, provide either the inputAmount or the outputAmount—only one amount is allowed, so do not include both.

Now, let's break down each part. Imagine the parameters divided into blocks: Input, Output, Third Party, and Send Methods (only for blockchain operations). This modular structure ensures flexibility to meet your needs!

Input

For input, we can handle both fiat and blockchain transactions.

info

Fiat currencies can have a maximum of 2 decimal places, while blockchain currencies can have up to 6 decimal places.

Input Currency: Here you specify the entry method, which can also be interpreted as a deposit. For example, BRL and USD for fiat currencies, or BRLA, USDC, and others for blockchain currencies.

Input Payment Method: The method you use to deliver the currency. For example, PIX, a blockchain, among other options that will be presented soon.

Input Amount: The amount to be deposited upfront. For example, in a PIX transaction, this is where you specify the exact amount to be deposited.

Output

For output, we also handle both fiat and blockchain transactions.

info

Just like for input, fiat currencies can have a maximum of 2 decimal places, while blockchain currencies can have up to 6 decimal places.

Output Currency: Here you specify the currency in which you want to receive the funds. For example, BRL and USD for fiat currencies, or BRLA, USDC, and others for blockchain currencies.

Output Payment Method: The method through which you will receive the funds. This could be PIX, a blockchain, or other available options that will be presented soon.

Output Amount: The exact amount you will receive after all calculations and fees are applied.

info

If an Input Amount was specified, the system will determine this value automatically based on the exchange rate and transaction conditions. The same if an Output Amount was specified.

Markup

Markup allows you to add an extra fee on top of Avenia’s standard pricing, giving you control over how much you charge your users for transactions.

For example, Avenia charges a 1% fee on swaps, which goes directly to Avenia. However, if you want to charge an additional 1% fee to your own customers, you can apply a markup. This means that both Avenia and you will collect a fee from the transaction.

warning

The markup must be sent to your Avenia Wallet, which belongs to your Business Account (BA) or sub account if applicable. Avenia will automatically route the markup amount to this wallet.

Markup Currency: Choose the currency in which you want to receive the markup. Supported options include BRLA, USDC, USDT, and others. Avenia will automatically handle the conversion if needed.

Markup Floating Fee: Set the percentage fee you want to charge on each transaction. For example, if Avenia charges 1% on a swap, and you want to charge an additional 1%, you would set 1% here.

Markup Input: Define a fixed fee applied at the moment of payment. Whenever your user makes a deposit or payment, this fee is charged upfront.

Markup Output: Define a fixed fee applied when receiving funds. Whenever your user withdraws or receives a transaction, this fee is deducted from the final amount.

Send Method

info

Send Method is only applied to quotes where the input is blockchain

If your input is a blockchain transaction, you must specify the send method to define how the "deposit" will be made. You have two options:

Permit

You will sign a transaction allowing Avenia to instantly pull the tokens from your wallet, ensuring a seamless and automatic transfer. Since the transaction is executed immediately, the final amount will not change.

Transfer

You will need to proactively send the tokens to your Avenia Wallet. This means Avenia will lock in the value for a certain period of time, which may result in additional costs due to price fluctuations.

these are the two ways you can send tokens in an operation where the input is blockchain!

Third Party

Here, you will specify whether the input or output of this transaction belongs to the account holder or a third party.

This works similarly to betting platforms, where deposits and withdrawals are typically restricted to the account owner. However, with Avenia, you have the flexibility to indicate whether the funds are coming from or going to a third party. Since this introduces additional risks, Avenia may apply an extra fee to cover them.

Input Third Party: Specify whether the deposit is being made by the account holder or by a third party.

Output Third Party: Specify whether the withdrawal will be sent to the account holder or to a third party.

Table with allowed data

Permitted Currencies and Payment Methods

CurrencyValid Payment Methods
BRLPIX
BRLAINTERNAL, POLYGON, MOONBEAM, CELO, GNOSIS
USDCINTERNAL, POLYGON, MOONBEAM, CELO
USDCePOLYGON
USDTINTERNAL, POLYGON, MOONBEAM, CELO

Blockchain Currencies

CurrencyDescription
BRLABRLA token on supported blockchains
USDCUSD Coin (USDC)
USDCeUSD Coin (USDC.e) on certain networks
USDTTether (USDT)
ETHEthereum (ETH)
GLMRMoonbeam (GLMR)
POLPolygon (POL)
CHZChiliz (CHZ)
TRXTron (TRX)

Valid Blockchain Send Methods

CurrencyBlockchainValid Send Methods
BRLAPOLYGONPERMIT, TRANSFER
BRLAMOONBEAMPERMIT, TRANSFER
BRLACELOPERMIT, TRANSFER
BRLAGNOSISPERMIT, TRANSFER
USDCPOLYGONPERMIT, TRANSFER
USDCePOLYGONPERMIT, TRANSFER
USDTPOLYGONPERMIT, TRANSFER
USDCMOONBEAMTRANSFER
USDCCELOPERMIT, TRANSFER
USDTTRONTRANSFER

Valid Markup Currencies

CurrencyCan be used for Markup?
BRLAYes
USDCYes
USDTYes

Okay, now that you know exactly how to interact with the quote endpoint, let's dive in and break down what the response looks like.

Getting Your Hands Dirty

Now that you understand how the quote system works, it's time to put it into action. In this section, we’ll dive into making actual requests to the quote endpoint, exploring real examples, and understanding the responses. Let’s get started!

HTTP Get Request

https://api.sandbox.avenia.io:10952/v2/account/quote/fixed-rate

Breaking It Down: Practical Examples

As mentioned earlier, the simplest way to understand a quote is by dividing it into blocks. However, keep in mind that the way the quote system is designed allows you to combine these blocks in any way that suits your needs.

To provide context, let’s walk through three practical examples:

  1. Token to PIX – Converting a blockchain token into a fiat currency via PIX.
  2. PIX to Token – Depositing fiat via PIX and receiving a blockchain token.
  3. Blockchain to Blockchain – Exchanging one cryptocurrency for another on different blockchains.

Each of these cases follows the same modular structure, giving you full flexibility to build the quote that best fits your use case. Let’s explore them one by one!

PIX to TOKEN

Here, we’ll pass PIX as the input method, and as the output, we want to receive the token balance in our Avenia Wallet. Let’s see how this works in practice!

The request will be:

PIX to Token (BRL-FIAT TO BRLA-Blockchain)

FieldTypeValueDescription
inputCurrencystringBRLThe currency used for payment.
inputPaymentMethodstringPIXThe payment method used for the transaction.
inputAmountdecimal100The amount the user wants to deposit.
outputCurrencystringBRLAThe currency the user wants to receive.
outputPaymentMethodstringPOLYGONThe method in which the user will receive the funds.
inputThirdPartyboolfalseDefines if the deposit is from a third party.
outputThirdPartyboolfalseDefines if the withdrawal is sent to a third party.

cUrl Example

curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/quote/fixed-rate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-G \
--data-urlencode "inputCurrency=BRL" \
--data-urlencode "inputPaymentMethod=PIX" \
--data-urlencode "inputAmount=100" \
--data-urlencode "outputCurrency=BRLA" \
--data-urlencode "outputPaymentMethod=POLYGON" \
--data-urlencode "inputThirdParty=false" \
--data-urlencode "outputThirdParty=false"

You will receive a response containing:

  • The JWT of the quote, which will be used to create the ticket.
  • The data you sent, confirming the details of your request.
  • A breakdown of the fees applied, providing transparency on the costs associated with the transaction.

JSON Response

{
"quoteToken": "eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"inputCurrency": "BRL",
"inputPaymentMethod": "PIX",
"inputAmount": "100",
"outputCurrency": "BRLA",
"outputPaymentMethod": "POLYGON",
"outputAmount": "99.749583",
"markupAmount": "0",
"markupCurrency": "",
"inputThirdParty": false,
"outputThirdParty": false,
"appliedFees": [
{
"type": "Markup Fee",
"description": "Total markup fees represented in the input currency.",
"amount": "0",
"currency": "BRL"
},
{
"type": "In Fee",
"description": "Fees due to input currency and input payment method.",
"amount": "0.2",
"currency": "BRL"
},
{
"type": "Conversion Fee",
"description": "Fees due to conversion from input currency to output currency.",
"amount": "0",
"currency": "BRL"
},
{
"type": "Out Fee",
"description": "Fees due to output currency and output payment method.",
"amount": "0.05",
"currency": "BRL"
},
{
"type": "Gas Fee",
"description": "Fees due to blockchain transaction costs.",
"amount": "0.000417",
"currency": "BRL"
}
],
"basePrice": "1",
"pairName": "BRLBRLA"
}
info

click here to see the explanation of the output quote

This ensures that you have all the necessary information before proceeding with the start of creation ticket!

Blockchain to Blockchain

In this case, we will swap tokens between two blockchains. The user will send BRLA on Polygon and receive USDT on Celo.

The send method used is PERMIT, meaning the user will sign a transaction allowing Avenia to instantly pull the tokens from their wallet, ensuring an immediate transfer.

Request Parameters

FieldTypeValueDescription
inputCurrencystringBRLAThe currency being sent.
inputPaymentMethodstringPOLYGONThe blockchain network from which the tokens will be sent.
inputAmountdecimal100The amount of BRLA tokens to send.
outputCurrencystringUSDTThe currency the user wants to receive.
outputPaymentMethodstringCELOThe blockchain network where the tokens will be received.
inputThirdPartyboolfalseDefines if the deposit is from a third party.
outputThirdPartyboolfalseDefines if the withdrawal is sent to a third party.
blockchainSendMethodstringPERMITDefines how the transfer happens. Remember, PERMIT the user signs a transaction, allowing Avenia to pull the tokens immediately.

cUrl Example

curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/quote/fixed-rate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-G \
--data-urlencode "inputCurrency=BRLA" \
--data-urlencode "inputPaymentMethod=POLYGON" \
--data-urlencode "inputAmount=100" \
--data-urlencode "outputCurrency=USDT" \
--data-urlencode "outputPaymentMethod=CELO" \
--data-urlencode "inputThirdParty=false" \
--data-urlencode "outputThirdParty=false" \
--data-urlencode "blockchainSendMethod=PERMIT"

Upon a successful request, you will receive a response containing:

  • The JWT of the quote, which will be used to create the ticket.
  • The data you sent, confirming the details of your request.
  • A breakdown of fees applied, ensuring transparency in the transaction.

JSON Response

{
"quoteToken": "eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"inputCurrency": "BRLA",
"inputPaymentMethod": "POLYGON",
"inputAmount": "100",
"outputCurrency": "USDT",
"outputPaymentMethod": "CELO",
"outputAmount": "17.191611",
"markupAmount": "0",
"markupCurrency": "",
"blockchainSendMethod": "PERMIT",
"inputThirdParty": false,
"outputThirdParty": false,
"appliedFees": [
{
"type": "Markup Fee",
"description": "Total markup fees represented in the input currency.",
"amount": "0",
"currency": "BRLA"
},
{
"type": "In Fee",
"description": "Fees due to input currency and input payment method.",
"amount": "0.05",
"currency": "BRLA"
},
{
"type": "Conversion Fee",
"description": "Fees due to conversion from input currency to output currency.",
"amount": "0.6",
"currency": "BRLA"
},
{
"type": "Out Fee",
"description": "Fees due to output currency and output payment method.",
"amount": "0.05",
"currency": "BRLA"
},
{
"type": "Gas Fee",
"description": "Fees due to blockchain transaction costs.",
"amount": "0.005273",
"currency": "BRLA"
}
],
"basePrice": "5.775766",
"pairName": "USDTBRLA"
}
info

click here to see the explanation of the output quote

This ensures that you have all the necessary information before proceeding with the ticket creation!

Understanding the Quote Response

It's quite simple! Part of the quote can be ignored because it's exactly what you sent as input—this serves as confirmation feedback. Now, let’s break down the key fields:

pairName

FieldTypeDescription
pairNamestringRepresents the currency pair used in the quote. Example: "BRLAUSDT" for a BRLA to USDT conversion.

basePrice

FieldTypeDescription
basePricedecimalThe raw exchange rate before any fees are applied. Example: "1.002" means 1 BRLA is worth 1.002 USDT.

appliedFees

A list of fees that were applied to the transaction. Each item in the list contains:

FieldTypeDescription
typestringThe fee category. Example: "Markup Fee", "Gas Fee", "In Fee"...
descriptionstringA brief explanation of what the fee represents.
amountdecimalThe amount charged for this specific fee.
currencystringThe currency in which the fee is charged.

Understanding Errors

During the quoting process, several validations are performed to ensure that the provided input is correct. If any of these validations fail, the API will return an error response indicating which field is incorrect.

Below is a breakdown of the possible error messages you might encounter and their causes.

General Validation Errors

FieldError CodeDescription
inputAmount / outputAmountinputAmount/outputAmountBoth inputAmount and outputAmount cannot be set at the same time. Pass only one of them.
inputAmount / outputAmountinputAmount/outputAmountBoth inputAmount and outputAmount cannot be zero. One of them must be set.
inputAmountinputAmountThe inputAmount must be a positive value.
outputAmountoutputAmountThe outputAmount must be a positive value.
inputAmountinputAmountThe inputAmount must have a maximum of 6 decimal places.
outputAmountinputAmountThe outputAmount must have a maximum of 6 decimal places.
inputAmount (Fiat Currencies)inputAmountIf the input currency is fiat, it must have at most 2 decimal places.
outputAmount (Fiat Currencies)inputAmountIf the output currency is fiat, it must have at most 2 decimal places.

Currency & Payment Method Validation

FieldError CodeDescription
inputCurrency-inputPaymentMethodinputCurrency-inputPaymentMethodThe provided input currency and payment method combination is not valid.
outputCurrency-outputPaymentMethodoutputCurrency-outputPaymentMethodThe provided output currency and payment method combination is not valid.
Same input & output combinationinputCurrency-inputPaymentMethod:outputCurrency-outputPaymentMethodThe input and output currencies with the same payment method are not allowed.

Markup Validation

FieldError CodeDescription
markupFloatingFeemarkupInputPercentFeeThe markupFloatingFee must be a positive percentage.
markupFloatingFeemarkupInputPercentFeeThe markupFloatingFee must have a maximum of 6 decimal places.
markupInputFixedFeemarkupInputPercentFeeThe markupInputFixedFee must be a positive value.
markupInputFixedFeemarkupInputPercentFeeThe markupInputFixedFee must have a maximum of 6 decimal places.
markupOutputFixedFeemarkupInputPercentFeeThe markupOutputFixedFee must be a positive value.
markupOutputFixedFeemarkupInputPercentFeeThe markupOutputFixedFee must have a maximum of 6 decimal places.
markupCurrencymarkupCurrencyThe markupCurrency must be a valid currency that supports markup.

Blockchain Transaction Validation

FieldError CodeDescription
blockchainSendMethod (for blockchain input)inputCurrency-inputPaymentMethod:blockchainSendMethodThe blockchain send method is invalid for the selected input currency and payment method.

That's it! You now have all the fundamentals you need to create your own use cases. Feel free to reach out to us if you have any questions. We're here to help!

Receiving All Tickets

This endpoint allows you to retrieve the entire history of created tickets.

https://api.sandbox.avenia.io:10952/v2/account/tickets/

Query Parameters

These are the possible filters that can be applied when fetching ticket history:

ParameterTypeDescription
subAccountIdstringFilter by sub-account ID
createdAfterstringFetch tickets created after a specific date
createdBeforestringFetch tickets created before a specific date
cursorstringUsed for pagination
statusstringFilter tickets by their current status (PENDING, PAID, etc.)
inputCurrencystringFilter by the input currency used in the ticket
outputCurrencystringFilter by the output currency received in the ticket
outputPaymentMethodstringFilter by the payment method used for the output
endToEndIdstringFilter by identifier assigned to each Pix transaction to enable end-to-end transaction tracking and verification.

cUrl Example

curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/tickets/" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-G \
--data-urlencode "subAccountId=YOUR_SUB_ACCOUNT_ID" \
--data-urlencode "createdAfter=2024-01-01T00:00:00Z" \
--data-urlencode "createdBefore=2024-12-31T23:59:59Z" \
--data-urlencode "cursor=YOUR_CURSOR_VALUE" \
--data-urlencode "status=PAID" \
--data-urlencode "inputCurrency=BRL" \
--data-urlencode "outputCurrency=BRLA" \
--data-urlencode "outputPaymentMethod=POLYGON" \
--data-urlencode "endToEndId=00000000-0000-0000-0000-000000000000"

JSON Response

{
"tickets": [
{
"id": "385e871a-5628-4aa2-a28d-cafe7c876898",
"externalId": "",
"workspaceId": "2ac803ad-faf7-489f-9c1a-c6a64072e699",
"userId": "05505dde-c2e4-47c5-bd5c-071b4c4bb6a4",
"status": "PROCESSING",
"reason": "",
"failureReason": "",
"createdAt": "2025-04-04T14:51:29.702406Z",
"updatedAt": "2025-04-04T14:51:40.747899Z",
"expiresAt": "2025-04-05T14:51:29.701368Z",
"quote": {
"id": "61ee7d2f-f658-4c6a-9f4c-b3d510d09b57",
"ticketId": "385e871a-5628-4aa2-a28d-cafe7c876898",
"inputCurrency": "BRL",
"inputPaymentMethod": "PIX",
"inputAmount": "100",
"outputCurrency": "BRLA",
"outputPaymentMethod": "POLYGON",
"outputAmount": "99.8",
"markupCurrency": "",
"markupAmount": "0",
"sendMethod": "",
"inputThirdParty": false,
"outputThirdParty": false,
"basePrice": "1",
"appliedFees": [
{
"type": "Markup Fee",
"amount": "0",
"currency": "BRL",
"rebatable": false,
"description": "Total markup fees represented in the input currency."
},
{
"type": "In Fee",
"amount": "0.2",
"currency": "BRL",
"rebatable": true,
"description": "Fees due to input currency and input payment method."
},
{
"type": "Conversion Fee",
"amount": "0",
"currency": "BRL",
"rebatable": true,
"description": "Fees due to conversion from input currency to output currency."
},
{
"type": "Out Fee",
"amount": "0",
"currency": "BRL",
"rebatable": true,
"description": "Fees due to output currency and output payment method."
},
{
"type": "Gas Fee",
"amount": "0",
"currency": "BRL",
"rebatable": false,
"description": "Fees due to blockchain transaction costs."
}
],
"pairName": "BRLBRLA",
"outputBrCode": "",
"createdAt": "2025-04-04T14:51:29Z"
},
"rebate": {
"id": "94fe28a7-ce0c-4ce3-938f-6a4c0a4eec59",
"ticketId": "385e871a-5628-4aa2-a28d-cafe7c876898",
"amount": "0.1",
"currency": "BRLA",
"destinationWalletAddress": "0xb6e8860883039b6db937639b94e9a10ff7971bb6"
},
"brazilianFiatSenderInfo": {
"id": "1203f73b-0be3-45b8-8bbe-46b096a76415",
"ticketId": "385e871a-5628-4aa2-a28d-cafe7c876898",
"name": "Ada Capital Gestao de Recursos Ltda",
"taxId": "45981761000100",
"bankCode": "20018183",
"branchCode": "0001",
"accountNumber": "5703785980624896",
"accountType": "payment",
"endToEndId": "e20018183202504041451vbks2pewbiz"
},
"blockchainReceiverInfo": {
"id": "967ac673-a068-4314-a410-86cf1c522c4c",
"ticketId": "385e871a-5628-4aa2-a28d-cafe7c876898",
"walletAddress": "0xe41A4a64564D19f98867a4b43E743a7D988c9d68",
"walletChain": "INTERNAL",
"walletMemo": "",
"txHash": ""
},
"brlPixInputInfo": {
"id": "79228b3b-9ec5-4d9f-94a4-9235d18ff291",
"ticketId": "385e871a-5628-4aa2-a28d-cafe7c876898",
"referenceLabel": "82H1CRkm16ZsDs45Q76WUdlfQ",
"additionalData": "Avenia Ticket Payment",
"brCode": "00020126810014br.gov.bcb.pix01365c2c61a1-134b-4c34-958f-ea3122ac717f0219Avenia Ticket Payment5204000053039865406100.005802BR5917Avenia API Ltda6009Sao Paulo6229052582H1CRkm16ZsDs45Q76WUdlfQ6304D750"
}
},
...
],
"cursor": "MTUyLTE3NDE2MjI4MDI2Mzk="
}

and that's it, you have all the tickets you've ever created in your hands.

Conclusion

By now, you should have a solid understanding of how the quote system works and how to interact with the API efficiently.

We covered:

  • The structure of a quote, including input, output, markup, and blockchain-specific parameters.
  • How to make requests to the quote endpoint, whether it's PIX to Token, Token to PIX, or Blockchain to Blockchain.
  • How to interpret the response, including fees, exchange rates, and key transaction details.
  • Common validation rules and error handling, ensuring smooth and predictable API usage.
  • How to retrieve all tickets, allowing you to fetch your transaction history and track status changes.

With this knowledge, you're ready to integrate Avenia’s quoting system into your own workflows, allowing you to seamlessly handle token conversions, fiat transactions, and blockchain swaps.

Now that you’ve mastered quotes, it's time to start creating tickets and executing transactions!