Endpoint URL Structure

https://tpg.sanctum.so/{cluster}?apiKey={apiKey}

Path Parameters

{cluster} (required)

Specifies the Solana cluster targeted for transactions. Supported Clusters:
Cluster ValueDescription
mainnetSolana Mainnet Beta
devnetSolana Development Network

Query Parameters

apiKey (required)

The unique authentication key assigned to your project. Example:
01ARZ3NDEKTSV4RRFFQ69G5FAV

Usage Example

Below is a basic example demonstrating how to optimize a transaction:
const response = await fetch('https://tpg.sanctum.so/mainnet?apiKey=your-api-key', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 'my-request-id',
    method: 'optimizeTransaction',
    params: {
      transactions: [
        {
          params: [getBase64EncodedWireTransaction(tx)]
        }
      ]
    }
  })
});

Security Best Practices

Protecting Your API Key:
  • Do not expose API keys in client-side code, repositories, or publicly accessible areas.
  • Store API keys using environment variables or dedicated secrets management tools.
  • Maintain separate API keys for distinct environments (development, staging, production).

Next Steps

  • Learn how to optimize your transactions here
  • Learn how to deliver optimized transactions here