🔌

REST API Documentation

HTTP endpoints for integrating Solana blockchain data into any application

API Information

Base URL:https://solanamcp.dev/api
Auth Method:x-api-key header
Content Type:application/json
Response Format:JSON

Authentication

All requests require an API key in the header:

x-api-key: YOUR_API_KEY

Get your API key from the dashboard

Available Endpoints

List All Tools

GET /api/tools/list

Response:
{
  "tools": [
    {
      "name": "get_sol_balance",
      "description": "Get SOL and SPL token balances",
      ...
    }
  ]
}

Execute a Tool

POST /api/tools/{tool_name}
Headers:
  x-api-key: YOUR_API_KEY
  Content-Type: application/json
Body:
{
  "wallet": "7xKXX..."
}

Response:
{
  "success": true,
  "data": {
    "wallet": "7xKXX...",
    "sol": 5.2,
    "tokens": [...]
  }
}

Code Examples

JavaScript/TypeScript

const API_KEY = 'your_api_key';
const API_URL = 'https://solanamcp.dev/api';

async function callTool(toolName, params) {
  const response = await fetch(`${API_URL}/api/tools/${toolName}`, {
    method: 'POST',
    headers: {
      'x-api-key': API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(params)
  });
  
  return response.json();
}

// Usage
const balance = await callTool('get_sol_balance', {
  wallet: '7xKXX...'
});

Python

import requests

API_KEY = 'your_api_key'
API_URL = 'https://solanamcp.dev/api'

def call_tool(tool_name, params):
    response = requests.post(
        f'{API_URL}/api/tools/{tool_name}',
        headers={'x-api-key': API_KEY},
        json=params
    )
    return response.json()

# Usage
balance = call_tool('get_sol_balance', {
    'wallet': '7xKXX...'
})

curl

curl -X POST https://solanamcp.dev/api/tools/get_sol_balance \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"wallet": "7xKXX..."}'

Error Handling

401 Unauthorized: Invalid API key
404 Not Found: Unknown tool name
400 Bad Request: Invalid parameters
429 Too Many Requests: Rate limit exceeded
500 Internal Error: Server error

Rate Limits & Credits

  • Each tool call costs credits (2-25 cents based on complexity)
  • Free tier includes starting credits
  • Purchase more credits as needed
  • All usage tracked in real-time dashboard