> ## Documentation Index
> Fetch the complete documentation index at: https://octo-98895abd.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# v2 portfolio

> <Warning>Preview, not deployed. The v2 gateway is built but not deployed yet; this call works once the owner deploys `silo-api`.</Warning>

Diagnose a portfolio: resolve statement lines, fees, look-through, movement (POST).

Example: `POST /v2/portfolio?kind=resolve {"names": ["ITAU RF DI"]}`

Kinds:

- `resolve`: api.portfolio_resolve: up to 5 ranked candidate funds per statement line (a printed CNPJ wins, then an ETF ticker, an exact name, a trigram match).
- `fees`: api.portfolio_fees: the disclosed fee and the fee estimated from the balancete, never mixed.
- `fee_peers`: api.portfolio_fee_peers: the admin fee against funds and ETFs of the same filed class, one row per CNPJ.
- `lookthrough`: api.portfolio_lookthrough: one CDA month, holdings followed through fund quotas up to max_depth levels.
- `movement`: api.portfolio_movement: the fund's monthly quota return against its filed class (movimento incomum).
- `instruments`: api.portfolio_instruments: CRA, CRI and debenture codes matched to their series, one line per code.
- `fund_terms`: api.portfolio_fund_terms: manager, administrator and redemption terms as filed, one line per CNPJ.
- `equivalents`: api.portfolio_equivalents: the active ETFs tracking an index the owner-reviewed list maps to each filed class.
- `debenture_returns`: api.portfolio_debenture_returns: 13 month-ends of median fund marks (CDA block 4) per debenture ticker; marks, not trades. Needs month.

A data call is a POST: kind, month and the hidden parameters go in the query string, the lists go in a JSON body (see body). ?help stays a GET. Read-only: every kind is one api.portfolio_* function.

Each list is capped by its function (200 entries, 70 for debenture_returns, 50 classes for equivalents) and refused above it, never trimmed.

Not served: portfolio_credit_returns (held back with the ANBIMA-linked endpoints). The class in fees, fee_peers, movement and equivalents is the ANBIMA class label as filed in the CVM Extrato; no ANBIMA table is read.

`GET /v2/portfolio?help` describes the main parameters, `?help=all` adds the hidden ones.



## OpenAPI

````yaml /api-docs/v2/openapi.json post /portfolio
openapi: 3.1.0
info:
  title: SILO API v2 (preview, not deployed)
  version: v2
  description: >-
    The v2 gateway over SILO's schema `api`: 14 resources, five shared
    parameters, one envelope and one error object. Generated from
    supabase/functions/silo-api/registry.ts by scripts/gen_openapi_v2.py; do not
    edit by hand. Preview, not deployed. The v2 gateway is built but not
    deployed yet; this call works once the owner deploys `silo-api`.
servers:
  - url: https://zcjbtpxuhdekpwcxmepn.supabase.co/functions/v1/silo-api/v2
    description: The silo-api Edge Function (preview, not deployed).
security:
  - apikey: []
  - apikey: []
    bearerAuth: []
paths:
  /portfolio:
    post:
      summary: v2 portfolio
      description: >-
        <Warning>Preview, not deployed. The v2 gateway is built but not deployed
        yet; this call works once the owner deploys `silo-api`.</Warning>


        Diagnose a portfolio: resolve statement lines, fees, look-through,
        movement (POST).


        Example: `POST /v2/portfolio?kind=resolve {"names": ["ITAU RF DI"]}`


        Kinds:


        - `resolve`: api.portfolio_resolve: up to 5 ranked candidate funds per
        statement line (a printed CNPJ wins, then an ETF ticker, an exact name,
        a trigram match).

        - `fees`: api.portfolio_fees: the disclosed fee and the fee estimated
        from the balancete, never mixed.

        - `fee_peers`: api.portfolio_fee_peers: the admin fee against funds and
        ETFs of the same filed class, one row per CNPJ.

        - `lookthrough`: api.portfolio_lookthrough: one CDA month, holdings
        followed through fund quotas up to max_depth levels.

        - `movement`: api.portfolio_movement: the fund's monthly quota return
        against its filed class (movimento incomum).

        - `instruments`: api.portfolio_instruments: CRA, CRI and debenture codes
        matched to their series, one line per code.

        - `fund_terms`: api.portfolio_fund_terms: manager, administrator and
        redemption terms as filed, one line per CNPJ.

        - `equivalents`: api.portfolio_equivalents: the active ETFs tracking an
        index the owner-reviewed list maps to each filed class.

        - `debenture_returns`: api.portfolio_debenture_returns: 13 month-ends of
        median fund marks (CDA block 4) per debenture ticker; marks, not trades.
        Needs month.


        A data call is a POST: kind, month and the hidden parameters go in the
        query string, the lists go in a JSON body (see body). ?help stays a GET.
        Read-only: every kind is one api.portfolio_* function.


        Each list is capped by its function (200 entries, 70 for
        debenture_returns, 50 classes for equivalents) and refused above it,
        never trimmed.


        Not served: portfolio_credit_returns (held back with the ANBIMA-linked
        endpoints). The class in fees, fee_peers, movement and equivalents is
        the ANBIMA class label as filed in the CVM Extrato; no ANBIMA table is
        read.


        `GET /v2/portfolio?help` describes the main parameters, `?help=all` adds
        the hidden ones.
      operationId: v2_portfolio
      parameters:
        - name: kind
          in: query
          required: false
          description: >-
            resolve: statement lines to candidate funds. fees: estimated and
            disclosed fees. fee_peers: the admin fee against its filed class.
            lookthrough: holdings through fund quotas. movement: the month's
            quota return against its class. instruments: CRA, CRI and debenture
            codes. fund_terms: manager, administrator, redemption terms.
            equivalents: the ETFs that track a class's index. debenture_returns:
            13 month-ends of debenture marks. Default: resolve.
          schema:
            type: string
            enum:
              - resolve
              - fees
              - fee_peers
              - lookthrough
              - movement
              - instruments
              - fund_terms
              - equivalents
              - debenture_returns
            default: resolve
          example: resolve
        - name: month
          in: query
          required: false
          description: >-
            Any day of the month. fees, lookthrough, movement: the month read.
            debenture_returns: the window's last month. Default: the latest
            complete month, as each function defines it (fees: each fund's
            newest balancete; lookthrough: the last complete CDA month;
            movement: the last complete FI month). debenture_returns has no
            default month and needs one.
          schema:
            type: string
            format: date
        - name: limit
          in: query
          required: false
          description: >-
            The page size. More rows than one page come through next_page_url,
            never cut silently; a call stops at the tier's rows-per-call cap
            with meta.tier_cap_reached. Default: the tier's page maximum (10
            anonymous, 100 signed in); a larger value is coerced to it.
          schema:
            type: integer
            minimum: 1
        - name: cursor
          in: query
          required: false
          description: >-
            The opaque cursor from a previous next_page_url. It carries every
            other parameter: send it alone (another parameter with a different
            value is bad_request). Default: none: the first page.
          schema:
            type: string
        - name: max_depth
          in: query
          required: false
          description: >-
            Hidden parameter (`?help=all` lists it). lookthrough: fund-quota
            levels looked through, 1..6 (the SQL default is 4). Default: 4.
          schema:
            type: integer
            minimum: 0
            default: 4
        - name: as_of
          in: query
          required: false
          description: >-
            Hidden parameter (`?help=all` lists it). fee_peers: dates the
            comparison and excludes later documents; it reads the latest
            Extrato, so it is not a historical backtest. equivalents: snapshots
            dated after it are not read. Default: today (the SQL default).
          schema:
            type: string
            format: date
        - name: max_monthly_drop_pct
          in: query
          required: false
          description: >-
            Hidden parameter (`?help=all` lists it). debenture_returns: a
            monthly PU drop beyond this is flagged queda_pu_possivel_evento.
            Default: none: every decrease is flagged limite_pendente (the
            threshold is the owner's to set).
          schema:
            type: number
            minimum: 0
      requestBody:
        required: true
        description: >-
          A JSON object of lists. Every other parameter goes in the query
          string.
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: array
                  items:
                    type:
                      - string
                      - 'null'
                  description: >-
                    The list: fund CNPJs (fees, fee_peers, lookthrough,
                    movement, fund_terms; resolve: the CNPJ each line prints,
                    parallel to names), instrument codes (instruments), filed
                    ANBIMA class labels (equivalents) or debenture tickers
                    (debenture_returns). Null entries are allowed where the
                    function takes them. Default: none: required by every kind
                    except resolve.
                names:
                  type: array
                  items:
                    type:
                      - string
                      - 'null'
                  description: >-
                    resolve: one statement line each, the fund name as printed.
                    Default: none: required by resolve.
                quotas:
                  type: array
                  items:
                    type:
                      - number
                      - 'null'
                  description: >-
                    resolve: the quota value each line prints, parallel to
                    names, for the tie-break. Default: none.
                quota_dates:
                  type: array
                  items:
                    type:
                      - string
                      - 'null'
                    format: date
                  description: >-
                    resolve: the date each quota refers to, parallel to names.
                    Default: none.
              additionalProperties: false
            example:
              names:
                - ITAU RF DI
      responses:
        '200':
          description: The v2 envelope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
        default:
          description: >-
            The v2 error object. A SILO refusal (over_limit) keeps its message,
            hint and details verbatim.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Envelope:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items: {}
          description: Always a list. Rows as the endpoint returned them; null stays null.
        meta:
          type: object
          required:
            - resource
            - kind
            - request
            - id_known
          properties:
            resource:
              type: string
            kind:
              type:
                - string
                - 'null'
            request:
              type: object
              description: Every parameter the resource takes, with the default applied.
            id_known:
              type:
                - boolean
                - 'null'
              description: Whether SILO holds the id; null when the call names none.
            endpoint:
              type: string
              description: The api.* endpoint that answered.
          additionalProperties: true
        next_page_url:
          type: string
          description: Present only when more rows remain. It carries one opaque cursor.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - target
            - innererror
          properties:
            code:
              type: string
              enum:
                - bad_request
                - unknown_parameter
                - unknown_id
                - unauthorized
                - forbidden_for_tier
                - over_limit
                - rate_limited
                - timeout
                - unavailable
                - internal
            message:
              type: string
            target:
              type:
                - string
                - 'null'
            innererror:
              type: object
              properties:
                sqlstate:
                  type:
                    - string
                    - 'null'
                hint:
                  type:
                    - string
                    - 'null'
                details:
                  type:
                    - string
                    - 'null'
  securitySchemes:
    apikey:
      type: apiKey
      in: header
      name: apikey
      description: >-
        The public publishable key. It identifies the project, not you, and is
        the anonymous tier.
      x-default: sb_publishable__yfFQsykAglrvc9GS6_PYw_B24ex437
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Optional. A user JWT from Supabase Auth, for the signed-in tier. Never a
        secret key.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.