# Quickstart

> Account sign-up, API key and a first Solana RPC call in cURL, TypeScript, Python or Rust.

Source: https://docs.constant-k.com/get-started/quickstart/

From sign-up to a working Solana RPC call. The code examples need Node.js 20 or later, Python 3, or Rust.

### Getting an account

Accounts are created at [constant-k.com/registration](https://www.constant-k.com/registration/).

### Plan activation

Plans are activated on the [pricing page](https://www.constant-k.com/pricing/). Free includes Solana RPC for testing. Paid plans raise the limits and add WebSockets, Kaldera gRPC and ShredPrism. See [Plans & Limits](https://docs.constant-k.com/get-started/plans-and-limits/).

### API key

The **Endpoints** section of [My Account](https://www.constant-k.com/my-account/) holds your API key and your endpoint URLs.

An environment variable holds the key:

```bash
export CK_API_KEY="YOUR_API_KEY"
```

A key committed to a repository, or shipped in browser code, is readable by anyone. See [Key handling](https://docs.constant-k.com/get-started/authentication/#key-handling).

### First call

`getSlot` is available on every plan, including Free.

**cURL**

```bash
curl "https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getSlot"}'
```

**TypeScript**

An ES module project with [`@solana/kit`](https://www.npmjs.com/package/@solana/kit):

```bash
mkdir ck-quickstart && cd ck-quickstart
npm init -y
npm pkg set type=module
npm install @solana/kit
```

```ts title="quickstart.ts"
import { createSolanaRpc } from "@solana/kit";

const rpc = createSolanaRpc(
  `https://rpc-newyork.constant-k.com/?api-key=${process.env.CK_API_KEY}`,
);

const slot = await rpc.getSlot().send();
console.log("Current slot:", slot);
```

The script runs with `npx tsx quickstart.ts`.

**Python**

```bash
pip install requests
```

```python title="quickstart.py"
import os
import requests

url = f"https://rpc-newyork.constant-k.com/?api-key={os.environ['CK_API_KEY']}"
payload = {"jsonrpc": "2.0", "id": 1, "method": "getSlot"}

response = requests.post(url, json=payload, timeout=10)
body = response.json()
if "error" in body:
    raise RuntimeError(body["error"])

print("Current slot:", body["result"])
```

**Rust**

The project is `cargo new ck-quickstart`, with these dependencies:

```toml title="Cargo.toml"
[dependencies]
anyhow = "1"
solana-commitment-config = "3.1"
solana-rpc-client = "4.2"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
```

```rust title="src/main.rs"
use solana_commitment_config::CommitmentConfig;
use solana_rpc_client::nonblocking::rpc_client::RpcClient;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let url = format!(
        "https://rpc-newyork.constant-k.com/?api-key={}",
        std::env::var("CK_API_KEY")?
    );
    let client = RpcClient::new_with_commitment(url, CommitmentConfig::confirmed());

    let slot = client.get_slot().await?;
    println!("Current slot: {slot}");
    Ok(())
}
```

The binary runs with `cargo run`.

A successful call returns the slot number:

```json
{ "jsonrpc": "2.0", "result": 447913193, "id": 1 }
```

`401` or `403` means the key is missing or wrong. See [Authentication](https://docs.constant-k.com/get-started/authentication/).

### The endpoint in other tools

The endpoint URL works anywhere that accepts a custom Solana RPC URL: wallets, trading bots, Jupiter, scripts and SDKs. It is the full URL, key included:

```text
https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY
```

The region closest to your servers gives the lowest latency. See [Endpoints](https://docs.constant-k.com/get-started/endpoints/).

## Next steps

- [Sending Transactions](https://docs.constant-k.com/rpc/sending-transactions/)

- [WebSockets](https://docs.constant-k.com/rpc/websockets/)

- [Kaldera Quickstart](https://docs.constant-k.com/kaldera/quickstart/)

- [Plans & Limits](https://docs.constant-k.com/get-started/plans-and-limits/)
