{
  "openapi": "3.1.0",
  "info": {
    "title": "SILO API v2",
    "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. The original v1 API stays available until it is retired."
  },
  "servers": [
    {
      "url": "https://zcjbtpxuhdekpwcxmepn.supabase.co/functions/v1/silo-api/v2",
      "description": "The silo-api Edge Function."
    }
  ],
  "security": [
    {},
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Discovery"
    },
    {
      "name": "Markets and macro"
    },
    {
      "name": "Companies and funds"
    },
    {
      "name": "Research"
    }
  ],
  "paths": {
    "/statements/debt-issues": {
      "get": {
        "operationId": "v2_statements_debt_issues",
        "summary": "Debt issues",
        "tags": [
          "Companies and funds"
        ],
        "description": "Debentures, commercial notes, CRI, CRA and other debt one listed company describes in its CVM FRE, yearly from 2010. One row is one issue as filed, often several series, with no ticker or ISIN. Rate and indexer appear only in terms_text, unparsed. Companies that file no FRE are not covered.",
        "x-mint": {
          "href": "/api-docs/v2/operations/statements/debt_issues"
        },
        "parameters": [
          {
            "name": "identifier",
            "in": "query",
            "required": true,
            "description": "Company ticker, CNPJ or CVM code.",
            "schema": {
              "type": "string"
            },
            "example": "PETR4"
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start date (YYYY-MM-DD).",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End date (YYYY-MM-DD).",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page, subject to your tier.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Cursor from the next page URL.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "required": false,
            "description": "Optional Bearer token for signed-in or Pro access.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "details",
            "in": "query",
            "required": false,
            "description": "Include request diagnostics.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The v2 envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "example": {
                  "data": [
                    {
                      "cd_cvm": "9512",
                      "cnpj": "33000167000101",
                      "company": "PETROLEO BRASILEIRO S.A. PETROBRAS",
                      "reference_date": "2025-12-31",
                      "version": 27,
                      "security_type": "Debêntures",
                      "issue_name": "1ª Série da 6ª Emissão de Debêntures Simples, em 3 Séries",
                      "issue_date": "2019-01-15",
                      "maturity_date": "2026-01-15",
                      "quantity": 898397,
                      "issue_value": 898397000.0,
                      "outstanding_balance": 1266447208.93,
                      "transfer_restricted": null,
                      "convertible": null,
                      "redeemable": true,
                      "terms_text": "Emissão pela companhia em 15/01/2019 de debêntures simples, não conversíveis em ações, da espécie quirografária, sem garantia (\"Debêntures\"), em três séries, no montante total de R$ 3.600.000.000,00 (três bilhões e seiscentos milhões de reais) para distribuição pública, nos termos da Instrução da CVM nº 400, de 29 de dezembro de 2003.",
                      "source": "cvm_fre"
                    }
                  ],
                  "meta": {
                    "tier": "pro"
                  }
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "SILO user access token for authenticated data requests."
      }
    },
    "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": [
              "tier"
            ],
            "properties": {
              "source": {
                "type": "string",
                "description": "The canonical request to cite: /v2/<resource>? with every applied parameter, defaults included, so it replays the same rows. POST says so; its lists are in meta.body."
              },
              "data_through": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date",
                "description": "The newest elapsed period SILO holds for the dataset this endpoint reads (the coverage resource's data_through for coverage_dataset). Null when no coverage row applies or the coverage read failed; never a guess."
              },
              "coverage_dataset": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The coverage dataset data_through comes from; null when none applies."
              },
              "data_through_error": {
                "type": "string",
                "description": "Present only when the coverage read failed: why data_through is null. The rows are unaffected."
              },
              "tier": {
                "type": "string",
                "enum": [
                  "anonymous",
                  "signed_in",
                  "pro"
                ]
              },
              "tier_cap_reached": {
                "type": "boolean",
                "description": "True when the result is partial because of the tier cap."
              }
            },
            "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",
              "reason",
              "message",
              "target",
              "innererror"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "bad_request",
                  "unknown_parameter",
                  "unknown_id",
                  "unauthorized",
                  "payment_required",
                  "forbidden_for_tier",
                  "over_limit",
                  "rate_limited",
                  "timeout",
                  "unavailable",
                  "internal"
                ]
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "row_cap",
                  "tier_cap",
                  null
                ],
                "description": "over_limit only: row_cap (over one 1,000-row page: narrow or page) or tier_cap (over the tier ceiling: narrow or sign in). Null otherwise."
              },
              "message": {
                "type": "string"
              },
              "target": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "innererror": {
                "type": "object",
                "properties": {
                  "sqlstate": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "hint": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "details": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
