Ally Invest Accounts API

Account balances, holdings, history, and portfolio data

OpenAPI Specification

ally-invest-accounts-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Ally Invest Accounts API
  description: The Ally Invest REST API (originally developed from the TradeKing acquisition) provides programmatic access to self-directed brokerage account management, order placement, real-time and delayed market data, watchlist management, and member profile information. Authentication uses OAuth 1.0 with consumer and token credentials. Responses are available in JSON and XML formats.
  version: v1
  contact:
    email: InvestAPI@ally.com
  termsOfService: https://www.ally.com/content/dam/pdf/invest/api-agreement.pdf
  x-logo:
    url: https://kinlane-images.s3.amazonaws.com/shared/apis-json/apis-json-logo.jpg
servers:
- url: https://api.ally.com/v1
  description: Ally Invest REST API
- url: https://stream.ally.com/v1
  description: Ally Invest Streaming API
tags:
- name: Accounts
  description: Account balances, holdings, history, and portfolio data
paths:
  /accounts.json:
    get:
      operationId: getAccounts
      summary: Get all accounts
      description: Returns summary account information for all accounts associated with the authenticated member.
      tags:
      - Accounts
      responses:
        '200':
          description: Successful response with account list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountsResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
      - OAuth1: []
  /accounts/balances.json:
    get:
      operationId: getAccountsBalances
      summary: Get balances for all accounts
      description: Returns balance information for all accounts associated with the authenticated member.
      tags:
      - Accounts
      responses:
        '200':
          description: Successful response with balances for all accounts
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountsBalancesResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
      - OAuth1: []
  /accounts/{id}.json:
    get:
      operationId: getAccount
      summary: Get account details
      description: Returns detailed account information for a specific account identified by account ID.
      tags:
      - Accounts
      parameters:
      - $ref: '#/components/parameters/AccountId'
      responses:
        '200':
          description: Successful response with account details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
      - OAuth1: []
  /accounts/{id}/balances.json:
    get:
      operationId: getAccountBalances
      summary: Get balances for a specific account
      description: Returns balance information for a specific account identified by account ID.
      tags:
      - Accounts
      parameters:
      - $ref: '#/components/parameters/AccountId'
      responses:
        '200':
          description: Successful response with account balance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountBalanceResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
      - OAuth1: []
  /accounts/{id}/history.json:
    get:
      operationId: getAccountHistory
      summary: Get account transaction history
      description: Returns transaction history for a specific account including trades, dividends, and other account activity.
      tags:
      - Accounts
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - name: range
        in: query
        description: Date range for history (e.g., all, today, current_week, current_month, last_month)
        schema:
          type: string
          enum:
          - all
          - today
          - current_week
          - current_month
          - last_month
      - name: transactions
        in: query
        description: Transaction type filter (e.g., all, bookkeeping, trade)
        schema:
          type: string
          enum:
          - all
          - bookkeeping
          - trade
      responses:
        '200':
          description: Successful response with account history
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountHistoryResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
      - OAuth1: []
  /accounts/{id}/holdings.json:
    get:
      operationId: getAccountHoldings
      summary: Get account holdings
      description: Returns current holdings (positions) for a specific account.
      tags:
      - Accounts
      parameters:
      - $ref: '#/components/parameters/AccountId'
      responses:
        '200':
          description: Successful response with account holdings
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountHoldingsResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
      - OAuth1: []
components:
  schemas:
    AccountsBalancesResponse:
      type: object
      properties:
        response:
          type: object
          properties:
            accountbalance:
              type: array
              items:
                $ref: '#/components/schemas/AccountBalance'
            elapsedtime:
              type: string
            id:
              type: string
            error:
              type: string
    AccountResponse:
      type: object
      properties:
        response:
          type: object
          properties:
            accountsummary:
              $ref: '#/components/schemas/AccountSummary'
            elapsedtime:
              type: string
            id:
              type: string
            error:
              type: string
    Holding:
      type: object
      properties:
        accounttype:
          type: string
        costbasis:
          type: string
        gainloss:
          type: string
        gainlosspct:
          type: string
        instrument:
          type: object
          properties:
            cusip:
              type: string
            desc:
              type: string
            factor:
              type: string
            matdt:
              type: string
            maturityvalue:
              type: string
            mult:
              type: string
            putcall:
              type: string
            sectyp:
              type: string
            sesn:
              type: string
            strkpx:
              type: string
            sym:
              type: string
        marketvalue:
          type: string
        marketvaluechange:
          type: string
        price:
          type: string
        purchaseprice:
          type: string
        qty:
          type: string
        quote:
          $ref: '#/components/schemas/Quote'
        underlying:
          type: string
    AccountsResponse:
      type: object
      properties:
        response:
          type: object
          properties:
            accounts:
              type: object
              properties:
                accountsummary:
                  type: array
                  items:
                    $ref: '#/components/schemas/AccountSummary'
            elapsedtime:
              type: string
            id:
              type: string
            error:
              type: string
    ErrorResponse:
      type: object
      properties:
        response:
          type: object
          properties:
            error:
              type: string
              description: Error message
            elapsedtime:
              type: string
            id:
              type: string
    AccountHoldingsResponse:
      type: object
      properties:
        response:
          type: object
          properties:
            accountholdings:
              $ref: '#/components/schemas/AccountHoldings'
            elapsedtime:
              type: string
            id:
              type: string
            error:
              type: string
    AccountBalance:
      type: object
      properties:
        account:
          type: string
          description: Account number
        accountvalue:
          type: string
          description: Total account value
        buyingpower:
          type: object
          properties:
            cashavailableforwithdrawal:
              type: string
            daytrading:
              type: string
            equitypercentage:
              type: string
            options:
              type: string
            soddaytrading:
              type: string
            stock:
              type: string
        fedcall:
          type: string
        housecall:
          type: string
        money:
          type: object
          properties:
            accruedinterest:
              type: string
            cash:
              type: string
            cashavailable:
              type: string
            marginbalance:
              type: string
            mmf:
              type: string
            total:
              type: string
            uncleareddeposits:
              type: string
            unsettledfunds:
              type: string
            yield:
              type: string
        securities:
          type: object
          properties:
            longoptions:
              type: string
            longstocks:
              type: string
            options:
              type: string
            shortoptions:
              type: string
            shortstocks:
              type: string
            stocks:
              type: string
            total:
              type: string
    AccountBalanceResponse:
      type: object
      properties:
        response:
          type: object
          properties:
            accountbalance:
              $ref: '#/components/schemas/AccountBalance'
            elapsedtime:
              type: string
            id:
              type: string
            error:
              type: string
    AccountHistoryResponse:
      type: object
      properties:
        response:
          type: object
          properties:
            transactions:
              type: object
              properties:
                transaction:
                  type: array
                  items:
                    type: object
                    properties:
                      accounttype:
                        type: string
                      activity:
                        type: string
                      amount:
                        type: string
                      date:
                        type: string
                      desc:
                        type: string
                      instrument:
                        type: object
                        properties:
                          cusip:
                            type: string
                          desc:
                            type: string
                          factor:
                            type: string
                          matdt:
                            type: string
                          maturityvalue:
                            type: string
                          mult:
                            type: string
                          putcall:
                            type: string
                          sectyp:
                            type: string
                          sesn:
                            type: string
                          strkpx:
                            type: string
                          sym:
                            type: string
                      price:
                        type: string
                      qty:
                        type: string
                      settlementdate:
                        type: string
                      side:
                        type: string
                      source:
                        type: string
                      tradetime:
                        type: string
                      transactionid:
                        type: string
            elapsedtime:
              type: string
            id:
              type: string
            error:
              type: string
    AccountHoldings:
      type: object
      properties:
        holding:
          type: array
          items:
            $ref: '#/components/schemas/Holding'
        totalholdings:
          type: object
          properties:
            accountvalue:
              type: string
            longoptions:
              type: string
            longstocks:
              type: string
            options:
              type: string
            shortoptions:
              type: string
            shortstocks:
              type: string
            stocks:
              type: string
            total:
              type: string
    Quote:
      type: object
      description: Market quote data for a security
      properties:
        adp_100:
          type: string
          description: Average daily price, 100-day
        adp_200:
          type: string
          description: Average daily price, 200-day
        adp_50:
          type: string
          description: Average daily price, 50-day
        adv_21:
          type: string
          description: Average daily volume, 21-day
        adv_30:
          type: string
          description: Average daily volume, 30-day
        adv_90:
          type: string
          description: Average daily volume, 90-day
        ask:
          type: string
          description: Ask price
        ask_time:
          type: string
          description: Time of ask price
        asksz:
          type: string
          description: Ask size (number of shares)
        basis:
          type: string
          description: Reported basis
        beta:
          type: string
          description: Beta coefficient
        bid:
          type: string
          description: Bid price
        bid_time:
          type: string
          description: Time of bid price
        bidsz:
          type: string
          description: Bid size (number of shares)
        bidtick:
          type: string
          description: Bid tick indicator
        chg:
          type: string
          description: Change from previous close
        chg_sign:
          type: string
          description: Sign of change (u=up, d=down, e=even)
        chg_t:
          type: string
          description: Change from previous close (text format)
        cl:
          type: string
          description: Previous close price
        contract_size:
          type: string
          description: Contract size (for options)
        cusip:
          type: string
          description: CUSIP identifier
        date:
          type: string
          description: Trade date
        datetime:
          type: string
          description: Date and time of last quote
        days_to_expiration:
          type: string
          description: Days until option expiration
        div:
          type: string
          description: Cash dividend amount
        divexdate:
          type: string
          description: Dividend ex-date
        divfreq:
          type: string
          description: Dividend frequency
        divpaydt:
          type: string
          description: Dividend pay date
        dollar_value:
          type: string
          description: Dollar value of trade
        eps:
          type: string
          description: Earnings per share
        exch:
          type: string
          description: Exchange code
        exch_desc:
          type: string
          description: Exchange description
        hi:
          type: string
          description: High price for the day
        iad:
          type: string
          description: Indicated annual dividend
        idelta:
          type: string
          description: Option delta
        igamma:
          type: string
          description: Option gamma
        imp_volatility:
          type: string
          description: Implied volatility
        incr_vl:
          type: string
          description: Incremental volume (volume of last trade)
        irho:
          type: string
          description: Option rho
        issue_desc:
          type: string
          description: Issue description
        itheta:
          type: string
          description: Option theta
        ivega:
          type: string
          description: Option vega
        last:
          type: string
          description: Last trade price
        lo:
          type: string
          description: Low price for the day
        name:
          type: string
          description: Company name
        op_delivery:
          type: string
          description: Option delivery type
        op_flag:
          type: string
          description: Options flag (1=optionable)
        op_style:
          type: string
          description: Option style (A=American, E=European)
        op_subclass:
          type: string
          description: Option subclass
        openinterest:
          type: string
          description: Open interest (options)
        opn:
          type: string
          description: Open price
        opt_val:
          type: string
          description: Option value
        pchg:
          type: string
          description: Percent change from previous close
        pchg_sign:
          type: string
          description: Sign of percent change
        pcls:
          type: string
          description: Previous close
        pe:
          type: string
          description: Price-to-earnings ratio
        phi:
          type: string
          description: Previous high
        plo:
          type: string
          description: Previous low
        popn:
          type: string
          description: Previous open
        pr_adp_100:
          type: string
          description: Prior period 100-day average daily price
        pr_adp_200:
          type: string
          description: Prior period 200-day average daily price
        pr_adp_50:
          type: string
          description: Prior period 50-day average daily price
        pr_date:
          type: string
          description: Prior trade date
        pr_openinterest:
          type: string
          description: Prior open interest
        prbook:
          type: string
          description: Book value per share
        prchg:
          type: string
          description: Prior change
        prem_mult:
          type: string
          description: Premium multiplier
        put_call:
          type: string
          description: Put/Call indicator (P=put, C=call)
        pvol:
          type: string
          description: Previous volume
        qcond:
          type: string
          description: Quote condition code
        rootsymbol:
          type: string
          description: Root symbol (for options)
        secclass:
          type: string
          description: Security class
        sesn:
          type: string
          description: Trading session
        sho:
          type: string
          description: Shares outstanding
        strikeprice:
          type: string
          description: Strike price (for options)
        symbol:
          type: string
          description: Ticker symbol
        tcond:
          type: string
          description: Trade condition code
        timestamp:
          type: string
          description: Unix timestamp of last trade
        tr_num:
          type: string
          description: Trade number
        tradetick:
          type: string
          description: Trade tick (U=up, D=down, E=even)
        trend:
          type: string
          description: Price trend indicator
        under_cusip:
          type: string
          description: Underlying security CUSIP
        undersymbol:
          type: string
          description: Underlying security symbol (for options)
        vl:
          type: string
          description: Volume
        volatility12:
          type: string
          description: 52-week price volatility
        vwap:
          type: string
          description: Volume weighted average price
        wk52hi:
          type: string
          description: 52-week high price
        wk52hidate:
          type: string
          description: Date of 52-week high
        wk52lo:
          type: string
          description: 52-week low price
        wk52lodate:
          type: string
          description: Date of 52-week low
        xdate:
          type: string
          description: Option expiration date (YYYYMMDD)
        xday:
          type: string
          description: Option expiration day
        xmonth:
          type: string
          description: Option expiration month
        xyear:
          type: string
          description: Option expiration year
        yield:
          type: string
          description: Dividend yield
    AccountSummary:
      type: object
      properties:
        account:
          type: string
          description: Account number
        accountbalance:
          $ref: '#/components/schemas/AccountBalance'
        accountholdings:
          $ref: '#/components/schemas/AccountHoldings'
  responses:
    Unauthorized:
      description: Authentication required or credentials invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Requested resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  parameters:
    AccountId:
      name: id
      in: path
      required: true
      description: The account ID (account number)
      schema:
        type: string
  securitySchemes:
    OAuth1:
      type: apiKey
      in: header
      name: Authorization
      description: OAuth 1.0 authentication using consumer key/secret and OAuth token/secret pairs. The Authorization header must include oauth_consumer_key, oauth_token, oauth_signature_method (HMAC-SHA1), oauth_timestamp, oauth_nonce, oauth_version, and oauth_signature.
externalDocs:
  description: Ally Invest API Documentation
  url: https://www.ally.com/api/invest/documentation/getting-started/