Quickstart
Start with a small read to verify your connection before adding subscriptions or transaction traffic.
1. Activate your service
Sign in to the dashboard, choose your product and region, and complete checkout. Open the service details once provisioning finishes.
Copy the access key from your service's details. Keys belong to individual services; use the credential for the product you are connecting to. See authentication.
2. Choose a region
Choose a location close to the server running your application.
| Region | Code | JSON-RPC |
|---|---|---|
| New York | ny | https://rpc.ny.shreds.xyz |
| Frankfurt | fra | https://rpc.fra.shreds.xyz |
| Amsterdam | ams | https://rpc.ams.shreds.xyz |
The endpoint directory also lists SWQoS, WebSocket, and gRPC. Your service must include the selected product and region.
3. Make your first request
Shell examples use Bash syntax and cURL. Set your key locally and change the region if needed.
export SHREDS_API_KEY="YOUR_SERVICE_ACCESS_KEY"
curl --silent --show-error "https://rpc.ny.shreds.xyz/?api-key=$SHREDS_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"jsonrpc":"2.0","id":1,"method":"getSlot","params":[{"commitment":"confirmed"}]}'
A successful response includes a numeric slot. This value is illustrative and changes as the chain advances:
{"jsonrpc":"2.0","result":300000000,"id":1}
4. Connect from JavaScript
This example uses built-in fetch in Node.js 20 or newer. Save it as first-request.mjs and run node first-request.mjs with the environment variable above set.
const key = process.env.SHREDS_API_KEY;
if (!key) throw new Error('Set SHREDS_API_KEY');
const endpoint = new URL('https://rpc.ny.shreds.xyz/');
endpoint.searchParams.set('api-key', key);
const response = await fetch(endpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0', id: 1, method: 'getSlot',
params: [{ commitment: 'confirmed' }],
}),
signal: AbortSignal.timeout(10000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const body = await response.json();
if (body.error) throw new Error(JSON.stringify(body.error));
console.log('Confirmed slot:', body.result);
Next steps
- Explore RPC and transaction submission.
- Open a WebSocket subscription.
- Connect a Yellowstone gRPC client.
- Stream pre-execution transactions with Flash gRPC.
- Configure a Shreds receiver.