Skip to main content
POST
/
platform
/
v1
/
quotes
/
buy
Build a buy quote
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

Authorization
string
header
required

Bearer authentication header using an access token.

Example: Authorization: Bearer <accessToken>

Body

application/json
source
object
required

Source asset in fiat. Amount can be set in source or destination.

Example:
{
"amount": "100.02",
"asset": { "code": "USD" }
}
destination
object
required

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).

wallet
object

Wallet address and optional tag where the crypto will be sent. Required for the quote to be executable.

Example:
{
"address": "0x1234567890123456789012345678901234567890"
}
paymentMethod
object

Payment method for the transaction. Required for the quote to be executable.

feeBehavior
enum<string>
default:inclusive

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.

Available options:
inclusive,
exclusive

Response

The request has succeeded.

data
object
required

Quote for a fiat-to-crypto buy. Contains locked rate, fees, expiry, and signature for payment execution.

Examples:
{
"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..."
}