> ## Documentation Index
> Fetch the complete documentation index at: https://finance.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Replace All Watchlists

> Replaces the authenticated user's entire set of watchlists in a single call. Send the full desired list as an array: entries matching an existing watchlist by `name` are updated in place, entries with a new `name` are created, and any existing watchlist not present in the array is removed (or reset to a default empty state if it's the user's last remaining watchlist). Unlike create and update, symbols sent here are stored as-is and are not checked against the symbol resolver.

**Use Case:** Sync a user's complete watchlist set in one request, such as when restoring watchlists from a backup or applying a bulk edit made in a client-side editor.




## OpenAPI

````yaml openapi.json PUT /v1/config/watchlist
openapi: 3.0.3
info:
  contact:
    email: support@aries.com
    name: Aries Financial
  description: >-
    OpenAPI Specification for the Aries trading platform API.


    # Authentication


    Learn how to authenticate with the Aries API using OAuth2 and manage access
    tokens in your SDK.


    ## Overview


    The Aries API uses **OAuth2 with Bearer tokens** (JWT format) for
    authentication. All API requests require a valid access token in the
    `Authorization` header:


    ```

    Authorization: Bearer <access_token>

    ```


    ## Providing Client ID and Client Secret (SDK)


    When using the generated SDK, provide your **Client ID** and **Client
    Secret** when you create the API client (e.g. in the constructor or security
    options). The SDK will use these to obtain and refresh the access token
    internally; you do not need to manage tokens yourself.


    Obtain your OAuth2 credentials from the Aries platform (e.g. Client Center /
    Manage Account at https://app.aries.com):


    - **Client ID** – Your application identifier (pass to SDK client)

    - **Client Secret** – Your application secret key (pass to SDK client; use
    PKCE for public clients where secret cannot be stored)


    ## Authentication Flow


    ### 1. Authorization Code Flow


    For server-side or confidential clients:


    1. **Redirect the user** to the authorization URL to sign in and consent:
     - **URL:** `https://app.aries.com/oauth2/authorize`
     - **Query params:** `response_type=code`, `client_id`, `redirect_uri`, `scope`, `state`

    2. **Exchange the code for tokens** (after user is redirected back with
    `?code=.`):
     - **POST** `https://api.aries.com/v1/oauth2/token`
     - **Body:** `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`, `client_secret`
     - Response includes `access_token` and `refresh_token`

    3. **Call the API** with the access token: `Authorization: Bearer
    <access_token>`


    ### 2. PKCE Flow


    For SPAs and mobile apps (public clients that cannot store `client_secret`):


    1. Generate a **code_verifier** (random string) and **code_challenge** =
    BASE64URL(SHA256(code_verifier)).

    2. **Redirect the user** to `https://app.aries.com/oauth2/authorize` with
    `code_challenge`, `code_challenge_method=S256`, plus `client_id`,
    `redirect_uri`, `scope`, `state`.

    3. **Exchange the code** at POST `https://api.aries.com/v1/oauth2/token`
    with `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`,
    `code_verifier` (no client_secret).

    4. Use the returned `access_token` as Bearer.


    ### 3. MFA Verification


    If the user has MFA enabled, the authorize step may return `is_mfa: true`
    and a `next_step_auth_id`. Call **POST**
    `https://api.aries.com/v1/oauth2/authorize/mfa` with `next_step_auth_id` and
    `verification_code` (6-digit code). Then continue with **POST**
    `/v1/oauth2/authorize/confirm` to get the authorization code, and exchange
    it at `/v1/oauth2/token`.


    ## Token Management


    - **Refresh when expired:** POST `https://api.aries.com/v1/oauth2/token`
    with `grant_type=refresh_token`, `client_id`, `client_secret`,
    `refresh_token`.

    - **Using a Bearer token directly:** If you already have an access token,
    set the header `Authorization: Bearer <access_token>` on every request. The
    SDK can accept a pre-obtained token and use it until it expires.


    ## OAuth2 Scopes


    Request only the scopes your application needs. Available scopes:


    | Scope | Description |

    |-------|-------------|

    | `user:information` | View user profile and personal details |

    | `watchlist:information` | View your watchlists and their symbols |

    | `watchlist:management` | Create, update, replace, and delete your
    watchlists |

    | `account:information` | View account balances, positions, and transaction
    history |

    | `order:execution` | Place, modify, and cancel orders |

    | `order:information` | View order history and status |

    | `position:information` | View current positions and holdings |

    | `market:information` | Access live and historical market data |

    | `calendar:information` | Access earnings, economic, and market schedule
    data |

    | `options:information` | Access options chains and expiration data |

    | `analytics:information` | View analytics, ratings, and market insights |

    | `market:supplemental` | News, company profiles, financials, filings, ETF
    data, technical analysis |


    Specify multiple scopes as a space-separated string, e.g.
    `account:information order:execution market:information`.


    ## Security Best Practices


    - **Store credentials securely** – Use environment variables or a secrets
    manager for `client_id` and `client_secret`. Never hardcode them.

    - **Handle token expiration** – Check for 401 responses and refresh the
    token using the refresh_token, then retry the request.

    - **Use HTTPS** – All authorization and token endpoints must be called over
    HTTPS.

    - **Validate state** – When using the authorization code flow, validate the
    `state` parameter on the callback to prevent CSRF.


    ## Error Handling


    - **400 Bad Request** – Invalid or missing parameters, validation failures,
    or malformed JSON. Response bodies follow the same patterns as other errors
    (flat `error` string, optional `codes`, nested `error` object, or rarely no
    body).


    - **401 Unauthorized** – Invalid or expired access token; refresh the token
    or re-authenticate. JSON bodies are not identical on every route: you may
    see a flat `error` string (sometimes with `codes`), a nested `error` object
    (`type`, `code`, `message`), or rarely an empty body


    - **403 Forbidden** – Insufficient scope or permissions for the requested
    resource. Error JSON may be flat or nested, like 400/401.


    - **404 Not Found** – Resource does not exist or is not visible. Error JSON
    may be flat or nested.


    - **500 / 5xx** – Server or upstream failure; retry with backoff. Do not
    depend on a single error JSON shape; some responses may have no body.



    ---


    Endpoints in this spec: health, OAuth2 (authorize, confirm, mfa, token),
    users, accounts, orders, market data, watchlist, chart, analytics,
    calendars, company, economy, financials, indices, options, news, and
    supplemental data.
  title: Aries API — OpenAPI Specification
  version: 1.0.0
servers:
  - description: Production server
    url: https://api.aries.com
  - description: Staging server
    url: https://api.tradearies.dev
security: []
tags:
  - description: Account management endpoints for positions, orders, and balances
    name: Accounts
  - description: >-
      Analytics endpoints for market data analysis including top gainers,
      losers, volume leaders, sector analysis, analyst ratings, market breadth,
      and net inflow
    name: Analytics
  - description: Calendar and mergers/acquisitions endpoints
    name: Calendar
  - description: Chart endpoints for config, symbols, history, quotes, and server time
    name: Chart
  - description: Company profile, executives, peers, and financial metrics
    name: Company
  - description: 'Corporate actions: spinoffs, tender offers, IPO calendar, dividends'
    name: Corporate Actions
  - description: ETF profile, holdings, sector allocation, and country allocation
    name: ETF
  - description: 'Economy endpoints: inflation, inflation expectations, treasury yields'
    name: Economy
  - description: SEC filings and filing similarity index
    name: Filings
  - description: >-
      Financials: reported, statements, revenue breakdown, short volume, ratios,
      short interest
    name: Financials
  - description: >-
      Indices endpoints for groups, list, search, bar, bars, chart-bars,
      realtime values
    name: Indices
  - description: Logos search and sync endpoints
    name: Logos
  - description: Market status and market holidays by exchange
    name: Market
  - description: >-
      Market data endpoints for symbol search, real-time data access, and equity
      details
    name: Market Data
  - description: News and news sentiment endpoints
    name: News
  - description: >-
      OAuth2 token issuance: exchange authorization codes, refresh tokens, or
      client credentials for access tokens
    name: OAuth2
  - description: >-
      Options endpoints: expiry dates, contracts, activity, trades, quotes,
      unusual activity
    name: Options
  - description: >-
      Order management endpoints for placing, updating, canceling, and
      previewing orders
    name: Orders
  - description: Company, fund, insider, and institutional ownership data
    name: Ownership
  - description: Signals and bull-bear cases
    name: Signals
  - description: >-
      Transcripts, company presentation, social sentiment, investment themes,
      supply chain, and ESG data
    name: Stock Alternative
  - description: >-
      Analyst price targets, upgrades and downgrades, revenue, EBITDA, EBIT, and
      EPS estimates, and earnings surprises
    name: Stock Estimates
  - description: Stock aggregate bars, daily summaries, snapshots, trades, and quotes
    name: Stocks
  - description: >-
      Technical patterns, support and resistance levels, aggregate technical
      indicators, and indicator time series
    name: Technical Analysis
  - description: Basic information about the authenticated user.
    name: Users
  - description: >-
      Watchlist endpoints for listing, creating, updating, and deleting
      watchlists
    name: Watchlist
  - description: Historical YES/NO tick data for prediction-market contracts
    name: Prediction Historical Data
  - description: >-
      Prediction-market reference data and full-text search over base events,
      events, and contracts
    name: Prediction Market Data
  - description: >-
      Closed beta. Place prediction-market orders and read back the
      authenticated user's order history.
    name: Prediction Orders
paths:
  /v1/config/watchlist:
    put:
      tags:
        - Watchlist
      summary: Replace All Watchlists
      description: >-
        Replace the authenticated user's entire set of watchlists in a single
        call. Send the full desired list as an array: entries matching an
        existing watchlist by `name` (exact, case-sensitive) are updated in
        place, keeping their `id` and replacing their `symbols`; entries with a
        new `name` are created; and every existing watchlist whose `name` is
        **not** present in the array is deleted. Sending an empty array `[]`
        deletes all of the user's watchlists and creates a single new
        `"Default"` watchlist with no symbols.


        Unlike Create and Update, symbols sent here are stored as-is and are
        **not** uppercased or checked against the symbol resolver. If `symbols`
        is omitted for an entry, that watchlist is stored with `symbols: null`.
      operationId: replaceConfigWatchlists
      requestBody:
        content:
          application/json:
            examples:
              replaceAll:
                summary: Replace with two watchlists
                value:
                  - name: Tech Stocks
                    symbols:
                      - AAPL
                      - GOOGL
                      - MSFT
                  - name: Finance
                    symbols:
                      - JPM
                      - BAC
                      - GS
              resetAll:
                summary: Reset to default by sending an empty array
                value: []
            schema:
              items:
                $ref: '#/components/schemas/WatchlistRequest'
              type: array
        description: >-
          The complete desired set of watchlists. Each entry's `name` must be
          unique within the array, and `symbols` must not contain duplicates
          within an entry.
        required: true
      responses:
        '201':
          content:
            application/json:
              examples:
                replaced:
                  summary: Resulting set after replace (user had multiple watchlists)
                  value:
                    user_id: 98765
                    watchlist:
                      - id: 12345
                        name: Tech Stocks
                        symbols:
                          - AAPL
                          - GOOGL
                          - MSFT
                      - id: 12347
                        name: Finance
                        symbols:
                          - JPM
                          - BAC
                          - GS
                resetToDefault:
                  summary: User reset to a single Default watchlist (empty array sent)
                  value:
                    user_id: 98765
                    watchlist:
                      - id: 12348
                        name: Default
                        symbols: []
              schema:
                $ref: '#/components/schemas/WatchlistResponse'
          description: >-
            The full, resulting set of watchlists after the replace, in request
            order. Sending an empty array resets the user to a single new
            "Default" watchlist with no symbols.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ReplaceConfigWatchlistsInternalServerError'
      security:
        - OAuth2:
            - watchlist:management
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            from finance_dev import FinanceDev, models


            with FinanceDev(
                security=models.Security(
                    client_id="<YOUR_CLIENT_ID_HERE>",
                    client_secret="<YOUR_CLIENT_SECRET_HERE>",
                ),
            ) as fd_client:

                res = fd_client.watchlist.replace_all(request=[
                    {
                        "name": "Tech Stocks",
                        "symbols": [
                            "AAPL",
                            "GOOGL",
                            "MSFT",
                        ],
                    },
                    {
                        "name": "Finance",
                        "symbols": [
                            "JPM",
                            "BAC",
                            "GS",
                        ],
                    },
                ])

                assert res.watchlist_response is not None

                # Handle response
                print(res.watchlist_response)
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { FinanceDev } from "@ariesdotcom/finance-dev";

            const financeDev = new FinanceDev({
              security: {
                clientID: "<YOUR_CLIENT_ID_HERE>",
                clientSecret: "<YOUR_CLIENT_SECRET_HERE>",
              },
            });

            async function run() {
              const result = await financeDev.watchlists.replaceAll([
                {
                  name: "Tech Stocks",
                  symbols: [
                    "AAPL",
                    "GOOGL",
                    "MSFT",
                  ],
                },
                {
                  name: "Finance",
                  symbols: [
                    "JPM",
                    "BAC",
                    "GS",
                  ],
                },
              ]);

              console.log(result);
            }

            run();
components:
  schemas:
    WatchlistRequest:
      description: >-
        One watchlist entry in a bulk replace request. `name` must be unique
        among the entries in the array; `symbols` must not contain duplicates
        within the entry (an empty array is allowed).
      properties:
        name:
          description: >-
            Unique user-facing name for the watchlist. Enter a short label the
            user will recognize.
          minLength: 1
          type: string
        symbols:
          description: >-
            Stock symbols to include. Enter exact uppercase symbols and avoid
            duplicates. Unlike create/update, symbols here are stored as-is and
            are not validated against the symbol resolver.
          example:
            - AAPL
            - GOOGL
            - MSFT
          items:
            type: string
          type: array
          uniqueItems: true
      required:
        - name
      type: object
    WatchlistResponse:
      description: Response body containing the user's saved watchlists.
      properties:
        user_id:
          description: >-
            User ID that owns these watchlists. Use it to confirm the response
            belongs to the expected connected user.
          format: int64
          type: integer
        watchlist:
          description: >-
            Saved watchlists for the user. Render each item as a named list of
            symbols.
          items:
            $ref: '#/components/schemas/Watchlist'
          type: array
      type: object
    Watchlist:
      description: >-
        Saved list of symbols a user wants to monitor. Watchlists are read-only
        from a trading-risk perspective and do not place orders.
      properties:
        id:
          description: >-
            Watchlist identifier. Use this value when reading, updating, or
            deleting a specific watchlist.
          format: int64
          type: integer
        invalid_symbols:
          description: >-
            Symbols from the request that could not be resolved and were dropped
            from `symbols`. Only present on create and update responses when at
            least one submitted symbol failed resolution.
          items:
            type: string
          type: array
        name:
          description: >-
            User-facing watchlist name, such as Tech Stocks or Dividend Ideas.
            Show this as the list label in your app.
          type: string
        symbols:
          description: >-
            Symbols saved in the watchlist. Use exact uppercase ticker symbols
            and confirm unfamiliar symbols with symbol search. May be `null` for
            a watchlist saved through Replace All Watchlists without `symbols`.
          items:
            type: string
          nullable: true
          type: array
      type: object
    AuthenticationErrorEnvelope:
      description: >-
        JSON envelope where `error` is a nested object (`type`, `code`,
        `message`, …). Many services use this shape for 400, 401, 403, 404, and
        5xx when using the shared HTTP error format.
      properties:
        error:
          $ref: '#/components/schemas/AuthenticationErrorDetail'
        meta:
          additionalProperties: true
          description: Optional metadata
          type: object
      type: object
    ErrorResponse:
      description: >-
        Flat error body: an `error` string, with optional structured `codes` and
        additional `metadata`.
      properties:
        codes:
          description: Structured error codes for programmatic handling
          items:
            $ref: '#/components/schemas/ErrorCode'
          type: array
        error:
          description: >-
            Error detail as a string. Exact message content is not fixed and
            should not be hard-coded.
          example: string
          type: string
        metadata:
          additionalProperties: true
          description: Additional error context
          type: object
      type: object
    AuthenticationErrorDetail:
      description: >-
        Structured payload for the nested `error` object. Services using the
        shared Go error writer emit uppercase `type` values aligned with error
        categories (for example `VALIDATION`, `BAD_REQUEST`, `AUTHENTICATION`,
        `AUTHORIZATION`, `NOT_FOUND`, `RATE_LIMIT`, `INTERNAL`).
      properties:
        code:
          description: Machine-readable code
          example: INVALID_TOKEN
          type: string
        details:
          additionalProperties: true
          description: Optional extra context
          type: object
        message:
          description: >-
            Error detail as a string. Exact message content is not fixed and
            should not be hard-coded.
          example: string
          type: string
        request_id:
          description: Request correlation id when provided
          type: string
        type:
          description: >-
            Error category emitted by the shared error writer, such as
            VALIDATION, BAD_REQUEST, AUTHENTICATION, AUTHORIZATION, NOT_FOUND,
            RATE_LIMIT, or INTERNAL.
          example: AUTHENTICATION
          type: string
      type: object
    ErrorCode:
      description: >-
        A single structured error entry identifying a machine-readable code, a
        human-readable description, and optionally the field that caused it.
      properties:
        code:
          description: Machine-readable error code
          example: INVALID_PASSWORD
          type: string
        description:
          description: Human-readable description of the error
          example: Password must be between 8 and 64 characters
          type: string
        field:
          description: Field name that caused the error
          example: password
          type: string
      type: object
  responses:
    BadRequest:
      content:
        application/json:
          examples:
            flat_string:
              summary: Flat error string
              value:
                error: string
            flat_with_codes:
              summary: Flat error with field codes (some services)
              value:
                codes:
                  - code: string
                    description: string
                    field: string
                error: string
            nested_bad_request:
              summary: Nested error (BAD_REQUEST / invalid JSON)
              value:
                error:
                  code: INVALID_JSON
                  message: string
                  type: BAD_REQUEST
            nested_shared_http_error:
              summary: Nested error (typical for shared WriteHTTPError-style responses)
              value:
                error:
                  code: VALIDATION_ERROR
                  details:
                    fieldName: field is required
                  message: Query parameter validation failed
                  type: VALIDATION
          schema:
            description: >-
              400 responses commonly use a nested `error` object (`type`,
              `code`, `message`, optional `details`). Some services still return
              flat `ErrorResponse` (`error` string, optional `codes`).
            oneOf:
              - $ref: '#/components/schemas/AuthenticationErrorEnvelope'
              - $ref: '#/components/schemas/ErrorResponse'
      description: >-
        Invalid query/path/body, malformed JSON, or failed validation.


        **Backend (shared HTTP errors):** Routes that use the shared error
        writer typically return a **nested** JSON object: `error.type` is an
        uppercase category such as `VALIDATION` or `BAD_REQUEST` (see the API
        implementation). Other routes may return the **flat** `ErrorResponse`
        shape (`error` as a string, optional `codes`). The body may rarely be
        empty.


        **OpenAPI:** Every operation’s **400** response references this
        component so the documented schema and examples stay aligned.
    Unauthorized:
      content:
        application/json:
          examples:
            flat_message:
              summary: Flat error string (typical)
              value:
                error: string
            flat_with_codes:
              summary: Flat error with structured codes
              value:
                codes:
                  - code: string
                    description: string
                error: string
            nested_error_object:
              summary: Nested error (shared HTTP error format)
              value:
                error:
                  code: INVALID_TOKEN
                  message: string
                  type: AUTHENTICATION
          schema:
            description: >-
              401 responses may use a flat `ErrorResponse` shape or a nested
              `error` object. Inspect `error`: if it is a string, use the flat
              shape; if it is an object, use the structured shape.
            oneOf:
              - $ref: '#/components/schemas/ErrorResponse'
              - $ref: '#/components/schemas/AuthenticationErrorEnvelope'
      description: >-
        Authentication failed: missing credentials, invalid JWT, or expired
        access token.


        **Response body variants:** Some routes return JSON with a string
        `error` field (and optionally `codes` / `metadata`). Others return JSON
        where `error` is a structured object (`type`, `code`, `message`, and
        optionally `details`, `request_id`). The response may have **no body**
        even though the status is 401—clients should treat 401 as
        unauthenticated and refresh or re-authenticate regardless of body shape.
    Forbidden:
      content:
        application/json:
          examples:
            flat:
              summary: Flat message
              value:
                error: string
            nested:
              summary: Nested error (shared HTTP error format)
              value:
                error:
                  code: INSUFFICIENT_SCOPE
                  message: string
                  type: AUTHORIZATION
          schema:
            description: 403 responses may use a flat or nested error shape.
            oneOf:
              - $ref: '#/components/schemas/ErrorResponse'
              - $ref: '#/components/schemas/AuthenticationErrorEnvelope'
      description: >-
        Authenticated but not allowed to perform this action or access this
        resource (insufficient scope or role).


        **Response body variants:** Flat `ErrorResponse` or nested `error`
        object, same pattern as 400/401.
    ReplaceConfigWatchlistsInternalServerError:
      description: >-
        The server failed to replace the user's watchlists. This response has no
        body.
  securitySchemes:
    OAuth2:
      description: >-
        OAuth2 Bearer token: obtain an access token from the token endpoint and
        send it in the Authorization header.
      flows:
        authorizationCode:
          authorizationUrl: https://app.aries.com/oauth2/authorize
          refreshUrl: https://api.aries.com/v1/oauth2/token
          scopes:
            account:information: View account balances, positions, and transaction history
            analytics:information: View analytics, ratings, and market insights
            calendar:information: Access earnings, economic, and market schedule data
            market:information: Access live and historical market data
            market:supplemental: >-
              News, company profiles, financials, filings, ETF data, technical
              analysis
            options:information: Access options chains and expiration data
            order:execution: Place, modify, and cancel orders
            order:information: View order history and status
            position:information: View current positions and holdings
            user:information: View user profile and personal details
            user:management: Manage user-scoped resources and saved configuration (internal).
            watchlist:information: View your watchlists and their symbols.
            watchlist:management: Create, update, replace, and delete your watchlists.
          tokenUrl: https://api.aries.com/v1/oauth2/token
        clientCredentials:
          refreshUrl: https://api.aries.com/v1/oauth2/token
          scopes:
            account:information: View account balances, positions, and transaction history
            analytics:information: View analytics, ratings, and market insights
            calendar:information: Access earnings, economic, and market schedule data
            market:information: Access live and historical market data
            market:supplemental: >-
              News, company profiles, financials, filings, ETF data, technical
              analysis
            options:information: Access options chains and expiration data
            order:execution: Place, modify, and cancel orders
            order:information: View order history and status
            position:information: View current positions and holdings
            user:information: View user profile and personal details
            user:management: Manage user-scoped resources and saved configuration (internal).
            watchlist:information: View your watchlists and their symbols.
            watchlist:management: Create, update, replace, and delete your watchlists.
          tokenUrl: https://api.aries.com/v1/oauth2/token
      type: oauth2

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.