Skip to content

Dólar

GET
/v1/cotacoes/usd

Cotação do dólar americano em reais brasileiros

Respuestas

Retorna a cotação do Dólar
application/json
JSON
[
{
"compra": 0,
"venda": 0,
"fechoAnterior": 0,
"nome": "string",
"moeda": "string",
"dataAtualizacao": "string"
}
]

Ejemplos

cURL
curl -X GET \
'https://br.dolarapi.com/v1/cotacoes/usd'
JavaScript
fetch('https://br.dolarapi.com/v1/cotacoes/usd')
  .then(response => response.json())
  .then(data => console.log(data));
PHP
<?php
$url = 'https://br.dolarapi.com/v1/cotacoes/usd';
$method = 'GET';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
Python
import requests

url = 'https://br.dolarapi.com/v1/cotacoes/usd'

response = requests.get(url)
print(response.json())
Powered by VitePress OpenAPI