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

# Batch positions for one token across wallets

> Positions for one token across many wallets (`WHERE mint=? AND wallet IN(...)`). Each row mirrors the `/traders` per-row object (wallet-keyed). Aligned to input `wallets` (`null` for missing). 1–200 wallets; empty → 400, >200 → 400.



## OpenAPI

````yaml /api-reference/openapi.json post /v2/pnl/tokens/{token}/positions/batch
openapi: 3.1.0
info:
  title: Dexploit API
  version: 1.0.0
  description: Real-time and historical Solana DEX swap and OHLCV data.
servers:
  - url: https://api.dexploit.dev
    description: Production
security:
  - ApiKeyHeader: []
  - BearerAuth: []
  - ApiKeyQuery: []
paths:
  /v2/pnl/tokens/{token}/positions/batch:
    post:
      tags:
        - Wallet PnL (v2)
      summary: Batch positions for one token across wallets
      description: >-
        Positions for one token across many wallets (`WHERE mint=? AND wallet
        IN(...)`). Each row mirrors the `/traders` per-row object
        (wallet-keyed). Aligned to input `wallets` (`null` for missing). 1–200
        wallets; empty → 400, >200 → 400.
      operationId: postPnlV2TokenPositionsBatch
      parameters:
        - name: token
          in: path
          required: true
          schema:
            type: string
          description: Token mint address (base58).
        - name: pnl_mode
          in: query
          required: false
          schema:
            type: string
            enum:
              - raw
              - strict
              - adjusted
            default: adjusted
          description: >-
            PnL accounting mode. `strict` (FIFO) and `adjusted` (weighted-avg
            cost) are realized-PnL figures; `raw` is **net cash-flow** (Σ sells
            − Σ buys), not realized PnL. Unknown values fall back to `adjusted`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                wallets:
                  type: array
                  minItems: 1
                  maxItems: 200
                  items:
                    type: string
              required:
                - wallets
      responses:
        '200':
          description: Batch positions
          content:
            application/json:
              schema:
                type: object
                properties:
                  token:
                    type: string
                  pnl_mode:
                    type: string
                  count:
                    type: integer
                  positions:
                    type: array
                    items:
                      oneOf:
                        - $ref: '#/components/schemas/PnlPositionByWallet'
                        - type: 'null'
        '400':
          description: Invalid parameter or malformed body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    PnlPositionByWallet:
      type: object
      description: >-
        Same shape as `PnlPosition` but keyed on `wallet` (the `mint` key is
        removed and `wallet` inserted). Returned by token-scoped endpoints.
      properties:
        wallet:
          type: string
        balance_atomic:
          type: integer
        avg_cost_per_token:
          type: number
        cost_basis_sol:
          type: number
        realized_sol:
          type: number
        unrealized_sol:
          type:
            - number
            - 'null'
        current_value_sol:
          type:
            - number
            - 'null'
        total_buys_sol:
          type: number
        total_sells_sol:
          type: number
        total_buy_count:
          type: integer
        total_sell_count:
          type: integer
        largest_buy_sol:
          type: number
        largest_sell_sol:
          type: number
        fastest_flip_seconds:
          type: integer
        longest_hold_seconds:
          type: integer
        first_trade_ts:
          type: integer
          description: Epoch milliseconds.
        last_trade_ts:
          type: integer
          description: Epoch milliseconds.
        is_arbitrageur:
          type: boolean
        tags:
          type: array
          items:
            type: string
        realized_breakdown:
          $ref: '#/components/schemas/RealizedBreakdown'
        realized_usd:
          type:
            - number
            - 'null'
        unrealized_usd:
          type:
            - number
            - 'null'
        current_value_usd:
          type:
            - number
            - 'null'
        cost_basis_usd:
          type:
            - number
            - 'null'
    ErrorEnvelope:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: INVALID_PARAM
            message:
              type: string
              example: >-
                use pair_address; see /api/v1/pairs?token_address=X to discover
                pools
    RealizedBreakdown:
      type: object
      description: >-
        Per-mode realized accounting (SOL). Present on glass-box responses or
        when `breakdown=1`. Note `raw` is **not** realized PnL — it is net
        cash-flow (Σ sells − Σ buys). Only `strict` and `adjusted` are
        cost-basis realized-PnL figures.
      properties:
        raw:
          type: number
          description: >-
            Net cash-flow in SOL: Σ(SOL received from sells) − Σ(SOL spent on
            buys). **Not realized PnL** — it ignores cost basis and counts every
            buy (including zero-token buys), so it diverges from
            `strict`/`adjusted` whenever a position still holds open lots (Wave
            6.5 / QW-9).
        strict:
          type: number
          description: >-
            Realized PnL in SOL under strict FIFO lot matching (`proceeds −
            matched_cost` on the matched portion of each sell).
        adjusted:
          type: number
          description: >-
            Realized PnL in SOL under weighted-average cost basis (`proceeds −
            avg_cost × sell_qty`). The default `pnl_mode`.
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Preferred for swaps-api endpoints (`/swaps/*`, `/stats/*`, `/trending`,
        `/pool-events`).
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Required by the OHLCV endpoints (`/api/v1/*`) and accepted by every
        other endpoint. Send `Authorization: Bearer ohlcv_live_sk_<your_key>`.
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: >-
        Browser-friendly alternative to the Bearer header — accepted by every
        endpoint and required for WebSocket from the browser.

````