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

# A wallet's position in one market

> A wallet's existing position in a single market: shares, value, accrued-yield breakdown, and live `positionApy`. Returns `hasPosition: false` (with zeroed fields) when the wallet holds no stake in this market.




## OpenAPI

````yaml /openapi/v1.yaml get /markets/{conditionId}/position
openapi: 3.1.0
info:
  title: Robin Markets Integration API
  version: 1.0.0
  description: >
    Public API for surfacing Robin staking inside a third-party frontend. You
    already have the Polymarket market data; this returns **what Robin computes
    on top**: a market's live staking APY, a personalized projected APY for a
    stake a user is about to make, and the state of a wallet's existing
    positions (shares, value, accrued-yield breakdown, live APY).


    Data endpoints are **read-only**. Two `POST` helpers cover actions a read
    can't: `POST /markets` indexes a market from Polymarket, and `POST /twap`
    returns a signed oracle update you must submit on-chain before depositing or
    withdrawing.


    ### Conventions

    - **Token / USD amounts** are 6-decimal integer strings (`"1500000"` = 1.5).
    Both outcome tokens
      and USDC use 6 decimals. Divide by `1e6` to display.

    - **APY values** are plain numbers in **percent** (`6.0` means 6.00% APY).

    - **`conditionId`** is the Polymarket condition id (bytes32 hex).

    - **`wallet`** is the user's resolved Robin staking wallet (a Polymarket
    DepositWallet or Gnosis
      Safe proxy), **not** the user's EOA.

    - Outcome / side values are `"yes"` / `"no"` (and `"both"` for a
    fully-resolved market).


    ### Auth, CORS & rate limiting

    No authentication. CORS is wide-open (`Access-Control-Allow-Origin: *`), so
    endpoints can be called directly from the browser; each path also answers
    `OPTIONS` preflight. Requests are rate-limited per IP (shared global budget)
    — back off on `429`.


    ### The APY formula

    Every APY is built from three layers: `total = max(nativeApy ×
    matchedFraction, guaranteeFloor) + matchingBonus + pointsBoost`. Base =
    socialized native yield, floored at the guarantee; matching = +1% for the
    pool-balancing (minority) side, scaled by the matchable portion; points = a
    personalized Robin Points boost (never handled directly — it appears as the
    `points` line and is folded into totals).
  license:
    name: See repository
servers:
  - url: https://app.robin.markets/api/v1
    description: Production
security: []
tags:
  - name: Markets
    description: Market-level staking APY and per-wallet quotes/positions.
  - name: Positions
    description: A wallet's existing Robin positions.
  - name: TWAP
    description: Signed oracle price updates required before depositing or withdrawing.
  - name: Capacity
    description: >-
      Two-tier vault deposit capacity (internal guard + external ERC-4626
      headroom).
  - name: Meta
    description: Static integration metadata.
paths:
  /markets/{conditionId}/position:
    get:
      tags:
        - Markets
      summary: A wallet's position in one market
      description: >
        A wallet's existing position in a single market: shares, value,
        accrued-yield breakdown, and live `positionApy`. Returns `hasPosition:
        false` (with zeroed fields) when the wallet holds no stake in this
        market.
      operationId: getMarketPosition
      parameters:
        - $ref: '#/components/parameters/ConditionIdPath'
        - $ref: '#/components/parameters/WalletQueryRequired'
      responses:
        '200':
          description: Position (possibly empty).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SinglePosition'
        '400':
          $ref: '#/components/responses/BadRequest'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    ConditionIdPath:
      name: conditionId
      in: path
      required: true
      description: Polymarket condition id (bytes32 hex).
      schema:
        $ref: '#/components/schemas/ConditionId'
    WalletQueryRequired:
      name: wallet
      in: query
      required: true
      description: >-
        The user's resolved Robin staking wallet (DepositWallet or Safe proxy),
        not the EOA.
      schema:
        $ref: '#/components/schemas/Address'
  schemas:
    SinglePosition:
      type: object
      description: >
        Single-market position. When `hasPosition` is false the descriptive
        market fields (`question`, `slug`, `image`, `endDate`, `resolved`,
        `winningOutcome`) are omitted and the rest are zeroed.
      required:
        - conditionId
        - wallet
        - hasPosition
        - shares
        - value
        - yield
        - positionApy
      properties:
        conditionId:
          $ref: '#/components/schemas/ConditionId'
        wallet:
          $ref: '#/components/schemas/Address'
        hasPosition:
          type: boolean
        question:
          type: string
        slug:
          type: string
        image:
          type:
            - string
            - 'null'
        endDate:
          type:
            - integer
            - 'null'
          format: int64
        resolved:
          type: boolean
        winningOutcome:
          type:
            - string
            - 'null'
          enum:
            - 'yes'
            - 'no'
            - both
            - null
        shares:
          $ref: '#/components/schemas/Shares'
        value:
          $ref: '#/components/schemas/Amount6'
        yield:
          $ref: '#/components/schemas/Yield'
        positionApy:
          $ref: '#/components/schemas/Apy'
      example:
        wallet: '0x01f34b73fd22e69e036f110b0cdf4f4ed66ff53e'
        hasPosition: true
        conditionId: '0xce9a5fa30fe74e323b4a8f15afbb0b7a41a537aa880779ddf7dee22223b2f34a'
        question: Will Donald Trump win the 2028 US Presidential Election?
        slug: will-donald-trump-win-the-2028-us-presidential-election
        image: null
        endDate: 1857168000000
        resolved: false
        winningOutcome: null
        shares:
          'yes': '70000000'
          'no': '0'
        value: '2100000'
        yield:
          total: '19437'
          base: '0'
          guarantee: '19437'
          matching: '0'
          points: '0'
        positionApy: 6.95
    ConditionId:
      type: string
      description: 32-byte Polymarket condition id, hex.
      pattern: ^0x[a-fA-F0-9]{64}$
      example: '0xce9a5fa30fe74e323b4a8f15afbb0b7a41a537aa880779ddf7dee22223b2f34a'
    Address:
      type: string
      description: 20-byte EVM address, lowercase hex.
      pattern: ^0x[a-fA-F0-9]{40}$
      example: '0xcb7444981296d08da7161b75378e3773dbf5d806'
    Shares:
      type: object
      required:
        - 'yes'
        - 'no'
      properties:
        'yes':
          $ref: '#/components/schemas/Amount6'
        'no':
          $ref: '#/components/schemas/Amount6'
    Amount6:
      type: string
      description: >-
        A non-negative integer in 6-decimal fixed-point micro-units (e.g.
        "1500000" = 1.5).
      pattern: ^[0-9]+$
      example: '1500000'
    Yield:
      type: object
      description: Accrued (not-yet-claimed) yield in 6-decimal USD, split by source.
      required:
        - total
        - base
        - guarantee
        - matching
        - points
      properties:
        total:
          $ref: '#/components/schemas/Amount6'
        base:
          $ref: '#/components/schemas/Amount6'
        guarantee:
          $ref: '#/components/schemas/Amount6'
        matching:
          $ref: '#/components/schemas/Amount6'
        points:
          $ref: '#/components/schemas/Amount6'
    Apy:
      type: number
      format: double
      description: APY in percent (6.0 = 6.00%).
      example: 6.4
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - bad_request
                - not_found
                - rate_limited
                - internal
                - twap_unavailable
                - twap_timeout
                - capacity_unavailable
            message:
              type: string
  responses:
    BadRequest:
      description: Invalid parameters (e.g. missing `wallet`, or a non-integer amount).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: bad_request
              message: wallet is required
    TooManyRequests:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: Too many requests
    InternalError:
      description: Internal error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: internal
              message: Internal error

````