🇬🇧
Yativo Documentation
Spanish
English
English
  • Yativo
  • Introduction to Yativo
    • Financial Infrastructure
    • About Us
  • Dashboard
  • Business Plans
  • Getting Started with Yativo API
  • Yativo API Glossary
  • API reference
    • Misc.
      • Countries
      • States
      • City
  • Security and Authentication
    • Security
    • Authentication
    • Idempotency in API Requests
  • Environment
    • Environments
  • Notifications
    • Webhook
  • Compliance
    • Verification
      • KYC
      • KYB
      • KYC/KYB Update
      • KYC Status
      • Global Business Search
    • Supported Jurisdiction
    • Supported Countries, Currencies and Payment Method
  • User Management
    • Customer
      • Get Customers
      • Retrieve customer
      • Add Customer
  • Payments
    • Currencies
    • Crypto Wallets
      • Generate Wallet Address
      • Fetch Wallet Address
      • Crypto Deposit History
      • Single crypto deposit history
    • Payout
      • Payout
      • Get Payouts
      • Get Payout
      • Beneficiaries
        • Get Beneficiaries
        • Add Beneficiary Payment Details
        • Update Beneficiary
        • Archive Beneficiary
        • Add Beneficiary
    • Payin
    • Virtual Cards
      • Supported Currency, Country
      • Create card
      • Fetch card
      • Top up card
      • Get Transactions
      • Freeze and Unfreeze Card
    • Virtual Accounts
      • Create VIrtual Accounts
        • USD Virtual Account
        • Mexico Virtual Account
        • Brazil PIX QR
      • Virtual Account Management
      • Transaction History
  • Foreign Exchange
    • Exchange Rate
      • Request Quote
  • Transactions
    • Transaction Summary
    • Get Single Transaction
  • Crypto System
    • Yativo Crypto Platform API
Powered by GitBook
On this page
  1. Foreign Exchange
  2. Exchange Rate

Request Quote

Endpoint

POST {{baseUrl}}/exchange-rate

Description

This endpoint retrieves the exchange rate between two specified currencies. The request must include the source and target currencies, method ID, and method type (either "payin" or "payout"). The request requires bearer token authentication.

Request

Headers

  • Authorization: Bearer YOUR_ACCESS_TOKEN

  • Content-Type: application/json

Request Body

{
    "from_currency" : "USD",
    "to_currency": "GBP",
    "method_id": 331,
    "method_type": "payin"
}

import requests
import json

url = "{{baseUrl}}/exchange-rate"
headers = {
    "Authorization": "Bearer YOUR_ACCESS_TOKEN",
    "Content-Type": "application/json"
}
data = {
    "from_currency": "USD",
    "to_currency": "GBP",
    "method_id": 331,
    "method_type": "payin"
}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
<?php

$url = "{{baseUrl}}/exchange-rate";
$headers = array(
    "Authorization: Bearer YOUR_ACCESS_TOKEN",
    "Content-Type: application/json"
);
$data = json_encode(array(
    "from_currency" => "USD",
    "to_currency" => "GBP",
    "method_id" => 331,
    "method_type" => "payin"
));

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $data
));

$response = curl_exec($curl);

if (curl_errno($curl)) {
    echo 'Error:' . curl_error($curl);
} else {
    echo $response;
}

curl_close($curl);
?>
const url = "{{baseUrl}}/exchange-rate";

const data = {
  "from_currency": "USD",
  "to_currency": "GBP",
  "method_id": 331,
  "method_type": "payin"
};

const options = {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
};

fetch(url, options)
  .then(response => {
    if (!response.ok) {
      throw new Error('Network response was not ok ' + response.statusText);
    }
    return response.json();
  })
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

Response

Example Success Response

{
  "status": "success",
  "status_code": 200,
  "message": "Exchange rate retrieved successfully",
  "data": {
    "from_currency": "USD",
    "to_currency": "GBP",
    "exchange_rate": 0.75,
    "method_id": 331,
    "method_type": "payin",
    "timestamp": "2024-07-03T12:00:00Z"
  }
}
PreviousExchange RateNextTransaction Summary

Last updated 3 months ago

Exchange rate

post
Authorizations
Query parameters
debugbooleanRequiredExample: true
Body
all ofOptional
and
anyOptionalExample: {"from_currency":"CLP","to_currency":"CLP","method_id":508,"method_type":"payout","amount":2000}
Responses
200
OK
application/json
Responseall of
and
anyOptionalExample: {"status":"success","status_code":200,"message":"Request successful","data":{"payout":{"id":"19","country":"CHL","amount":200,"currency":"CLP","orderId":"7GPKFXKG","description":"Payout requesst"},"output":{"stage":"IN_PROGRESS","status":"CREATED","statusChangeDateTime":"2024-03-02T10:22:19.228586"}}}
post
POST /api/v1/exchange-rate HTTP/1.1
Host: smtp.yativo.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 96

{
  "from_currency": "CLP",
  "to_currency": "CLP",
  "method_id": 508,
  "method_type": "payout",
  "amount": 2000
}
200

OK

{
  "status": "success",
  "status_code": 200,
  "message": "Request successful",
  "data": {
    "payout": {
      "id": "19",
      "country": "CHL",
      "amount": 200,
      "currency": "CLP",
      "orderId": "7GPKFXKG",
      "description": "Payout requesst"
    },
    "output": {
      "stage": "IN_PROGRESS",
      "status": "CREATED",
      "statusChangeDateTime": "2024-03-02T10:22:19.228586"
    }
  }
}