API Reference

Authentication

Learn how to authenticate your API requests with $PYRE token payments.

Overview

PYRE uses a wallet-based authentication system. Instead of API keys, you authenticate using your Solana wallet address and prove payment with transaction signatures.

No API Keys Required

Your wallet address is your identity. No need to manage API keys or secrets.

Required Headers

Every API request must include the following headers:

HeaderRequiredDescription
x-wallet-addressYesYour Solana wallet address
x-payment-proofYes*Base64-encoded payment transaction proof
Content-TypeYesapplication/json

* Not required for free endpoints like /api/health

Example Request

cURL
curl -X POST https://pyrefm.xyz/api/ai/chat \
  -H "Content-Type: application/json" \
  -H "x-wallet-address: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" \
  -H "x-payment-proof: eyJ3YWxsZXQiOiI5V3pEWHdCYm..." \
  -d '{"message": "Hello!"}'

Payment Flow

Here's how authentication with payment works:

1

Request Without Payment

Call the API with just your wallet address (no payment proof)

Response: 402 Payment Required + pricing info
2

Make Payment

Send required $PYRE tokens to the payment wallet

Transaction: burn 30%, transfer rest
3

Request With Payment Proof

Include the transaction signature in x-payment-proof header

Response: 200 OK + API data + payment receipt

402 Payment Required Response

When you call a paid endpoint without payment, you'll receive:

Response (402)
{
  "error": "Payment required",
  "code": "PAYMENT_REQUIRED",
  "pricing": {
    "endpoint": "/api/ai/chat",
    "priceUSD": 0.05,
    "tokenPrice": 0.001,
    "requiredTokens": 50
  },
  "distribution": {
    "burn": "30%",
    "provider": "50%",
    "holders": "15%",
    "treasury": "5%"
  },
  "burnInfo": {
    "percentage": 30,
    "tokensToBurn": 15
  },
  "paymentWallet": "71w4H4CyT8PfyAzEcmmh7DLjeqg6eA84McvvdRkYM3Rp",
  "tokenMint": "PYRE_TOKEN_MINT_ADDRESS"
}

Error Codes

CodeStatusDescription
NO_WALLET401Missing x-wallet-address header
PAYMENT_REQUIRED402Payment needed to access endpoint
INVALID_PAYMENT402Payment proof is invalid or expired
INSUFFICIENT_BALANCE402Wallet doesn't have enough $PYRE

Free Endpoints

The following endpoints don't require payment:

  • GET/api/healthAPI status
  • GET/api/token/price$PYRE price
  • GET/api/token/burn-statsBurn statistics

Next Steps