curl --request POST \
--url https://api.moonpay.com/platform/v1/quotes/buy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {
"asset": {
"code": "USD"
},
"amount": "<string>"
},
"destination": {
"asset": {
"code": "<string>",
"caip19": "<string>"
},
"amount": "<string>"
},
"wallet": {
"address": "0x1234567890123456789012345678901234567890"
},
"feeBehavior": "inclusive"
}
'import requests
url = "https://api.moonpay.com/platform/v1/quotes/buy"
payload = {
"source": {
"asset": { "code": "USD" },
"amount": "<string>"
},
"destination": {
"asset": {
"code": "<string>",
"caip19": "<string>"
},
"amount": "<string>"
},
"wallet": { "address": "0x1234567890123456789012345678901234567890" },
"feeBehavior": "inclusive"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: {asset: {code: 'USD'}, amount: '<string>'},
destination: {asset: {code: '<string>', caip19: '<string>'}, amount: '<string>'},
wallet: {address: '0x1234567890123456789012345678901234567890'},
feeBehavior: 'inclusive'
})
};
fetch('https://api.moonpay.com/platform/v1/quotes/buy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moonpay.com/platform/v1/quotes/buy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
'asset' => [
'code' => 'USD'
],
'amount' => '<string>'
],
'destination' => [
'asset' => [
'code' => '<string>',
'caip19' => '<string>'
],
'amount' => '<string>'
],
'wallet' => [
'address' => '0x1234567890123456789012345678901234567890'
],
'feeBehavior' => 'inclusive'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.moonpay.com/platform/v1/quotes/buy"
payload := strings.NewReader("{\n \"source\": {\n \"asset\": {\n \"code\": \"USD\"\n },\n \"amount\": \"<string>\"\n },\n \"destination\": {\n \"asset\": {\n \"code\": \"<string>\",\n \"caip19\": \"<string>\"\n },\n \"amount\": \"<string>\"\n },\n \"wallet\": {\n \"address\": \"0x1234567890123456789012345678901234567890\"\n },\n \"feeBehavior\": \"inclusive\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.moonpay.com/platform/v1/quotes/buy")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"asset\": {\n \"code\": \"USD\"\n },\n \"amount\": \"<string>\"\n },\n \"destination\": {\n \"asset\": {\n \"code\": \"<string>\",\n \"caip19\": \"<string>\"\n },\n \"amount\": \"<string>\"\n },\n \"wallet\": {\n \"address\": \"0x1234567890123456789012345678901234567890\"\n },\n \"feeBehavior\": \"inclusive\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moonpay.com/platform/v1/quotes/buy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {\n \"asset\": {\n \"code\": \"USD\"\n },\n \"amount\": \"<string>\"\n },\n \"destination\": {\n \"asset\": {\n \"code\": \"<string>\",\n \"caip19\": \"<string>\"\n },\n \"amount\": \"<string>\"\n },\n \"wallet\": {\n \"address\": \"0x1234567890123456789012345678901234567890\"\n },\n \"feeBehavior\": \"inclusive\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"source": {
"amount": "<string>",
"asset": {
"code": "USD"
}
},
"destination": {
"amount": "<string>",
"asset": {
"code": "<string>",
"name": "<string>",
"precision": 123,
"caip19": "<string>"
}
},
"fees": {
"network": {
"amount": "2.39",
"asset": {
"code": "USD"
}
},
"moonpay": {
"amount": "4.99",
"asset": {
"code": "USD"
}
},
"ecosystem": {
"amount": "1.00",
"asset": {
"code": "USD"
}
}
},
"wallet": {
"address": "0x1234567890123456789012345678901234567890"
},
"paymentMethod": {
"id": "<string>"
},
"limits": {
"daily": {
"limit": {
"amount": "<string>",
"asset": {
"code": "USD"
}
},
"remaining": {
"amount": "<string>",
"asset": {
"code": "USD"
}
}
},
"monthly": {
"limit": {
"amount": "<string>",
"asset": {
"code": "USD"
}
},
"remaining": {
"amount": "<string>",
"asset": {
"code": "USD"
}
}
},
"yearly": {
"limit": {
"amount": "<string>",
"asset": {
"code": "USD"
}
},
"remaining": {
"amount": "<string>",
"asset": {
"code": "USD"
}
}
}
},
"expiresAt": "2023-11-07T05:31:56Z",
"executable": true,
"exchangeRate": "<string>",
"paymentDisclosures": [
{
"id": "<string>",
"version": "<string>"
}
],
"signature": "<string>",
"slippageBps": 123
}
}{
"code": "forbidden",
"message": "<string>",
"errors": [
{
"message": "<string>",
"field": "<string>",
"details": {}
}
]
}{
"code": "unauthorized",
"message": "Not authorized"
}{
"code": "forbidden",
"message": "Forbidden"
}Get a quote
Build quotes for fiat->crypto transactions
curl --request POST \
--url https://api.moonpay.com/platform/v1/quotes/buy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {
"asset": {
"code": "USD"
},
"amount": "<string>"
},
"destination": {
"asset": {
"code": "<string>",
"caip19": "<string>"
},
"amount": "<string>"
},
"wallet": {
"address": "0x1234567890123456789012345678901234567890"
},
"feeBehavior": "inclusive"
}
'import requests
url = "https://api.moonpay.com/platform/v1/quotes/buy"
payload = {
"source": {
"asset": { "code": "USD" },
"amount": "<string>"
},
"destination": {
"asset": {
"code": "<string>",
"caip19": "<string>"
},
"amount": "<string>"
},
"wallet": { "address": "0x1234567890123456789012345678901234567890" },
"feeBehavior": "inclusive"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: {asset: {code: 'USD'}, amount: '<string>'},
destination: {asset: {code: '<string>', caip19: '<string>'}, amount: '<string>'},
wallet: {address: '0x1234567890123456789012345678901234567890'},
feeBehavior: 'inclusive'
})
};
fetch('https://api.moonpay.com/platform/v1/quotes/buy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moonpay.com/platform/v1/quotes/buy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
'asset' => [
'code' => 'USD'
],
'amount' => '<string>'
],
'destination' => [
'asset' => [
'code' => '<string>',
'caip19' => '<string>'
],
'amount' => '<string>'
],
'wallet' => [
'address' => '0x1234567890123456789012345678901234567890'
],
'feeBehavior' => 'inclusive'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.moonpay.com/platform/v1/quotes/buy"
payload := strings.NewReader("{\n \"source\": {\n \"asset\": {\n \"code\": \"USD\"\n },\n \"amount\": \"<string>\"\n },\n \"destination\": {\n \"asset\": {\n \"code\": \"<string>\",\n \"caip19\": \"<string>\"\n },\n \"amount\": \"<string>\"\n },\n \"wallet\": {\n \"address\": \"0x1234567890123456789012345678901234567890\"\n },\n \"feeBehavior\": \"inclusive\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.moonpay.com/platform/v1/quotes/buy")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"asset\": {\n \"code\": \"USD\"\n },\n \"amount\": \"<string>\"\n },\n \"destination\": {\n \"asset\": {\n \"code\": \"<string>\",\n \"caip19\": \"<string>\"\n },\n \"amount\": \"<string>\"\n },\n \"wallet\": {\n \"address\": \"0x1234567890123456789012345678901234567890\"\n },\n \"feeBehavior\": \"inclusive\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moonpay.com/platform/v1/quotes/buy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {\n \"asset\": {\n \"code\": \"USD\"\n },\n \"amount\": \"<string>\"\n },\n \"destination\": {\n \"asset\": {\n \"code\": \"<string>\",\n \"caip19\": \"<string>\"\n },\n \"amount\": \"<string>\"\n },\n \"wallet\": {\n \"address\": \"0x1234567890123456789012345678901234567890\"\n },\n \"feeBehavior\": \"inclusive\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"source": {
"amount": "<string>",
"asset": {
"code": "USD"
}
},
"destination": {
"amount": "<string>",
"asset": {
"code": "<string>",
"name": "<string>",
"precision": 123,
"caip19": "<string>"
}
},
"fees": {
"network": {
"amount": "2.39",
"asset": {
"code": "USD"
}
},
"moonpay": {
"amount": "4.99",
"asset": {
"code": "USD"
}
},
"ecosystem": {
"amount": "1.00",
"asset": {
"code": "USD"
}
}
},
"wallet": {
"address": "0x1234567890123456789012345678901234567890"
},
"paymentMethod": {
"id": "<string>"
},
"limits": {
"daily": {
"limit": {
"amount": "<string>",
"asset": {
"code": "USD"
}
},
"remaining": {
"amount": "<string>",
"asset": {
"code": "USD"
}
}
},
"monthly": {
"limit": {
"amount": "<string>",
"asset": {
"code": "USD"
}
},
"remaining": {
"amount": "<string>",
"asset": {
"code": "USD"
}
}
},
"yearly": {
"limit": {
"amount": "<string>",
"asset": {
"code": "USD"
}
},
"remaining": {
"amount": "<string>",
"asset": {
"code": "USD"
}
}
}
},
"expiresAt": "2023-11-07T05:31:56Z",
"executable": true,
"exchangeRate": "<string>",
"paymentDisclosures": [
{
"id": "<string>",
"version": "<string>"
}
],
"signature": "<string>",
"slippageBps": 123
}
}{
"code": "forbidden",
"message": "<string>",
"errors": [
{
"message": "<string>",
"field": "<string>",
"details": {}
}
]
}{
"code": "unauthorized",
"message": "Not authorized"
}{
"code": "forbidden",
"message": "Forbidden"
}Authorizations
Bearer authentication header using an access token.
Example: Authorization: Bearer <accessToken>
Body
Source asset in fiat. Amount can be set in source or destination.
Show child attributes
Show child attributes
{
"amount": "100.02",
"asset": { "code": "USD" }
}
Destination asset in crypto. Amount can be set in destination or source. For DeFi tokens, identify the asset by caip19 and set the amount on source only (quoting by destination token amount is not supported).
Show child attributes
Show child attributes
Wallet address and optional tag where the crypto will be sent. Required for the quote to be executable.
Show child attributes
Show child attributes
{
"address": "0x1234567890123456789012345678901234567890"
}
Payment method for the transaction. Required for the quote to be executable.
Show child attributes
Show child attributes
Whether MoonPay fees are included in source.amount (inclusive) or added on top of it (exclusive). Defaults to inclusive. Only applies when quoting by source.amount; ignored when destination.amount is provided.
inclusive, exclusive Response
The request has succeeded.
Quote for a fiat-to-crypto buy. Contains locked rate, fees, expiry, and signature for payment execution.
Show child attributes
Show child attributes
{
"source": {
"amount": "100.00",
"asset": { "code": "USD" }
},
"destination": {
"amount": "31250.0",
"asset": {
"caip19": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv",
"code": "PENGU",
"name": "Pudgy Penguins",
"precision": 6
}
},
"fees": {
"network": {
"amount": "2.39",
"asset": { "code": "USD" }
},
"moonpay": {
"amount": "4.99",
"asset": { "code": "USD" }
},
"ecosystem": {
"amount": "1.00",
"asset": { "code": "USD" }
},
"defi": {
"amount": "1.00",
"asset": { "code": "USD" }
}
},
"wallet": {
"address": "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin"
},
"paymentMethod": {},
"feeBehavior": "inclusive",
"limits": null,
"expiresAt": "2026-03-27T12:30:00.000Z",
"executable": true,
"exchangeRate": "0.0032",
"slippageBps": 50,
"paymentDisclosures": [{ "id": "gateway-token", "version": "1" }],
"signature": "cXVvdGUuc2lnbmF0dXJl..."
}
{
"source": {
"amount": "100.00",
"asset": { "code": "USD" }
},
"destination": {
"amount": "0.00114",
"asset": { "code": "BTC" }
},
"fees": {
"network": {
"amount": "2.39",
"asset": { "code": "USD" }
},
"moonpay": {
"amount": "4.99",
"asset": { "code": "USD" }
},
"ecosystem": {
"amount": "1.00",
"asset": { "code": "USD" }
}
},
"wallet": {
"address": "0x1234567890123456789012345678901234567890"
},
"paymentMethod": {},
"feeBehavior": "inclusive",
"limits": null,
"expiresAt": "2026-03-27T12:30:00.000Z",
"executable": true,
"exchangeRate": "87523.17",
"paymentDisclosures": [
{
"id": "eea-crypto-asset-risk",
"version": "1"
}
],
"signature": "cXVvdGUuc2lnbmF0dXJl..."
}