Complete Solana API Specification
View the full OpenAPI documentation with all available fields, filters, and
detailed schemas →
Base URL
All Portal requests are made to:{network} with your target blockchain (e.g., solana-mainnet).
Core Endpoints
POST /stream
Stream blockchain data with filters. Includes unfinalized blocks.
POST /finalized-stream
Stream only finalized blocks. Use for production pipelines requiring
certainty.
GET /metadata
Get dataset information: slot range, finality rules, and network details.
GET /timestamps/{timestamp}/block
Resolve a Unix timestamp to the first block at or after it.
Installation
Quick Start Examples
Available Fields
Block Fields
Select which block header fields to retrieve:Transaction Fields
Select transaction data fields:Instruction Fields
Select instruction data fields:Log Fields
Select log message fields:Token Balance Fields
Select token balance fields:Balance Fields
Select SOL balance fields:Reward Fields
Select reward fields:Filtering Options
Instruction Filters
Filter instructions by program, discriminator, or accounts:- Multiple program IDs in one object = OR
- Multiple discriminators in one object = OR
- Multiple filter objects = OR
Transaction Filters
Filter transactions by fee payer:Log Filters
Filter logs by program and kind:Token Balance Filters
Filter token balances by mint or account:Network Selection
Specify the Solana network when creating the data source:View All Networks
See complete list of supported Solana networks
Query Patterns
Pattern 1: Range Query
Query a specific slot range:Pattern 2: Batch Processing
Process large ranges in batches:Pattern 3: Multi-Program Query
Query multiple programs simultaneously:Performance Optimization
1. Request Only Needed Fields
2. Use Specific Filters
3. Optimal Batch Sizes
4. Parallel Queries
Resolve a timestamp to a block
GET /datasets/{dataset}/timestamps/{timestamp}/block returns the number of the first block whose timestamp is greater than or equal to the given Unix timestamp (in seconds). Use it to turn a wall-clock time into a fromBlock for a stream query.
x-sqd-data-source response header reports which one served the result (network or real_time). The endpoint returns 404 if no block at or after the timestamp exists yet.
Stream continuation
A single/stream response is a batch, not the complete range. The server may close the connection at any point: when a worker’s range ends, when a connection is recycled, or at the current dataset head. Clients that treat one HTTP response as the whole query will silently drop slots.
To stream a range to completion, loop:
- Read the last block’s
header.number, issue the next request withfromBlock = lastNumber + 1. - Keep
toBlock,fields, and filters identical across retries. - A
204 No Contentresponse means the range is above the dataset head. For historical queries, you’re done; for open-ended queries, wait and retry.
Handling reorgs near the chain head
When a request starts at or near the chain tip, the block you asked for may no longer be on the canonical chain by the time Portal processes the query. To detect this, passparentBlockHash with each request (the hash of the block immediately before fromBlock):
parentBlockHash, Portal returns HTTP 409 with a list of blocks that are on the current canonical chain:
- Find a block in your local state whose
(number, hash)matches one ofpreviousBlocks. - Roll back your pipeline to that block.
- Resume the stream with
fromBlock = matched.number + 1andparentBlockHash = matched.hash.
/finalized-stream (instead of /stream) never return 409: only finalized blocks are served, so there’s nothing to reorg. Use that endpoint when you don’t need real-time data.
Error Handling
Common Use Cases
Use Case 1: Instruction Monitoring
Monitor specific program instructions:Use Case 2: Transaction Tracking
Track transactions from/to specific addresses:Use Case 3: Analytics Pipeline
Build analytics on blockchain data:Request Structure Reference
Every Portal request follows this structure:Response Format
Portal returns newline-delimited JSON (NDJSON), with one block per line:Common Patterns
Batch Processing
Batch Processing
Process large slot ranges by splitting into manageable chunks:
Real-time Streaming
Real-time Streaming
Stream new blocks as they arrive using /finalized-stream:
Error Handling
Error Handling
Handle rate limits and network errors gracefully:
Complete API Specification
For the complete OpenAPI specification with all available fields, options, and detailed schemas:Full Solana API Specification
View complete OpenAPI documentation with all endpoints, fields, and options →
Next Steps
View Examples
Explore practical Portal examples for common use cases
Supported Networks
See complete list of supported Solana networks
Quickstart Guide
Make your first Portal request in 5 minutes