> For AI agents: the complete documentation index is available at [llms.txt](https://docs.snaptrade.com/llms.txt). Markdown versions of documentation pages are available by appending .md to the URL path.

# Refresh holdings for a connection

POST https://api.snaptrade.com/authorizations/{authorizationId}/refresh

Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection.
This endpoint will also trigger a transaction sync for the past day if one has not yet occurred.

**Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
**Please note this endpoint is disabled for Real-time plans (Personal and Pay as you go) unless the connection is delayed. Real-time connections do not benefit from this feature since data is refreshed when calls are made. Refer to the `data_freshness_mode` field on a connection to determine this.**


Reference: https://docs.snaptrade.com/reference/Connections/Connections_refreshBrokerageAuthorization

## Code Examples

### TypeScript

```typescript

import { Snaptrade } from "snaptrade-typescript-sdk";

const snaptrade = new Snaptrade({
  clientId: "PARTNER_CLIENT_ID",
  consumerKey: "CONSUMER_KEY",
});

const response =
  await snaptrade.connections.refreshBrokerageAuthorization(
    {
      authorizationId:
        "87b24961-b51e-4db8-9226-f198f6518a89",
      userId: "snaptrade-user-123",
      userSecret:
        "adf2aa34-8219-40f7-a6b3-60156985cc61",
    },
  );
console.log(response.data);

```

### Python

```python

from pprint import pprint
from snaptrade_client import SnapTrade

snaptrade = SnapTrade(
    client_id="PARTNER_CLIENT_ID",
    consumer_key="CONSUMER_KEY"
)

response = snaptrade.connections.refresh_brokerage_authorization(
    authorization_id="87b24961-b51e-4db8-9226-f198f6518a89",
    user_id="snaptrade-user-123",
    user_secret="adf2aa34-8219-40f7-a6b3-60156985cc61"
)
pprint(response.body)

```

## OpenAPI Specification

```yaml

openapi: 3.0.0
info:
  description: Connect brokerage accounts to your app for live positions and trading
  version: 1.0.0
  title: SnapTrade
  termsOfService: N/A
  contact:
    email: api@snaptrade.com
  x-konfig-ignore:
    potential-incorrect-type: true
  x-readme:
    explorer-enabled: false
paths:
  /authorizations/{authorizationId}/refresh:
    post:
      tags:
        - Connections
      summary: Refresh holdings for a connection
      description: >
        Trigger a holdings update for all accounts under this connection.
        Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED`
        webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent
        once the sync completes for each account under the connection.

        This endpoint will also trigger a transaction sync for the past day if
        one has not yet occurred.


        **Because of the cost of refreshing a connection, each call to this
        endpoint incurs an additional charge. You can find the exact cost for
        your API key on the [Customer Dashboard billing
        page](https://dashboard.snaptrade.com/settings/billing)**

        **Please note this endpoint is disabled for Real-time plans (Personal
        and Pay as you go) unless the connection is delayed. Real-time
        connections do not benefit from this feature since data is refreshed
        when calls are made. Refer to the `data_freshness_mode` field on a
        connection to determine this.**
      operationId: Connections_refreshBrokerageAuthorization
      parameters:
        - in: path
          name: authorizationId
          required: true
          schema:
            description: >-
              Unique identifier for the connection (brokerage_authorization_id).
              This is the UUID used to reference the connection in SnapTrade.
            type: string
            format: uuid
            example: 87b24961-b51e-4db8-9226-f198f6518a89
        - in: query
          required: true
          name: userId
          schema:
            description: >-
              SnapTrade User ID. This is chosen by the API partner and can be
              any string that is a) unique to the user, and b) immutable for the
              user. It is recommended to NOT use email addresses for this
              property because they are usually not immutable.
            type: string
            example: snaptrade-user-123
        - in: query
          required: true
          name: userSecret
          schema:
            description: >-
              SnapTrade User Secret. This is a randomly generated string and
              should be stored securely. If compromised, please rotate it via
              the [rotate user secret
              endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
            type: string
            example: adf2aa34-8219-40f7-a6b3-60156985cc61
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                description: Confirmation that the syncs have been scheduled.
                type: object
                properties:
                  detail:
                    description: Refresh confirmation details
                    type: string
                    example: >-
                      Connection 0b3ebefb-ed47-43df-cd8f-729a4420b5cf scheduled
                      for refresh
        '401':
          description: Unauthorized, invalid credentials for this resource
          content:
            application/json:
              schema:
                description: Example for failed request response
                type: object
                properties:
                  default_detail:
                    example: Unable to verify signature sent
                  default_code:
                    example: 1076
        '402':
          description: >-
            Unable to sync with brokerage account because the connection is
            disabled.
          content:
            application/json:
              schema:
                description: Cannot perform action because connection is disabled
                type: object
                properties:
                  detail:
                    example: >-
                      Unable to sync with brokerage account because the
                      connection is disabled.
                  code:
                    example: 3003
        '403':
          description: Customer or user does not have access to this feature
          content:
            application/json:
              schema:
                description: Example for failed request response
                type: object
                properties:
                  detail:
                    example: >-
                      Feature is not enabled for this customer or this
                      connection
                  default_code:
                    example: 1141
        '404':
          description: The requested resource does not exist.
          content:
            application/json:
              schema:
                description: Example for failed request response
                type: object
                properties:
                  default_detail:
                    example: The requested resource does not exist.
                  default_code:
                    example: 1011
        '429':
          description: >-
            The connection was refreshed too recently. Please wait before
            calling this endpoint again.
          content:
            application/json:
              schema:
                description: Example for a rate-limited request response
                type: object
                properties:
                  detail:
                    example: Connection refreshed too recently. Please try again later.
                  status_code:
                    example: 429
                  code:
                    example: throttled

```