# Getting Started with the eToro API (v1)

Learn how to get your API keys, make your first request, and understand eToro API response formats.

---


## Prerequisites

Before you begin, you'll need:

- An eToro account (sign up at [etoro.com](https://www.etoro.com))
- API credentials from the [eToro API Portal](https://api-portal.etoro.com)
- A basic understanding of REST APIs
- Node.js 18+ or Python 3.8+ installed

## Getting Your API Keys

1. Visit [api-portal.etoro.com](https://api-portal.etoro.com) and sign in with your eToro account
2. Navigate to **Settings → Trading → API Key Management** and click **Create New Key**
3. Copy your **API key** (`x-api-key`) and **User key** (`x-user-key`)
4. Store them securely — never commit API keys to version control

## Your First API Request

Let's fetch a list of available instruments using the eToro API.

### Using JavaScript

```javascript skip-test
import { randomUUID } from "node:crypto";

const API_BASE = "https://public-api.etoro.com/api/v1";

const response = await fetch(`${API_BASE}/market-data/instruments`, {
  headers: {
    "x-api-key": process.env.ETORO_API_KEY,
    "x-user-key": process.env.ETORO_USER_KEY,
    "x-request-id": randomUUID(),
    "Accept": "application/json",
  },
});

const data = await response.json();
console.log(`Found ${data.instruments.length} instruments`);
```

### Using cURL

```bash skip-test
curl -X GET "https://public-api.etoro.com/api/v1/market-data/instruments" \
  -H "x-api-key: $ETORO_API_KEY" \
  -H "x-user-key: $ETORO_USER_KEY" \
  -H "x-request-id: $(uuidgen)" \
  -H "Accept: application/json"
```

### Using Python

```python skip-test
import os
import uuid
import requests

API_BASE = "https://public-api.etoro.com/api/v1"

headers = {
    "x-api-key": os.environ["ETORO_API_KEY"],
    "x-user-key": os.environ["ETORO_USER_KEY"],
    "x-request-id": str(uuid.uuid4()),
    "Accept": "application/json",
}

response = requests.get(f"{API_BASE}/market-data/instruments", headers=headers)
data = response.json()
print(f"Found {len(data['instruments'])} instruments")
```

## Understanding the Response

eToro API responses contain your requested data. Include an `x-request-id` header on every call so support can trace issues back to specific requests.

Common HTTP status codes:

- **200** — Success
- **400** — Bad request (check your parameters)
- **401** — Unauthorized (check your API key and user key)
- **429** — Rate limited (respect `Retry-After` header and slow down)
- **500** — Server error (retry with exponential backoff)

## Rate Limits

The eToro API enforces rate limits. Exceeding your limit returns `429 Too Many Requests` with a `Retry-After` header. Always respect that header before retrying.

For current rate limit details, see the [Rate Limits documentation](https://api-portal.etoro.com/getting-started/rate-limits).

## Next Steps

Now that you've made your first request, explore these guides:

- [Real-Time Market Data with WebSockets](/learn/real-time-market-data-websocket) — Stream live prices
- [Building an Algo Trading Bot](/learn/building-an-algo-trading-bot) — Automate your strategy
- [API Reference](https://api-portal.etoro.com/api-reference) — Full endpoint documentation
