Starkscan
Getting started

Get your first API key

Create a Starkscan API key and make your first authenticated call in under five minutes.

Get your first API key

One key works across REST, the TypeScript SDK, the CLI, and hosted MCP. This page takes you from no key to a successful call.

1. Create a key

  1. Open the API keys page.
  2. Sign in (or create an account).
  3. Create a key and copy it. You see the full value once — store it in an environment variable or secrets manager. Never paste it into chat, tickets, screenshots, PR comments, or source. Rotate it if the full value ever leaks.

2. Set your environment

export STARKSCAN_CHAIN="SN_MAIN"
export STARKSCAN_API_KEY="<your key>"
# Optional: only set this for preview or self-hosted hosts.
# export STARKSCAN_BASE_URL="https://preview.example.com/api"

The hosted CLI, SDK, and MCP launcher default to https://api.starkscan.co. Set STARKSCAN_BASE_URL only when you are targeting preview or a custom host. For raw HTTP path details, see Base URLs and chains.

3. Make your first call

curl -H "X-Starkscan-Api-Key: $STARKSCAN_API_KEY" \
  "${STARKSCAN_BASE_URL:-https://api.starkscan.co}/v1/$STARKSCAN_CHAIN/status"

Success looks like a JSON object with chainId, headBlockNumber, latestIndexedBlockNumber, and lagBlocks.

Use the same key everywhere

SurfaceHow
RESTSend the X-Starkscan-Api-Key header — see Authentication.
TypeScript SDKcreateStarkscanClient({ apiKey, chainId }) — add baseUrl only for preview or self-hosted hosts; see TypeScript SDK.
CLInpx -y @starkscan/[email protected] ... — see Agent CLI.
MCPConnect the hosted MCP server — see MCP quickstart.

RPC beta keys

Self-serve keys are the default path for REST, SDK, CLI, and hosted MCP. The Starkscan JSON-RPC provider beta is not self-serve yet. Ask through your Starkscan partner or support channel if you need POST /api/v1/SN_MAIN/rpc, a nodeUrl compatibility token, higher batch/concurrency limits, or enrolled write forwarding for already-signed transactions.

An RPC beta enrollment issues scoped keys for the approved workspace:

  • read and batch for normal JSON-RPC beta traffic
  • optional write only for the signed-write beta
  • optional URL-token compatibility key for clients that cannot send headers

Treat URL-token nodeUrl values as secrets. Header auth is preferred whenever your client can send X-Starkscan-Api-Key.

If your first call fails

A 401 means the key is missing or wrong, and a 403 means the key is valid but the route is not in your tier. See Authentication for the full list and fixes.

On this page