cURL
curl --request POST \
--url https://api.pond3r.xyz/v1/messages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"prompt": "Get the current price of ETH"
}
'import requests
url = "https://api.pond3r.xyz/v1/messages"
payload = { "prompt": "Get the current price of ETH" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'Get the current price of ETH'})
};
fetch('https://api.pond3r.xyz/v1/messages', 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.pond3r.xyz/v1/messages",
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([
'prompt' => 'Get the current price of ETH'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.pond3r.xyz/v1/messages"
payload := strings.NewReader("{\n \"prompt\": \"Get the current price of ETH\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.pond3r.xyz/v1/messages")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"Get the current price of ETH\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pond3r.xyz/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"Get the current price of ETH\"\n}"
response = http.request(request)
puts response.read_body{
"processingId": "123e4567-e89b-12d3-a456-426614174000",
"status": "PENDING"
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}Send a Prompt
Submit a natural language query for processing
POST
/
v1
/
messages
cURL
curl --request POST \
--url https://api.pond3r.xyz/v1/messages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"prompt": "Get the current price of ETH"
}
'import requests
url = "https://api.pond3r.xyz/v1/messages"
payload = { "prompt": "Get the current price of ETH" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: 'Get the current price of ETH'})
};
fetch('https://api.pond3r.xyz/v1/messages', 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.pond3r.xyz/v1/messages",
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([
'prompt' => 'Get the current price of ETH'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.pond3r.xyz/v1/messages"
payload := strings.NewReader("{\n \"prompt\": \"Get the current price of ETH\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.pond3r.xyz/v1/messages")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"Get the current price of ETH\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pond3r.xyz/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"Get the current price of ETH\"\n}"
response = http.request(request)
puts response.read_body{
"processingId": "123e4567-e89b-12d3-a456-426614174000",
"status": "PENDING"
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}🚧 Coming Soon
The Messages API is currently being updated to support the new report-focused approach. Check back soon for the latest endpoints.
The Messages API is currently being updated to support the new report-focused approach. Check back soon for the latest endpoints.
Overview
The messages endpoint allows you to submit natural language queries about blockchain data. The API processes messages asynchronously, providing a more robust way to handle longer-running queries.Request Flow
- Submit your query using the
/v1/messagesendpoint - Receive a
processingIdto track your request - Poll the
/v1/messages/{processingId}/statusendpoint to get the final result
Examples
Submitting a Query
const axios = require('axios');
async function submitQuery() {
try {
const response = await axios.post('https://api.pond3r.xyz/v1/messages', {
prompt: 'Get the current price of ETH'
}, {
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
return response.data.processingId;
} catch (error) {
console.error('Error submitting query:', error.response ? error.response.data : error.message);
throw error;
}
}
import requests
def submit_query():
url = 'https://api.pond3r.xyz/v1/messages'
headers = {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
'prompt': 'Get the current price of ETH'
}
try:
response = requests.post(url, json=data, headers=headers)
response.raise_for_status()
return response.json()['processingId']
except requests.exceptions.RequestException as e:
print(f"Error submitting query: {e}")
raise
Checking Status and Getting Results
const axios = require('axios');
async function getResult(processingId) {
try {
const response = await axios.get(`https://api.pond3r.xyz/v1/messages/${processingId}/status`, {
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
return response.data;
} catch (error) {
console.error('Error checking status:', error.response ? error.response.data : error.message);
throw error;
}
}
// Example of waiting for the result
async function waitForResult(processingId, maxAttempts = 30, interval = 2000) {
for (let attempt = 0; attempt < maxAttempts; attempt++) {
const status = await getResult(processingId);
if (status.status === 'FINISHED') {
return status.result;
} else if (status.status === 'ERROR') {
throw new Error(status.errorMessage || 'Processing failed');
}
// Wait before next attempt
await new Promise(resolve => setTimeout(resolve, interval));
}
throw new Error('Timeout waiting for result');
}
// Usage example
async function main() {
try {
const processingId = await submitQuery();
console.log('Processing ID:', processingId);
const result = await waitForResult(processingId);
console.log('Final result:', result);
} catch (error) {
console.error('Error:', error.message);
}
}
import requests
import time
def get_result(processing_id):
url = f'https://api.pond3r.xyz/v1/messages/{processing_id}/status'
headers = {
'x-api-key': 'YOUR_API_KEY'
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f"Error checking status: {e}")
raise
def wait_for_result(processing_id, max_attempts=30, interval=2):
for attempt in range(max_attempts):
status = get_result(processing_id)
if status['status'] == 'FINISHED':
return status['result']
elif status['status'] == 'ERROR':
raise Exception(status.get('errorMessage', 'Processing failed'))
# Wait before next attempt
time.sleep(interval)
raise Exception('Timeout waiting for result')
# Usage example
def main():
try:
processing_id = submit_query()
print('Processing ID:', processing_id)
result = wait_for_result(processing_id)
print('Final result:', result)
except Exception as e:
print('Error:', str(e))
Response Statuses
The status endpoint can return the following statuses:PENDING: The message has been received and is waiting to be processedPROCESSING: The message is currently being processedFINISHED: Processing is complete and the result is availableERROR: An error occurred during processing
Error Handling
When an error occurs, the status response will include anerrorMessage field with details about what went wrong. Common error scenarios include:
- Invalid API key
- Malformed query
- Processing timeout
- Internal server errors
Best Practices
- Always implement proper error handling and retry logic
- Use appropriate polling intervals (2-3 seconds recommended)
- Set reasonable timeouts for your application
- Store the
processingIdfor later reference if needed - Consider implementing a webhook system for production applications
Authorizations
Body
application/json
A natural language query about cryptocurrency prices
Example:
"Get the current price of ETH"
⌘I