---
title: "Create User Token (v2)"
method: POST
path: "/api/v2/agent-portfolios/{agentPortfolioId}/user-tokens"
tags: ["Agent Portfolios"]
---

# Create User Token (v2)

`POST /api/v2/agent-portfolios/{agentPortfolioId}/user-tokens`

## Request

- Base URL: `https://public-api.etoro.com`
- URL: `https://public-api.etoro.com/api/v2/agent-portfolios/{agentPortfolioId}/user-tokens`
- Auth: OAuth 2
  - Authorization code
  - Scopes: `etoro-public:agent-portfolio:write`
- TypeScript: <https://skmtc.dev/etoro/apis/etoro-api/docs/api/v2/agent-portfolios/:agentPortfolioId/user-tokens/post.ts> (a function with typed inputs; its response is checked against the schema)

**Rate limit:** 60 requests per 60 seconds. This is the **default shared quota** — it is shared with every other endpoint that has no dedicated limit, so requests across those endpoints all draw from the same budget.

---

Creates a new user token for the specified agent-portfolio using scope names. Scopes are specified by name (scopeNames); scope ids are not supported in v2.

## Path parameters

- `agentPortfolioId` string, uuid, required

## Headers

- `x-request-id` string, uuid, required
- `x-api-key` string, password, required
- `x-user-key` string, password, required

## Request body

- CreateUserTokenV2Request
  - `userTokenName` string, required: A human-readable name to identify the user token.
  - `scopeNames` string[], required: The set of permission scope names to grant to this token. Available scopes: etoro-public:trade.real:read, etoro-public:trade.real:write, etoro-public:trade.demo:read, etoro-public:trade.demo:write.
  - `ipsWhitelist` string[]: An optional set of IPv4 addresses allowed to use this token.
  - `expiresAt` string, date-time: An optional expiration date and time for the token in UTC.

## Response `201`

User token created successfully

- AgentPortfolioApiCreateUserTokenResponse
  - `userTokenId` string, uuid: The unique identifier of the newly created user token.
  - `userToken` string: The generated user token secret. Only available at creation time.
  - `userTokenName` string: The display name of the user token.
  - `clientId` string, uuid: The client identifier of the application the token is associated with.
  - `ipsWhitelist` string[]: The IPv4 addresses from which the token is allowed to be used. Null or empty when unrestricted.
  - `scopeNames` string[]: The authorized scope names granted to the token.
  - `expiresAt` string, date-time, nullable: The UTC expiration date of the token. Null when the token does not expire.
  - `createdAt` string, date-time: The UTC timestamp at which the token was created.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden — a requested scope name is not allowed
- `404`: Agent-portfolio not found
- `409`: Conflict — a user token with the requested name already exists for this agent-portfolio
- `429`: Too Many Requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/etoro/apis/etoro-api.md) - [All operations](https://skmtc.dev/etoro/apis/etoro-api/llms.txt) - [OpenAPI document](https://skmtc.dev/etoro/apis/etoro-api/revisions/69c1fb266c35?raw)
