Skip to content

Latest commit

 

History

History
397 lines (336 loc) · 8.19 KB

File metadata and controls

397 lines (336 loc) · 8.19 KB
title Getting Started
description Get started with the SolixDB REST/JSON-RPC API in minutes

This guide will help you get started with the SolixDB API and make your first request to query Solana DeFi data.

Prerequisites

  • HTTP client (curl, Postman, or your preferred tool)
  • API key from dashboard.solixdb.xyz
  • Basic understanding of JSON-RPC 2.0 or SQL

API Endpoints

JSON-RPC API

POST https://api.solixdb.xyz/v1/rpc

SQL Query API

POST https://api.solixdb.xyz/v1/query

Making Your First Request

JSON-RPC: Get Transactions

The simplest way to get started is with a basic JSON-RPC request:

```bash curl curl -X POST "https://api.solixdb.xyz/v1/rpc" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "getTransactions", "params": [{ "limit": 10, "filters": { "protocols": ["drift_v2"] } }] }' ```
const response = await fetch('https://api.solixdb.xyz/v1/rpc', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'getTransactions',
    params: [{
      limit: 10,
      filters: {
        protocols: ['drift_v2']
      }
    }]
  })
});

const data = await response.json();
console.log(data.result.data);
import requests

response = requests.post(
    'https://api.solixdb.xyz/v1/rpc',
    headers={
        'Content-Type': 'application/json',
        'x-api-key': 'YOUR_API_KEY'
    },
    json={
        'jsonrpc': '2.0',
        'id': 1,
        'method': 'getTransactions',
        'params': [{
            'limit': 10,
            'filters': {
                'protocols': ['drift_v2']
            }
        }]
    }
)

data = response.json()
print(data['result']['data'])

SQL Query: Simple SELECT

Alternatively, you can use SQL queries:

```bash curl curl -X POST "https://api.solixdb.xyz/v1/query" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "query": "SELECT signature, protocol_name, fee FROM transactions WHERE protocol_name = '\''jupiter_v6'\'' LIMIT 10", "format": "json" }' ```
const response = await fetch('https://api.solixdb.xyz/v1/query', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    query: 'SELECT signature, protocol_name, fee FROM transactions WHERE protocol_name = \'jupiter_v6\' LIMIT 10',
    format: 'json'
  })
});

const data = await response.json();
console.log(data.data);
import requests

response = requests.post(
    'https://api.solixdb.xyz/v1/query',
    headers={
        'Content-Type': 'application/json',
        'x-api-key': 'YOUR_API_KEY'
    },
    json={
        'query': 'SELECT signature, protocol_name, fee FROM transactions WHERE protocol_name = \'jupiter_v6\' LIMIT 10',
        'format': 'json'
    }
)

data = response.json()
print(data['data'])
**Note:** SQL queries automatically get a default LIMIT of 1000 if not specified. Maximum allowed LIMIT is 10,000.

Understanding the Response

JSON-RPC Response

JSON-RPC responses follow the JSON-RPC 2.0 specification:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "data": [
      {
        "signature": "5VERv8NMxzbPDohNpJhHopN2C9R4G5GaPevYf5hLJ8Z7",
        "slot": "123456789",
        "blockTime": 1735689600,
        "protocolName": "jupiter_v6",
        "fee": 5000,
        "computeUnits": 200000,
        "success": true
      }
    ]
  }
}

SQL Query Response

SQL query responses:

{
  "data": [
    {
      "signature": "5VERv8NMxzbPDohNpJhHopN2C9R4G5GaPevYf5hLJ8Z7",
      "protocol_name": "jupiter_v6",
      "fee": "5000"
    }
  ],
  "count": 10,
  "query": "SELECT signature, protocol_name, fee FROM transactions WHERE protocol_name = 'jupiter_v6' LIMIT 10"
}

Error Responses

If there's an error, the response will include error information:

JSON-RPC:

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32000,
    "message": "Server error",
    "data": "Invalid filter parameter"
  }
}

SQL Query:

{
  "error": "Invalid query",
  "message": "Query must be a non-empty string"
}

Advanced Examples

Get Transactions for Address

Query transactions for a specific Solana address:

const response = await fetch('https://api.solixdb.xyz/v1/rpc', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'getTransactionsForAddress',
    params: [
      'YOUR_ADDRESS_HERE',
      {
        transactionDetails: 'full',
        sortOrder: 'asc',
        limit: 100,
        filters: {
          blockTime: {
            gte: 1735689600,  // Jan 1, 2025
            lte: 1738368000   // Jan 31, 2025
          },
          status: 'succeeded'
        }
      }
    ]
  })
});

const data = await response.json();
console.log('Transactions:', data.result.data);

Get Transaction by Signature

Get a specific transaction by its signature:

const response = await fetch('https://api.solixdb.xyz/v1/rpc', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'getTransaction',
    params: ['TRANSACTION_SIGNATURE_HERE']
  })
});

const data = await response.json();
console.log('Transaction:', data.result);

SQL Query with Filters

Use SQL for complex queries:

const response = await fetch('https://api.solixdb.xyz/v1/query', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    query: `
      SELECT 
        protocol_name,
        COUNT(*) as count,
        AVG(fee) as avg_fee
      FROM transactions
      WHERE protocol_name IN ('jupiter_v6', 'pump_fun')
        AND date >= '2025-01-01'
        AND date <= '2025-01-31'
      GROUP BY protocol_name
      ORDER BY count DESC
    `,
    format: 'json'
  })
});

const data = await response.json();
console.log('Results:', data.data);
**Note:** The query above will automatically have `LIMIT 1000` appended if you don't specify one. You can add your own LIMIT (up to 10,000).

Supported Protocols

Currently, we support the following DEX protocols:

  • jupiter_v4 - Jupiter Aggregator V4
  • jupiter_v6 - Jupiter Aggregator V6
  • raydium_amm_v3 - Raydium AMM V3
  • raydium_cp_swap - Raydium CP Swap
  • pump_fun - Pump.fun
  • pump_amm - Pump AMM
  • whirlpool - Orca Whirlpool
We're continuously adding support for more protocols. Check our [changelog](https://github.com/solixdb) for updates.

Authentication

All API endpoints require an API key. Include it in the x-api-key header or as an api-key query parameter.

For details on authentication and rate limiting, see our [Authentication](/authentication) and [Rate Limiting](/rate-limiting) guides.

Next Steps

Now that you've made your first request, explore these resources:

Explore all available methods and parameters. See real-world examples for common use cases. Learn about API keys and security. Understand how to handle errors gracefully. Learn about plan-based rate limits. Learn about SQL query execution.