curl --request POST \
--url https://api.httpayer.com/relay \
--header 'Content-Type: application/json' \
--data '
{
"api_url": "https://demo.httpayer.com/base-weather",
"method": "GET",
"json": {},
"data": {},
"body": "<string>",
"payload": {},
"params": {},
"headers": {
"X-API-KEY": "your-target-api-key",
"Authorization": "Bearer token123"
},
"auth": {
"username": "<string>",
"password": "<string>"
},
"cookies": {
"session": "abc123"
},
"network": "base"
}
'import requests
url = "https://api.httpayer.com/relay"
payload = {
"api_url": "https://demo.httpayer.com/base-weather",
"method": "GET",
"json": {},
"data": {},
"body": "<string>",
"payload": {},
"params": {},
"headers": {
"X-API-KEY": "your-target-api-key",
"Authorization": "Bearer token123"
},
"auth": {
"username": "<string>",
"password": "<string>"
},
"cookies": { "session": "abc123" },
"network": "base"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
api_url: 'https://demo.httpayer.com/base-weather',
method: 'GET',
json: {},
data: {},
body: JSON.stringify('<string>'),
payload: {},
params: {},
headers: {'X-API-KEY': 'your-target-api-key', Authorization: 'Bearer token123'},
auth: {username: '<string>', password: '<string>'},
cookies: {session: 'abc123'},
network: 'base'
})
};
fetch('https://api.httpayer.com/relay', 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.httpayer.com/relay",
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([
'api_url' => 'https://demo.httpayer.com/base-weather',
'method' => 'GET',
'json' => [
],
'data' => [
],
'body' => '<string>',
'payload' => [
],
'params' => [
],
'headers' => [
'X-API-KEY' => 'your-target-api-key',
'Authorization' => 'Bearer token123'
],
'auth' => [
'username' => '<string>',
'password' => '<string>'
],
'cookies' => [
'session' => 'abc123'
],
'network' => 'base'
]),
CURLOPT_HTTPHEADER => [
"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.httpayer.com/relay"
payload := strings.NewReader("{\n \"api_url\": \"https://demo.httpayer.com/base-weather\",\n \"method\": \"GET\",\n \"json\": {},\n \"data\": {},\n \"body\": \"<string>\",\n \"payload\": {},\n \"params\": {},\n \"headers\": {\n \"X-API-KEY\": \"your-target-api-key\",\n \"Authorization\": \"Bearer token123\"\n },\n \"auth\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"cookies\": {\n \"session\": \"abc123\"\n },\n \"network\": \"base\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.httpayer.com/relay")
.header("Content-Type", "application/json")
.body("{\n \"api_url\": \"https://demo.httpayer.com/base-weather\",\n \"method\": \"GET\",\n \"json\": {},\n \"data\": {},\n \"body\": \"<string>\",\n \"payload\": {},\n \"params\": {},\n \"headers\": {\n \"X-API-KEY\": \"your-target-api-key\",\n \"Authorization\": \"Bearer token123\"\n },\n \"auth\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"cookies\": {\n \"session\": \"abc123\"\n },\n \"network\": \"base\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.httpayer.com/relay")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_url\": \"https://demo.httpayer.com/base-weather\",\n \"method\": \"GET\",\n \"json\": {},\n \"data\": {},\n \"body\": \"<string>\",\n \"payload\": {},\n \"params\": {},\n \"headers\": {\n \"X-API-KEY\": \"your-target-api-key\",\n \"Authorization\": \"Bearer token123\"\n },\n \"auth\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"cookies\": {\n \"session\": \"abc123\"\n },\n \"network\": \"base\"\n}"
response = http.request(request)
puts response.read_body{}{
"error": "<string>",
"details": "<string>"
}{
"x402Version": 1,
"accepts": [
{
"scheme": "exact",
"network": "base",
"payTo": "<string>",
"asset": "<string>",
"maxAmountRequired": "<string>",
"resource": "<string>",
"description": "<string>",
"mimeType": "application/json",
"maxTimeoutSeconds": 180
}
]
}{
"error": "Too Many Requests",
"message": "Server is currently processing the maximum number of concurrent requests. Please try again in a moment.",
"details": "Active requests: 50/50",
"retryAfter": 5
}{
"error": "<string>",
"details": "<string>"
}{
"error": "Bad Gateway",
"message": "Upstream API refused payment after 3 attempts",
"webhook_id": "550e8400-e29b-41d4-a716-446655440000"
}Execute cross-chain relay payment
HTTPayer relay service for x402 cross-chain payments.
Flow:
- First call (no X-Payment header): Returns 402 with payment instructions
- Second call (with X-Payment header): Executes relay payment flow
Supports:
- Cross-chain payments (EVM ↔ Solana)
- Same-chain payments (EVM → EVM, Solana → Solana)
- Automatic network selection based on target API (mainnet/testnet)
Fee Structure:
- HTTPayer charges a flat 3% relay fee on top of the target API’s requested payment amount.
- Example: For a $0.10 target payment, fee = $0.003, total = $0.103
- Daily limits: $100 per wallet, $1000 system-wide
curl --request POST \
--url https://api.httpayer.com/relay \
--header 'Content-Type: application/json' \
--data '
{
"api_url": "https://demo.httpayer.com/base-weather",
"method": "GET",
"json": {},
"data": {},
"body": "<string>",
"payload": {},
"params": {},
"headers": {
"X-API-KEY": "your-target-api-key",
"Authorization": "Bearer token123"
},
"auth": {
"username": "<string>",
"password": "<string>"
},
"cookies": {
"session": "abc123"
},
"network": "base"
}
'import requests
url = "https://api.httpayer.com/relay"
payload = {
"api_url": "https://demo.httpayer.com/base-weather",
"method": "GET",
"json": {},
"data": {},
"body": "<string>",
"payload": {},
"params": {},
"headers": {
"X-API-KEY": "your-target-api-key",
"Authorization": "Bearer token123"
},
"auth": {
"username": "<string>",
"password": "<string>"
},
"cookies": { "session": "abc123" },
"network": "base"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
api_url: 'https://demo.httpayer.com/base-weather',
method: 'GET',
json: {},
data: {},
body: JSON.stringify('<string>'),
payload: {},
params: {},
headers: {'X-API-KEY': 'your-target-api-key', Authorization: 'Bearer token123'},
auth: {username: '<string>', password: '<string>'},
cookies: {session: 'abc123'},
network: 'base'
})
};
fetch('https://api.httpayer.com/relay', 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.httpayer.com/relay",
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([
'api_url' => 'https://demo.httpayer.com/base-weather',
'method' => 'GET',
'json' => [
],
'data' => [
],
'body' => '<string>',
'payload' => [
],
'params' => [
],
'headers' => [
'X-API-KEY' => 'your-target-api-key',
'Authorization' => 'Bearer token123'
],
'auth' => [
'username' => '<string>',
'password' => '<string>'
],
'cookies' => [
'session' => 'abc123'
],
'network' => 'base'
]),
CURLOPT_HTTPHEADER => [
"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.httpayer.com/relay"
payload := strings.NewReader("{\n \"api_url\": \"https://demo.httpayer.com/base-weather\",\n \"method\": \"GET\",\n \"json\": {},\n \"data\": {},\n \"body\": \"<string>\",\n \"payload\": {},\n \"params\": {},\n \"headers\": {\n \"X-API-KEY\": \"your-target-api-key\",\n \"Authorization\": \"Bearer token123\"\n },\n \"auth\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"cookies\": {\n \"session\": \"abc123\"\n },\n \"network\": \"base\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.httpayer.com/relay")
.header("Content-Type", "application/json")
.body("{\n \"api_url\": \"https://demo.httpayer.com/base-weather\",\n \"method\": \"GET\",\n \"json\": {},\n \"data\": {},\n \"body\": \"<string>\",\n \"payload\": {},\n \"params\": {},\n \"headers\": {\n \"X-API-KEY\": \"your-target-api-key\",\n \"Authorization\": \"Bearer token123\"\n },\n \"auth\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"cookies\": {\n \"session\": \"abc123\"\n },\n \"network\": \"base\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.httpayer.com/relay")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_url\": \"https://demo.httpayer.com/base-weather\",\n \"method\": \"GET\",\n \"json\": {},\n \"data\": {},\n \"body\": \"<string>\",\n \"payload\": {},\n \"params\": {},\n \"headers\": {\n \"X-API-KEY\": \"your-target-api-key\",\n \"Authorization\": \"Bearer token123\"\n },\n \"auth\": {\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n },\n \"cookies\": {\n \"session\": \"abc123\"\n },\n \"network\": \"base\"\n}"
response = http.request(request)
puts response.read_body{}{
"error": "<string>",
"details": "<string>"
}{
"x402Version": 1,
"accepts": [
{
"scheme": "exact",
"network": "base",
"payTo": "<string>",
"asset": "<string>",
"maxAmountRequired": "<string>",
"resource": "<string>",
"description": "<string>",
"mimeType": "application/json",
"maxTimeoutSeconds": 180
}
]
}{
"error": "Too Many Requests",
"message": "Server is currently processing the maximum number of concurrent requests. Please try again in a moment.",
"details": "Active requests: 50/50",
"retryAfter": 5
}{
"error": "<string>",
"details": "<string>"
}{
"error": "Bad Gateway",
"message": "Upstream API refused payment after 3 attempts",
"webhook_id": "550e8400-e29b-41d4-a716-446655440000"
}Headers
x402 payment header (include on second call after getting payment instructions)
Client timeout in milliseconds
Query Parameters
Response mode. When set to "json", wraps the proxied response as JSON; otherwise returns the raw proxied response as text.
json, text Body
The target API URL to call via the relay
"https://demo.httpayer.com/base-weather"
HTTP method for the target API
GET, POST, PUT, DELETE, PATCH "GET"
JSON body — serialized with Content-Type: application/json. Mirrors Python requests(json=...).
Form-encoded body (object) or raw string body (string). Mirrors Python requests(data=...).
Pre-serialized body string passed through unchanged — Content-Type is NOT set automatically. If you pass an object it will be JSON-stringified, but you must set Content-Type: application/json via headers yourself. Use json instead for automatic Content-Type handling.
Deprecated alias for json. Use json instead.
Query parameters appended to the target URL
Custom headers forwarded to the target API
{
"X-API-KEY": "your-target-api-key",
"Authorization": "Bearer token123"
}
Basic auth shorthand — converted to Authorization: Basic . Mirrors Python requests(auth=(...)).
Show child attributes
Show child attributes
Cookie shorthand — merged into the Cookie header. Mirrors Python requests(cookies={...}).
{ "session": "abc123" }
Blockchain network to use for payment
base, base-sepolia, skale-base, skale-base-sepolia, solana, solana-mainnet-beta, solana-devnet "base"
Response
Relay payment successful. Response headers (included only when applicable):
- X-Client-Payment: Transaction hash of the user's payment to HTTPayer after settlement (e.g., 0x123...)
- X-HTTPayer-Webhook: Webhook ID to track async operation status (payment verification or refund)
- X-Payment-Response: Details of HTTPayer's payment to the target API (v1, base64-encoded JSON)
Response from target API

