> ## Documentation Index
> Fetch the complete documentation index at: https://api-portal.etoro.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update User Token

> Updates the settings of an existing user token for a agent-portfolio. At least one field must be provided.



## OpenAPI

````yaml /api-reference/openapi.json patch /api/v1/agent-portfolios/{agentPortfolioId}/user-tokens/{userTokenId}
openapi: 3.0.1
info:
  title: eToro Api
  version: v1.206.0
  description: >-
    eToro’s public API provides access to real-time financial data, trading
    insights, and account management features, allowing developers to integrate
    eToro’s services into their applications. With access to market prices,
    historical data, and social trading information, the API empowers users to
    enhance their trading strategies. Designed for security and scalability, the
    eToro API ensures smooth and reliable integration for a variety of financial
    applications.


    For more details on integrating with eToro's public WebSocket service,
    please refer to the dedicated [WebSocket
    documentation](./websocket/websocket-doc.html).
servers:
  - url: https://public-api.etoro.com
    description: eToro Public API
security: []
tags:
  - name: Agent Portfolios
  - name: Watchlists
  - name: Feeds
  - name: Asset Explorer
  - name: Market Data
  - name: Identity
  - name: Notifications
  - name: PI Data
  - name: Comments
  - name: Trading Demo
  - name: Trading Real
  - name: Users Info
  - name: Deprecated
paths:
  /api/v1/agent-portfolios/{agentPortfolioId}/user-tokens/{userTokenId}:
    patch:
      tags:
        - Agent Portfolios
      summary: Update User Token
      description: >-
        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: eb92dafb-a693-4fe8-b7d4-da61fa0179c9
          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'
              example:
                errorCode: NotFound
                errorMessage: Agent-portfolio or 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
components:
  schemas:
    UpdateUserTokenRequest:
      type: object
      properties:
        scopeIds:
          type: array
          items:
            type: integer
          description: >-
            An updated set of permission scope identifiers for the token.
            Available scopes: 200 = etoro-public:real:read, 201 =
            etoro-public:demo:read, 202 = etoro-public:real:write, 203 =
            etoro-public:demo:write.
          example:
            - 200
            - 202
        ipsWhitelist:
          type: array
          items:
            type: string
          description: An updated set of IPv4 addresses allowed to use this token.
          example:
            - 192.168.1.1
        expiresAt:
          type: string
          format: date-time
          description: An updated expiration date and time (UTC) for the token.
          example: '2026-12-31T23:59:59Z'
    ErrorResponse:
      type: object
      properties:
        errorCode:
          type: string
          description: >-
            Machine-readable error code (e.g. `ScopeIdInvalid`,
            `ScopeIdsDuplicateItems`).
        errorMessage:
          type: string
          description: Human-readable error description.

````