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

# Get Portfolio

> Get portfolio and P&L for a user. If eventId is provided (as market_id), get portfolio for the specific market. Otherwise, get global portfolio across all events.



## OpenAPI

````yaml /swagger.json get /user/portfolio
openapi: 3.0.1
info:
  contact: {}
  title: VoxFi API
  version: 0.0.1
servers:
  - url: https://data-api-dev.voxfi.com.br/v1
security: []
paths:
  /user/portfolio:
    get:
      tags:
        - user
      summary: Get Portfolio
      description: >-
        Get portfolio and P&L for a user. If eventId is provided (as market_id),
        get portfolio for the specific market. Otherwise, get global portfolio
        across all events.
      parameters:
        - name: eventId
          in: query
          description: Event ID
          schema:
            type: string
        - name: x-api-key
          in: header
          description: API Key
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.PortfolioResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                type: object
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
components:
  schemas:
    models.PortfolioResponse:
      type: object
      properties:
        contracts:
          type: array
          items:
            $ref: '#/components/schemas/models.ContractsEntry'
        total_cost:
          type: integer
        total_market_value:
          type: integer
        total_realized_pnl:
          type: integer
        total_unrealized_pnl:
          type: integer
    models.ContractsEntry:
      type: object
      properties:
        event_description:
          type: string
        event_id:
          type: string
        event_slug:
          type: string
        markets:
          type: array
          items:
            $ref: '#/components/schemas/models.ContractsByMarket'
    models.ContractsByMarket:
      type: object
      properties:
        contracts_no:
          type: integer
        contracts_yes:
          type: integer
        market_description:
          type: string
        market_id:
          type: string
        market_price_no:
          type: integer
        market_price_yes:
          type: integer
        market_value_no:
          type: integer
        market_value_yes:
          type: integer
        settled:
          type: boolean
        total_cost_no:
          type: integer
        total_cost_yes:
          type: integer
        unrealized_pnl_no:
          type: integer
        unrealized_pnl_yes:
          type: integer

````