### Example JSON Response for SubAccount Balance Source: https://integration-guide.avenia.io/docs/Usecases/pix2Stable%26onChainTransfer Example response showing the balances of a sub-account across different currencies. ```json { "balances": { "BRLA": "0", "USDC": "0", "USDT": "100", "USDM": "0" } } ``` -------------------------------- ### Create Beneficiary Wallet cUrl Example Source: https://integration-guide.avenia.io/docs/Beneficiaries-Wallets/walletsGuide Example cUrl command to create a beneficiary wallet. Includes necessary headers for content type and authorization. ```curl curl -X POST "https://api.sandbox.avenia.io:10952/v2/account/beneficiaries/wallets/" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -d '{ "alias": "ExampleAlias", "description": "Example description", "walletAddress": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "walletChain": "POLYGON", "walletMemo": "memooo" }' ``` -------------------------------- ### cURL Example for Static BR Code Generation Source: https://integration-guide.avenia.io/docs/Bank%20Accounts/staticBrCode Use this cURL command to make a GET request to generate a static BR Code with a specified amount and reference label. Ensure your Authorization header is correctly set. ```curl curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/bank-accounts/brl/static-br-code?amount=10.00&referenceLabel=yourUniqueReference" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Get Beneficiary Wallet by ID cUrl Example Source: https://integration-guide.avenia.io/docs/Beneficiaries-Wallets/walletsGuide Example cUrl command to fetch the details of a specific beneficiary wallet using its unique ID. ```curl curl -X GET \ "https://api.sandbox.avenia.io:10952/v2/account/beneficiaries/wallets/{YOUR_UUID_ID}" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Starting the Flask Development Server Source: https://integration-guide.avenia.io/docs/Webhooks/verifyingWebhookAuthenticity This code snippet shows how to start the Flask development server to listen for incoming webhook requests on port 8080. ```python if __name__ == "__main__": logging.info("Listening on port 8080...") app.run(host='0.0.0.0', port=8080) ``` -------------------------------- ### Get Account Info - cURL Example Source: https://integration-guide.avenia.io/docs/Avenia-Account-Management/aboutLogin Example cURL command to fetch account information. Ensure you include your Bearer token for authorization. This request can be scoped to a sub-account using the subAccountId parameter. ```curl curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/account-info" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Get All Beneficiary Wallets cUrl Example Source: https://integration-guide.avenia.io/docs/Beneficiaries-Wallets/walletsGuide Use this cUrl command to retrieve a list of beneficiary wallets. Optional parameters can filter results by alias, wallet address, chain, and creation date. ```curl curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/beneficiaries/wallets/?alias=ExampleAlias&walletAddress=0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&walletChain=POLYGON&createdAfter=1700000000&createdBefore=1800000000&cursor=NEXT_CURSOR" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Quote Response Example Source: https://integration-guide.avenia.io/docs/Operations/quotesAndTickets This is an example of a successful quote response, detailing input and output currencies, amounts, and applied fees. ```json { "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" } ``` -------------------------------- ### Register Beneficiary Wallet - cURL Example Source: https://integration-guide.avenia.io/docs/Usecases/pix2Stable%26onChainTransfer Example cURL command to register a beneficiary wallet. This includes the POST request, headers for content type and authorization, and the JSON body. ```curl curl -X POST "https://api.sandbox.avenia.io:10952/v2/account/beneficiaries/wallets?subAccountId=SUB-ACCOUNT-ID-HERE" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -d '{ "alias": "ExampleAlias", "description": "Example description", "walletAddress": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "walletChain": "POLYGON", "walletMemo": "memooo" }' ``` -------------------------------- ### cURL Example for COP KYC (Main Account) Source: https://integration-guide.avenia.io/docs/KYC/kycCop Example cURL command to request COP KYC for the main account. Ensure your Authorization header is correctly set. ```curl curl -X POST "https://api.sandbox.avenia.io:10952/v2/kyc/cop/api" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### cURL Example for Main Account USD KYC Source: https://integration-guide.avenia.io/docs/KYC/kycUsd Example cURL command to request USD KYC for the main account. Ensure your Authorization header contains a valid Bearer token. ```bash curl -X POST "https://api.sandbox.avenia.io:10952/v2/kyc/usd/api" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### KYC Validation Response Examples Source: https://integration-guide.avenia.io/docs/Usecases/pix2Stable%26onChainTransfer Examples of JSON responses for KYC validation attempts, showing COMPLETED (APPROVED/REJECTED) and PENDING statuses. ```json { "attempt": { "id": "e51359cd-04b0-4bbc-bf7d-0ee515112d74", "levelName": "level-1", "submissionData": null, "status": "COMPLETED", "result": "APPROVED", "resultMessage": "", "retryable": false, "createdAt": "2025-03-25T07:39:40.54713Z", "updatedAt": "2025-03-25T07:39:40.54713Z" } } ``` ```json { "attempt": { "id": "b83802a1-afe9-46ac-96d6-ade6c5961bd3", "levelName": "level-1", "submissionData": null, "status": "PENDING", "result": "", "resultMessage": "", "retryable": false, "createdAt": "2025-03-26T22:50:14.201695Z", "updatedAt": "2025-03-26T22:50:14.201695Z" } } ``` ```json { "attempt": { "id": "5bafd6cd-ec40-4dd3-83e0-a5af117c304a", "levelName": "level-1", "submissionData": null, "status": "COMPLETED", "result": "REJECTED", "resultMessage": "name does not match", "retryable": false, "createdAt": "2025-03-26T22:50:14.201695Z", "updatedAt": "2025-03-26T22:50:14.201695Z" } } ``` -------------------------------- ### KYB EUR Application cURL Example Source: https://integration-guide.avenia.io/docs/KYB/kybEur Example cURL command to submit the KYB EUR application with necessary headers and JSON body. ```bash curl -X POST "https://api.sandbox.avenia.io:10952/v2/kyc/eur/api?subAccountId=a3f2c891-7b4d-4e6a-9d15-c82e0f3a1b57" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -H "Content-Type: application/json" \ -d '{ "businessType": "llc", "businessIndustries": ["519290"], "proofOfRevenueDocId": "5f8d3c16-b2e7-4a9f-c834-1e6b0d5f2a91" }' ``` -------------------------------- ### cURL Example for COP KYC (Subaccount) Source: https://integration-guide.avenia.io/docs/KYC/kycCop Example cURL command to request COP KYC for a subaccount. The `subAccountId` query parameter is used to specify the target subaccount. ```curl curl -X POST "https://api.sandbox.avenia.io:10952/v2/kyc/cop/api?subAccountId=1ee0a663-922b-4389-9f84-074ccff7085d" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Initial Setup and Configuration Source: https://integration-guide.avenia.io/docs/Security/apiKeysGuide Import necessary libraries and define initial configuration variables for API requests. Ensure the timestamp is generated as a string of milliseconds. ```python import time import base64 import requests from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import padding api_key = "dc96d0f8-ac73-4abe-ade3-c6d14e3e22fb" endpoint = "https://api.sandbox.avenia.io:10952/v2/account/account-info" method = "GET" request_uri = "/v2/account/account-info" body = "" timestamp = str(int(time.time() * 1000)) ``` -------------------------------- ### cURL Example for Get Bre-B Info Source: https://integration-guide.avenia.io/docs/Bank%20Accounts/bankAccountsCop Example using cURL to make a GET request to the Bre-B Info endpoint. Ensure you replace the placeholder Authorization token with your actual token. ```curl curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/bank-accounts/cop/bre-b-info?breBKey=@CBW0ZWQT6" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Get Quote Response JSON Source: https://integration-guide.avenia.io/docs/Usecases/pix2Stable%26stable2pix Example JSON response from the get quote endpoint, detailing currency conversion details and fees. ```json { "quoteToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.quoteToken....", "inputCurrency": "BRL", "inputPaymentMethod": "PIX", "inputAmount": "975.11", "outputCurrency": "USDM", "outputPaymentMethod": "INTERNAL", "outputAmount": "165", "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": "8.77599", "currency": "BRL" }, { "type": "Out Fee", "description": "Fees due to output currency and output payment method.", "amount": "0", "currency": "BRL" }, { "type": "Gas Fee", "description": "Fees due to blockchain transaction costs.", "amount": "0", "currency": "BRL" } ], "basePrice": "5.855378", "pairName": "USDMBRL" } ``` -------------------------------- ### cURL Example for KYC Level 1 Web SDK Source: https://integration-guide.avenia.io/docs/KYC/kycLevel1 This cURL command shows how to initiate the KYC Level 1 Web SDK flow, including the authorization header and a sample request body with a `redirectUrl`. ```bash curl -X POST "https://api.sandbox.avenia.io:10952/v2/kyc/new-level-1/web-sdk" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -H "Content-Type: application/json" \ -d '{ "redirectUrl": "https://yourapp.com/kyc-complete" }' ``` -------------------------------- ### cURL Example for Login Source: https://integration-guide.avenia.io/docs/Usecases/pix2Stable&stable2pix Use this cURL command to perform the login request. Replace placeholders with your actual credentials. ```bash curl -X POST "https://api.sandbox.avenia.io:10952/v2/auth/login" \ -H "Content-Type: application/json" \ -d '{ "email": "your.email@provider.com", "password": "UseAStrongPassword123!" }' ``` -------------------------------- ### Full Webhook Handler Implementation Source: https://integration-guide.avenia.io/docs/Webhooks/verifyingWebhookAuthenticity This comprehensive example demonstrates how to set up a Flask application to receive and verify incoming webhook requests. It includes fetching the public key, extracting the signature, and validating it against the request body. ```python import base64 import json import logging import requests from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import padding, rsa from cryptography.hazmat.primitives.serialization import load_pem_public_key from flask import Flask, request, Response app = Flask(__name__) logging.basicConfig(level=logging.INFO) def get_public_key(): api = "https://api.sandbox.avenia.io:10952/v2/public-key" try: response = requests.get(api) response.raise_for_status() key_response = response.json() public_key_pem = key_response.get("publicKey") if not public_key_pem: raise ValueError("Empty public key received") public_key = load_pem_public_key(public_key_pem.encode()) if not isinstance(public_key, rsa.RSAPublicKey): raise TypeError("Key is not RSA") return public_key except requests.RequestException as e: raise Exception(f"Failed to fetch public key: {str(e)}") except json.JSONDecodeError as e: raise Exception(f"Failed to parse response: {str(e)}") except (ValueError, TypeError) as e: raise Exception(str(e)) def verify_signature(body, signature_base64, public_key): try: signature = base64.b64decode(signature_base64) public_key.verify( signature, body, padding.PSS( mgf=padding.MGF1(hashes.SHA256()), salt_length=padding.PSS.MAX_LENGTH ), hashes.SHA256() ) return True except Exception as e: logging.error("Verification error: %s", e) return False @app.route('/', methods=['POST']) def handler(): try: public_key = get_public_key() except Exception as e: logging.error(f"Error obtaining public key: {str(e)}") return Response("Internal Server Error", status=500) signature_base64 = request.headers.get('Signature') if not signature_base64: return Response("Signature header is required", status=401) body = request.get_data() if verify_signature(body, signature_base64, public_key): return Response("Valid webhook received", status=200) else: return Response("Invalid signature", status=401) if __name__ == "__main__": logging.info("Listening on port 8080...") app.run(host='0.0.0.0', port=8080) ``` -------------------------------- ### Get Account Metadata - cURL Example Source: https://integration-guide.avenia.io/docs/Avenia-Account-Management/aboutLogin Example cURL command to fetch account metadata. Include your Bearer token for authentication. This endpoint helps determine which currencies are available for operations. ```curl curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/metadata" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### cURL Example for Get Document Status Source: https://integration-guide.avenia.io/docs/KYC/kycLevel1 This cURL command demonstrates how to make an authenticated GET request to retrieve the status of a document by its ID. Replace the placeholder token with your actual Bearer token. ```bash curl -X GET "https://api.sandbox.avenia.io:10952/v2/documents/9e37f9a8-611a-4cad-99fb-dd13268bdf4b" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Initiate KYC for Subaccount cURL Example Source: https://integration-guide.avenia.io/docs/Usecases/pix2Stable&stable2pix Use this cURL command to initiate KYC for a subaccount. The `subAccountId` must be included as a query parameter. Ensure you include the Authorization header and the JSON body. ```bash curl -X POST "https://api.sandbox.avenia.io:10952/v2/kyc/level-1/api?subAccountId=1ee0a663-922b-4389-9f84-074ccff7085d" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -H "Content-Type: application/json" \ -d '{ "fullName": "Jane Doe", "dateOfBirth": "1999-08-16", "countryOfDocument": "BRA", "documentType": "Passport", "documentNumber": "UJ252482", "countryOfTaxId": "BRA", "taxIdNumber": "75764220173", "country": "BRA", "state": "SP", "city": "SP", "zipCode": "12243010", "streetAddress": "Rua Madre Paula" } ``` -------------------------------- ### Account Statement cUrl Example Source: https://integration-guide.avenia.io/docs/Avenia-Account-Management/accountStatement This cUrl command demonstrates how to make a GET request to the account statement endpoint. ```curl curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/statement" ``` -------------------------------- ### Sample Account Balances JSON Response Source: https://integration-guide.avenia.io/docs/Avenia-Account-Management/aboutLogin Example JSON response showing the balances for different currencies (ARSA, BRLA, EURC, USDC, USDM, USDT) associated with an account. ```json { "balances": { "ARSA": "0", "BRLA": "518", "EURC": "0", "USDC": "1.753243", "USDM": "0", "USDT": "0" } } ``` -------------------------------- ### Verify Ticket Status cUrl Example Source: https://integration-guide.avenia.io/docs/Usecases/payOutBrCode This cUrl command shows how to perform a GET request to retrieve the status of a specific ticket using its UUID. ```curl curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/tickets/a14d6b53-e573-4e68-b34a-2a1b717eb448" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Get Fixed Rate Quote for Bre-B Deposit Source: https://integration-guide.avenia.io/docs/Sandbox%20Usecases/simulateCopDeposit This example shows how to request a quote for a COP deposit using the Bre-B payment method. Note the `inputPaymentMethod=BRE-B` parameter. ```curl curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/quote/fixed-rate?inputCurrency=COP&inputPaymentMethod=BRE-B&inputAmount=50000&outputCurrency=USDC&outputPaymentMethod=INTERNAL&inputThirdParty=false&outputThirdParty=false&blockchainSendMethod=PERMIT" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Create Access - cURL Example Source: https://integration-guide.avenia.io/docs/Avenia-Account-Management/aboutLogin Use this cURL command to create a new access. Ensure you provide a valid OTP and the desired permissions in the JSON body. A token will be sent to the provided email for further validation. ```curl curl -X POST "https://api.sandbox.avenia.io:10952/v2/auth/accesses/" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -d '{ "otp": "999999", "email": "your.new.access.email@provider.com", "permissions": { "payIn": true, "payOut": true, "convert": true, "onChain": true } }' ``` -------------------------------- ### Verify Payout Ticket Status cURL Example Source: https://integration-guide.avenia.io/docs/Usecases/payOutBrCode Use this GET request to verify the status of a previously created payout ticket. The ticket ID and sub-account ID are required parameters. ```bash curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/tickets/a14d6b53-e573-4e68-b34a-2a1b717eb448?subAccountId=1ee0a663-922b-4389-9f84-074ccff7085d" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Initiate KYC Level 1 via Web SDK Source: https://integration-guide.avenia.io/docs/KYC/kycLevel1 Use this endpoint to initiate the KYC Level 1 process using the Web SDK. It returns a URL to redirect the user to for completing the verification flow. An optional `redirectUrl` can be provided for post-verification redirection. ```json { "redirectUrl": "https://example.com/kyc-complete" } ``` -------------------------------- ### Get All Tickets API Example Source: https://integration-guide.avenia.io/docs/Operations/quotesAndTickets This cURL command demonstrates how to retrieve all tickets, with options to filter by sub-account ID and status. Ensure your Authorization header contains a valid Bearer token. ```curl 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 "status=PAID" ``` -------------------------------- ### Building and Sending the Request Source: https://integration-guide.avenia.io/docs/Security/apiKeysGuide Construct the request headers including the API key, timestamp, and signature. Then, send the GET request to the specified endpoint. ```python print("Headers:") print("X-API-Key:", api_key) print("X-API-Timestamp:", timestamp) print("X-API-Signature:", signature_base64) headers = { "X-API-Key": api_key, "X-API-Timestamp": timestamp, "X-API-Signature": signature_base64, } response = requests.get(endpoint, headers=headers) print("Status:", response.status_code) print("Response:", response.text) ``` -------------------------------- ### cURL Example for Verifying Ticket Status Source: https://integration-guide.avenia.io/docs/Usecases/pix2Stable%26onChainTransfer This cURL command shows how to perform a GET request to check the status of a specific ticket using its UUID. This is an alternative to using webhooks for tracking ticket progression. ```bash curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/tickets/b73767f7-1343-4176-9298-fffc85ea71a4" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Create API Key cURL Example Source: https://integration-guide.avenia.io/docs/Security/apiKeysManagements Use this cURL command to create a new API key. Ensure you include your public key, a name for the key, and an OTP for verification. The response will contain the new API key's UUID. ```bash curl -X POST "https://api.sandbox.avenia.io:10952/v2/auth/api-keys/" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -H "Content-Type: application/json" \ -d '{ "name": "first api key", "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArtMQzJdnJKaFdPfj8n0H\nkHE/eI8yliI5KZhXls=....Il2iAJMmsjFclJHEioLGn8ei/eRhgLdRovbG6MledEjO7bNYOs9\nsQIDAQAB\n-----END PUBLIC KEY-----", "otp": "888888", "whitelistedIPs": ["0.0.0.0/0"] }' ``` -------------------------------- ### Get Ticket by ID API Example Source: https://integration-guide.avenia.io/docs/Operations/quotesAndTickets This cURL command shows how to retrieve a specific ticket using its unique identifier. Replace TICKET-UUID-HERE with the actual ticket ID and ensure your Authorization header is valid. ```curl curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/tickets/TICKET-UUID-HERE" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### List All API Keys cURL Example Source: https://integration-guide.avenia.io/docs/Security/apiKeysManagements This cURL command retrieves a list of all API keys associated with your account. It requires an Authorization header with your bearer token. ```bash curl -X GET "https://api.sandbox.avenia.io:10952/v2/auth/api-keys/" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ``` -------------------------------- ### Create Subaccount for Client Source: https://integration-guide.avenia.io/docs/Usecases/payOutBrCode Register a client by creating a subaccount. This allows the Main Account to manage client accounts. Ensure to use the correct accountType and provide a name for the subaccount. ```http https://api.sandbox.avenia.io:10952/v2/account/sub-accounts ``` ```json { "accountType": "INDIVIDUAL", "name": "Jane Doe" } ``` ```curl curl -X POST "https://api.sandbox.avenia.io:10952/v2/account/sub-accounts" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -H "Content-Type: application/json" \ -d '{ "accountType": "INDIVIDUAL", "name": "Jane Doe" }' ``` ```json { "id": "1ee0a663-922b-4389-9f84-074ccff7085d" } ``` -------------------------------- ### Get Fixed-Rate Quote Source: https://integration-guide.avenia.io/docs/Usecases/pix2Stable%26onChainTransfer Use this endpoint to get a quote for converting funds. Ensure all required parameters are correctly provided. ```http https://api.sandbox.avenia.io:10952/v2/account/quote/fixed-rate ``` -------------------------------- ### Sample JSON Response for Access Creation Source: https://integration-guide.avenia.io/docs/Avenia-Account-Management/aboutLogin This is a sample JSON response structure when an access is created. It includes user details, permissions, and MFA configuration. ```json { "id": "00000000-0000-0000-0000-000000000000", "email": "your.new.access.email@provider.com", "createdAt": "2025-02-07T19:54:17.727744Z", "updatedAt": "2025-02-07T19:54:17.727744Z", "frozenUntil": "0001-01-01T00:00:00Z", "accessPermission": { "id": "00000000-0000-0000-0000-000000000000", "admin": true, "payIn": true, "payOut": true, "convert": true, "onChain": true, "updatedAt": "2025-02-07T19:54:17.727744Z" }, "mfa": { "id": "00000000-0000-0000-0000-000000000000", "createdAt": "2025-02-18T00:36:47.329722Z", "updatedAt": "2025-02-18T00:36:47.329722Z" } } ``` -------------------------------- ### Account Balance Example JSON Response Source: https://integration-guide.avenia.io/docs/Export/infiniaMigrationGuide This JSON object shows the available balances for each currency, such as BRLA, USDC, and USDT. ```json { "balances": { "BRLA": "9457.170326", "USDC": "0", "USDT": "42.07732" } } ``` -------------------------------- ### Example JSON Response for Account Statement Source: https://integration-guide.avenia.io/docs/Export/template This example shows the structure of the account statement logs, including transaction details and timestamps. ```json { "logs": [ { "id": "04d3b592-40cc-44ed-9370-65852842bdd6", "token": "BRLA", "balanceChange": "100", "finalBalance": "9357.170326", "description": "[DEBIT] Process ticket output: BRLA delivery", "createdAt": "2025-04-01T23:06:34.440381Z" }, { "id": "1412d736-d35f-4c98-9d73-3449f4845fea", "token": "BRLA", "balanceChange": "800", "finalBalance": "9257.170326", "description": "[DEBIT] Process ticket output: BRLA delivery", "createdAt": "2025-04-01T23:01:34.335504Z" } ], "cursor": "MjgzLTE3NDM1MTU4MjA4MDY=" } ``` -------------------------------- ### Download Ticket Receipt Source: https://integration-guide.avenia.io/docs/Operations/ticket-receipt This example shows how to download a ticket receipt without specifying a sub-account. The output is saved to 'ticket-receipt.pdf'. ```curl curl -X GET \ "https://api.sandbox.avenia.io:10952/v2/account/tickets/{ticket-id}/receipt" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -o ticket-receipt.pdf ``` -------------------------------- ### Get Quote for Fixed Rate Source: https://integration-guide.avenia.io/docs/Sandbox%20Usecases/receiveMockFunds Use this endpoint to get a quote for a fixed-rate currency exchange. Ensure all required parameters are provided. ```bash GET /v2/account/quote/fixed-rate ``` ```bash curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/quote/fixed-rate?inputCurrency=BRL&inputPaymentMethod=PIX&inputAmount=1000&outputCurrency=BRLA&outputPaymentMethod=INTERNAL&inputThirdParty=false&outputThirdParty=false&blockchainSendMethod=PERMIT" ``` -------------------------------- ### Get Specific Subaccount - cUrl Source: https://integration-guide.avenia.io/docs/Avenia%20Subaccounts/subAccountManagement Retrieve details for a specific subaccount by replacing SUBACCOUNT-ID-HERE with the actual subaccount ID in this GET request. ```curl curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/sub-accounts/SUBACCOUNT-ID-HERE" ``` -------------------------------- ### cURL Example for Ticket Creation Source: https://integration-guide.avenia.io/docs/Usecases/pix2Stable%26onChainTransfer This cURL command demonstrates how to send a POST request to the tickets endpoint to create a new ticket for processing a PIX to stablecoin transfer. Ensure your Authorization header is correctly set. ```bash curl -X POST "https://api.sandbox.avenia.io:10952/v2/account/tickets" \ -H "Authorization: Bearer eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \ -H "Content-Type: application/json" \ -d '{ "quoteToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.quoteToken....", "ticketBlockchainOutput": { "beneficiaryWalletId": "00000000-0000-0000-0000-000000000000" } }' ```