# Portfolio & Account

## Portfolio & Account

*Who is signed in and which account context applies*

Resolve the authenticated user's identity and account CIDs with a single call — the foundation for scoping portfolio and trading flows to the correct user and account in your integration.

### What it provides

- GET `/identity` — resolve the authenticated user's ID and account CIDs in one call
- Confirm API key and user key context before executing trading or data operations
- Retrieve account-level metadata for multi-account architectures
- Align backend records with eToro account identifiers for reconciliation and support
- Foundation call for scoping all downstream portfolio and trading requests

### What you can build

- Account switchers and onboarding flows that verify and display the current eToro user
- Server-side session binding between your app's user model and eToro CIDs
- Audit trails that record which account and user executed each API action
- Multi-tenant platforms that map external users to eToro identities securely

### Builder journeys

- Personal investing
- Build apps & automations
- Enterprise integrations

### Recommended tools

- [Authentication guide](/learn/authentication-and-api-keys) — Scoped keys and secure credential handling for account-level data.
- [Getting started](/learn/getting-started-with-etoro-api-v2) — First API call, response formats, and demo vs. real environment setup.
- [REST Playground](/playground) — Read holdings, P&L, and account balances live in the API explorer.

### Code examples

#### cURL

```bash
curl https://public-api.etoro.com/api/v1/identity \
  -H "x-api-key: $ETORO_API_KEY" \
  -H "x-user-key: $ETORO_USER_KEY" \
  -H "x-request-id: $(uuidgen)"
```

#### JavaScript

```javascript
const res = await fetch(
  "https://public-api.etoro.com/api/v1/identity",
  {
    headers: {
      "x-api-key": process.env.ETORO_API_KEY,
      "x-user-key": process.env.ETORO_USER_KEY,
      "x-request-id": crypto.randomUUID(),
    },
  }
);

const { userId, accountCids } = await res.json();
console.log("User:", userId, "Accounts:", accountCids);
```


### Learn & docs

- [Authentication & API Keys Deep Dive](/learn/authentication-and-api-keys) — Key management, storage, and troubleshooting.
- [Getting Started with the eToro API](/learn/getting-started-with-etoro-api-v2) — First requests and response shapes.