eToro Agent Portfolios API

The Agent Portfolios API from eToro — 8 operation(s) for agent portfolios.

OpenAPI Specification

etoro-agent-portfolios-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Deprecated eToro Public API operations Agent Portfolios API
  version: v1.158.0
  description: Snapshot of API operations that existed in the previous docs OpenAPI file and are no longer present in the current upstream Swagger.
tags:
- name: Agent Portfolios
paths:
  /api/v1/agent-portfolios:
    get:
      tags:
      - Agent Portfolios
      summary: Get Agent Portfolios
      description: Retrieves all agent-portfolios belonging to the authenticated user.
      operationId: getAgentPortfolios
      responses:
        '200':
          description: Agent-portfolios retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAgentPortfoliosResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: Unauthorized
                errorMessage: Unauthorized
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: TooManyRequests
                errorMessage: Too many requests
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UnhandledException
                errorMessage: Global Error
      parameters:
      - name: x-request-id
        in: header
        required: true
        schema:
          type: string
          format: uuid
          example: b0a205f2-b2d2-42b2-9185-372deba22fa4
        description: A unique request identifier.
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
        description: API key for authentication.
      - name: x-user-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
        description: User-specific authentication key.
    post:
      tags:
      - Agent Portfolios
      summary: Create Agent Portfolio
      deprecated: true
      description: '[DEPRECATED — use POST /api/v2/agent-portfolios (scope names) instead] Creates a new agent-portfolio — a dedicated user account that receives its own fixed virtual balance (returned in agentPortfolioVirtualBalance). IMPORTANT: investmentAmountInUsd is the amount deducted from YOUR (the caller''s) account balance to copy-trade this agent-portfolio — it is NOT the agent-portfolio''s own balance. Positions are mirrored proportionally: e.g. if you invest $2,000 and agentPortfolioVirtualBalance is $10,000, each position is copied at 20% of its size into your account.'
      operationId: createAgentPortfolio
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentPortfolioRequest'
      responses:
        '201':
          description: Agent-portfolio and user token created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAgentPortfolioResponse'
        '207':
          description: Agent-portfolio created but user token provisioning failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAgentPortfolioPartialResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                NameTooShort:
                  summary: Agent-portfolio name too short
                  value:
                    errorCode: ValidationFailed
                    errorMessage: Agent-portfolio name must be between 6 and 10 characters
                InvestmentBelowMinimum:
                  summary: Investment amount below minimum
                  value:
                    errorCode: ValidationFailed
                    errorMessage: Investment amount is below the minimum threshold
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: Unauthorized
                errorMessage: Unauthorized
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: TooManyRequests
                errorMessage: Too many requests
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UnhandledException
                errorMessage: Global Error
      parameters:
      - name: x-request-id
        in: header
        required: true
        schema:
          type: string
          format: uuid
          example: 2280f6b8-2224-44ff-b0fe-a4b7d5c86af0
        description: A unique request identifier.
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
        description: API key for authentication.
      - name: x-user-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
        description: User-specific authentication key.
  /api/v1/agent-portfolios/{agentPortfolioId}:
    delete:
      tags:
      - Agent Portfolios
      summary: Delete Agent Portfolio
      description: Permanently removes a agent-portfolio by revoking all user tokens, stopping the copy mirror, and deleting from storage.
      operationId: deleteAgentPortfolio
      parameters:
      - name: x-request-id
        in: header
        required: true
        schema:
          type: string
          format: uuid
          example: ed18a032-7968-4134-b214-63fe4ce2472e
        description: A unique request identifier.
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
        description: API key for authentication.
      - name: x-user-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
        description: User-specific authentication key.
      - name: agentPortfolioId
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: The unique identifier of the agent-portfolio to delete.
      responses:
        '204':
          description: Agent-portfolio was successfully removed
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: ValidationFailed
                errorMessage: Invalid agent-portfolio ID
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: Unauthorized
                errorMessage: Unauthorized
        '404':
          description: Agent-portfolio not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: NotFound
                errorMessage: Agent-portfolio not found
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: TooManyRequests
                errorMessage: Too many requests
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UnhandledException
                errorMessage: Global Error
  /api/v1/agent-portfolios/{agentPortfolioId}/user-tokens:
    post:
      tags:
      - Agent Portfolios
      summary: Create User Token
      deprecated: true
      description: '[DEPRECATED — use POST /api/v2/agent-portfolios/{agentPortfolioId}/user-tokens (scope names) instead] Creates a new user token for the specified agent-portfolio.'
      operationId: createAgentPortfolioUserToken
      parameters:
      - name: x-request-id
        in: header
        required: true
        schema:
          type: string
          format: uuid
          example: c267d233-e0c3-4a8a-bc6b-d17b941ff6da
        description: A unique request identifier.
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
        description: API key for authentication.
      - name: x-user-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
        description: User-specific authentication key.
      - name: agentPortfolioId
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: The unique identifier of the agent-portfolio.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserTokenRequest'
      responses:
        '201':
          description: User token created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateUserTokenResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                ScopeIdsRequired:
                  summary: Scope IDs are required
                  value:
                    errorCode: ScopeIdsRequired
                    errorMessage: ScopeIds is required
                InvalidIp:
                  summary: Invalid IP address
                  value:
                    errorCode: IpsWhitelistInvalidIp
                    errorMessage: IpsWhitelist contains an invalid IPv4 address
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: Unauthorized
                errorMessage: Unauthorized
        '404':
          description: Agent-portfolio not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: NotFound
                errorMessage: Agent-portfolio not found
        '409':
          description: Conflict — a user token with the requested name already exists for this agent-portfolio
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UserKeyNameAlreadyExists
                errorMessage: UserKeyName already exists
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: MaxUserTokensExceeded
                errorMessage: Maximum number of user tokens exceeded
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UnhandledException
                errorMessage: Global Error
  /api/v1/agent-portfolios/{agentPortfolioId}/user-tokens/{userTokenId}:
    delete:
      tags:
      - Agent Portfolios
      summary: Delete User Token
      description: Permanently revokes the specified user token from a agent-portfolio.
      operationId: deleteAgentPortfolioUserToken
      parameters:
      - name: x-request-id
        in: header
        required: true
        schema:
          type: string
          format: uuid
          example: 0dd4f9c9-56c8-48f0-8f4a-efdd68968456
        description: A unique request identifier.
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
        description: API key for authentication.
      - name: x-user-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
        description: User-specific authentication key.
      - name: agentPortfolioId
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: The unique identifier of the agent-portfolio.
      - name: userTokenId
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: The unique identifier of the user token to delete.
      responses:
        '204':
          description: User token revoked successfully
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: ValidationFailed
                errorMessage: Invalid agent-portfolio ID or user token ID
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: Unauthorized
                errorMessage: Unauthorized
        '404':
          description: Agent-portfolio not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: NotFound
                errorMessage: Agent-portfolio not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UnhandledException
                errorMessage: Global Error
    patch:
      tags:
      - Agent Portfolios
      summary: Update User Token
      deprecated: true
      description: '[DEPRECATED — use PATCH /api/v2/agent-portfolios/{agentPortfolioId}/user-tokens/{userTokenId} (scope names) instead] Updates the settings of an existing user token for a agent-portfolio. At least one field must be provided.'
      operationId: updateAgentPortfolioUserToken
      parameters:
      - name: x-request-id
        in: header
        required: true
        schema:
          type: string
          format: uuid
          example: acfc5a98-fefd-4fb5-8774-543f74274e81
        description: A unique request identifier.
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
        description: API key for authentication.
      - name: x-user-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
        description: User-specific authentication key.
      - name: agentPortfolioId
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: The unique identifier of the agent-portfolio.
      - name: userTokenId
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: The unique identifier of the user token to update.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateUserTokenRequest'
      responses:
        '204':
          description: User token updated successfully
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                NoChanges:
                  summary: No changes provided
                  value:
                    errorCode: NoChangesDetected
                    errorMessage: At least one field must be provided
                InvalidScopes:
                  summary: Invalid scope IDs
                  value:
                    errorCode: ScopeIdNotAllowed
                    errorMessage: ScopeIds contains values not in the allowed set
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: Unauthorized
                errorMessage: Unauthorized
        '404':
          description: Agent-portfolio or user token not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                AgentPortfolioNotFound:
                  summary: Agent-portfolio not found
                  value:
                    errorCode: NotFound
                    errorMessage: Agent-portfolio not found
                UserTokenNotFound:
                  summary: User token not found
                  value:
                    errorCode: NotFound
                    errorMessage: User token not found
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: TooManyRequests
                errorMessage: Too many requests
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UnhandledException
                errorMessage: Global Error
  /api/v2/agent-portfolios:
    post:
      tags:
      - Agent Portfolios
      summary: Create Agent Portfolio (v2)
      description: 'Creates a new agent-portfolio using scope names. Scopes are specified by name (scopeNames); scope ids are not supported in v2. IMPORTANT: investmentAmountInUsd is the amount deducted from YOUR (the caller''s) account balance to copy-trade this agent-portfolio — it is NOT the agent-portfolio''s own balance. Positions are mirrored proportionally: e.g. if you invest $2,000 and agentPortfolioVirtualBalance is $10,000, each position is copied at 20% of its size into your account.'
      operationId: createAgentPortfolioV2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentPortfolioV2Request'
      responses:
        '201':
          description: Agent-portfolio and user token created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAgentPortfolioV2Response'
        '207':
          description: Agent-portfolio created but user token provisioning failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAgentPortfolioPartialResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                ScopeNameNotAllowed:
                  summary: Scope name not allowed
                  value:
                    errorCode: ScopeNameNotAllowed
                    errorMessage: Scope name not allowed
                NameTooShort:
                  summary: Agent-portfolio name too short
                  value:
                    errorCode: ValidationFailed
                    errorMessage: Agent-portfolio name must be between 6 and 10 characters
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: Unauthorized
                errorMessage: Unauthorized
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: TooManyRequests
                errorMessage: Too many requests
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UnhandledException
                errorMessage: Global Error
      parameters:
      - name: x-request-id
        in: header
        required: true
        schema:
          type: string
          format: uuid
          example: 1f7bab86-9687-4f77-9714-7caae8542911
        description: A unique request identifier.
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
        description: API key for authentication.
      - name: x-user-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
        description: User-specific authentication key.
  /api/v2/agent-portfolios/user-tokens/scopes:
    get:
      tags:
      - Agent Portfolios
      summary: Get Allowed Scopes (v2)
      description: Returns the permission scope names that may be assigned to agent-portfolio user tokens.
      operationId: getAgentPortfolioAllowedScopesV2
      responses:
        '200':
          description: Allowed scopes retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAllowedScopesResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: Unauthorized
                errorMessage: Unauthorized
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: TooManyRequests
                errorMessage: Too many requests
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UnhandledException
                errorMessage: Global Error
      parameters:
      - name: x-request-id
        in: header
        required: true
        schema:
          type: string
          format: uuid
          example: 0b9f5b04-1fc4-492a-a2c2-02731caf3ce4
        description: A unique request identifier.
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
        description: API key for authentication.
      - name: x-user-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
        description: User-specific authentication key.
  /api/v2/agent-portfolios/{agentPortfolioId}/user-tokens:
    post:
      tags:
      - Agent Portfolios
      summary: Create User Token (v2)
      description: 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.
      operationId: createAgentPortfolioUserTokenV2
      parameters:
      - name: x-request-id
        in: header
        required: true
        schema:
          type: string
          format: uuid
          example: 8651915d-62c3-4941-a275-9cc731a88658
        description: A unique request identifier.
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
        description: API key for authentication.
      - name: x-user-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
        description: User-specific authentication key.
      - name: agentPortfolioId
        in: path
        required: true
        schema:
          type: string
          format: uuid
        description: The unique identifier of the agent-portfolio.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserTokenV2Request'
      responses:
        '201':
          description: User token created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateUserTokenResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                ScopeNamesRequired:
                  summary: Scope names are required
                  value:
                    errorCode: ScopeIdsRequired
                    errorMessage: ScopeNames is required
        '403':
          description: Forbidden — a requested scope name is not allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: ScopeNameNotAllowed
                errorMessage: Scope name not allowed
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: Unauthorized
                errorMessage: Unauthorized
        '404':
          description: Agent-portfolio not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: NotFound
                errorMessage: Agent-portfolio not found
        '409':
          description: Conflict — a user token with the requested name already exists for this agent-portfolio
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UserKeyNameAlreadyExists
                errorMessage: UserKeyName already exists
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: MaxUserTokensExceeded
                errorMessage: Maximum number of user tokens exceeded
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: UnhandledException
                errorMessage: Global Error
  /api/v2/agent-portfolios/{agentPortfolioId}/user-tokens/{userTokenId}:
    patch:
      tags:
      - Agent Portfolios
      summary: Update User Token (v2)
      description: Updates the settings of an existing user token using scope names. At least one field must be provided. Scopes are specified by name (scopeNames); scope ids are not supported in v2.
      operationId: updateAgentPortfolioUserTokenV2
      parameters:
      - name: x-request-id
        in: header
        required: true
        schema:
          type: string
          format: uuid
          example: 1448a179-93c0-4bad-815e-5da83901f5f7
        description: A unique request identifier.
      - name: x-api-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
        description: API key for authentication.
      - name: x-user-key
        in: header
        required: true
        schema:
          type: string
          format: password
          example: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
        description: User-specific authentication key.
      - name: agentPortfolioId
        in: path
        required: true
        schema:
          type: stri

# --- truncated at 32 KB (57 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/etoro/refs/heads/main/openapi/etoro-agent-portfolios-api-openapi.yml