{
  "openapi": "3.1.0",
  "info": {
    "title": "rfin API Reference",
    "version": "0.1.0",
    "description": "FINRA Query API source API for bluedoor Financial Data.\nFINRA regulatory and market-structure datasets with queryable metadata.\nCoverage: OTC datasets; Short-interest style datasets; Dataset metadata; Fixed-income metadata.\nGenerated from the live source contract and representative live API responses on 2026-06-07T01:30:59.456Z."
  },
  "servers": [
    {
      "url": "https://api.rfin.bluedoor.sh",
      "description": "rfin source API"
    }
  ],
  "externalDocs": {
    "description": "FINRA Query API source API docs",
    "url": "https://bluedoor.sh/apis/financial-data/sources/rfin"
  },
  "tags": [
    {
      "name": "OTC"
    }
  ],
  "paths": {
    "/v1/otc/{dataset}": {
      "get": {
        "summary": "Rows",
        "parameters": [
          {
            "name": "dataset",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5000
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refresh",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "x-rfin-contact",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "format": "email"
            },
            "description": "Optional contact email for higher public rate limits and support diagnostics."
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "Bearer <key>"
            },
            "description": "Optional API-key authorization for higher-volume access tiers."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/rfin_get_otc_datasetResponse"
                },
                "examples": {
                  "live": {
                    "summary": "Live response",
                    "value": {
                      "meta": {
                        "provider": "finra",
                        "route": "otc_data",
                        "dataset": "otcSecurityMaster",
                        "kind": "data",
                        "cache": "kv",
                        "generated_at": "2026-06-07T01:32:53.620Z",
                        "freshness": {
                          "as_of": "2026-06-07T01:32:53.620Z",
                          "ttl_seconds": 1800,
                          "stale_seconds": 21600,
                          "stale": false
                        },
                        "status": "ok",
                        "pagination": {
                          "record_total": 162168,
                          "record_limit": 3,
                          "record_offset": 0,
                          "record_max_limit": 5000,
                          "response_payload_max_size": "3mb"
                        }
                      },
                      "data": "\"asOfDate\",\"finraIssuerIdentifier\",\"issueSymbolIdentifier\",\"market\",\"securityDescription\",\"issueType\",\"issuerName\"\n\"2026-05-26\",\"2073177\",\"FKURF\",\"OTC Equity\",\"Fujikura Ltd Ordinary Shares (Japan)\",\"Ordinary Shares\",\"Fujikura Ltd\"\n\"2026-05-26\",\"2050852\",\"HISJF\",\"OTC Equity\",\"H I S Co Ltd (Jpn) Ordinary Shares\",\"Ordinar..."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. A required parameter is missing, malformed, or outside the supported range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 400 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "bad_request",
                        "message": "Required query parameter is missing or invalid."
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. API-key authenticated tiers use an Authorization bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 401 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "unauthorized",
                        "message": "A valid API key is required for this tier."
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found. The requested route, resource, or symbol could not be resolved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 404 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "not_found",
                        "message": "The requested resource was not found."
                      }
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Source API routes are documented as HTTP GET unless otherwise specified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 405 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "method_not_allowed",
                        "message": "This route does not support the requested HTTP method."
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Retry after the limit reset or include the documented contact/API-key headers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 429 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests. Retry after the rate-limit reset."
                      }
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Upstream source error. The source service rejected or failed the upstream request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 502 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "upstream_error",
                        "message": "The upstream source returned an error."
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable. The source API or an upstream dependency is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 503 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "service_unavailable",
                        "message": "The service is temporarily unavailable."
                      }
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout. The upstream source did not return within the source API timeout window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 504 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "upstream_timeout",
                        "message": "The upstream source timed out."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ContactEmail": []
          },
          {
            "BearerAuth": []
          },
          {
            "RfinApiKey": []
          }
        ],
        "operationId": "rfin_get_otc_dataset",
        "description": "Returns rows with source-native fields and identifiers.",
        "tags": [
          "OTC"
        ],
        "x-source-api": "rfin",
        "x-source-name": "FINRA Query API",
        "x-source-upstream": "finra.org",
        "x-docs-example-url": "https://api.rfin.bluedoor.sh/v1/otc/security-master?limit=3",
        "x-docs-example-status": 200,
        "x-docs-captured-at": "2026-06-07T01:32:53.633Z"
      }
    },
    "/v1/fixed-income/{dataset}/metadata": {
      "get": {
        "summary": "Fixed-income metadata",
        "parameters": [
          {
            "name": "dataset",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refresh",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "x-rfin-contact",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "format": "email"
            },
            "description": "Optional contact email for higher public rate limits and support diagnostics."
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "Bearer <key>"
            },
            "description": "Optional API-key authorization for higher-volume access tiers."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/rfin_get_fixed_income_dataset_metadataResponse"
                },
                "examples": {
                  "live": {
                    "summary": "Live response",
                    "value": {
                      "meta": {
                        "provider": "finra",
                        "route": "fixed_income_metadata",
                        "dataset": "treasuryDailyAggregates",
                        "kind": "metadata",
                        "cache": "edge",
                        "generated_at": "2026-06-07T01:32:53.892Z",
                        "freshness": {
                          "as_of": "2026-06-07T01:32:53.892Z",
                          "ttl_seconds": 86400,
                          "stale_seconds": 1036800,
                          "stale": false
                        },
                        "status": "ok",
                        "pagination": {}
                      },
                      "data": {
                        "datasetGroup": "FIXEDINCOMEMARKET",
                        "datasetName": "TREASURYDAILYAGGREGATES",
                        "description": "Treasury Daily Aggregates",
                        "partitionFields": [
                          "tradeDate"
                        ],
                        "fields": [
                          {
                            "name": "tradeDate",
                            "type": "Date",
                            "format": "yyyy-MM-dd",
                            "description": "Date on which the security was traded"
                          },
                          {
                            "name": "productCategory",
                            "type": "String",
                            "description": "Category of the Treasury product"
                          },
                          {
                            "name": "yearsToMaturity",
                            "type": "String",
                            "description": "Range of years to maturity"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. A required parameter is missing, malformed, or outside the supported range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 400 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "bad_request",
                        "message": "Required query parameter is missing or invalid."
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. API-key authenticated tiers use an Authorization bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 401 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "unauthorized",
                        "message": "A valid API key is required for this tier."
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found. The requested route, resource, or symbol could not be resolved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 404 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "not_found",
                        "message": "The requested resource was not found."
                      }
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Source API routes are documented as HTTP GET unless otherwise specified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 405 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "method_not_allowed",
                        "message": "This route does not support the requested HTTP method."
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Retry after the limit reset or include the documented contact/API-key headers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 429 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests. Retry after the rate-limit reset."
                      }
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Upstream source error. The source service rejected or failed the upstream request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 502 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "upstream_error",
                        "message": "The upstream source returned an error."
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable. The source API or an upstream dependency is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 503 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "service_unavailable",
                        "message": "The service is temporarily unavailable."
                      }
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout. The upstream source did not return within the source API timeout window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 504 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "upstream_timeout",
                        "message": "The upstream source timed out."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ContactEmail": []
          },
          {
            "BearerAuth": []
          },
          {
            "RfinApiKey": []
          }
        ],
        "operationId": "rfin_get_fixed_income_dataset_metadata",
        "description": "Returns fixed-income metadata with source-native fields and identifiers.",
        "x-source-api": "rfin",
        "x-source-name": "FINRA Query API",
        "x-source-upstream": "finra.org",
        "x-docs-example-url": "https://api.rfin.bluedoor.sh/v1/fixed-income/treasury-daily-aggregates/metadata",
        "x-docs-example-status": 200,
        "x-docs-captured-at": "2026-06-07T01:32:53.900Z"
      }
    },
    "/v1/otc/{dataset}/metadata": {
      "get": {
        "summary": "Metadata",
        "parameters": [
          {
            "name": "dataset",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refresh",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "x-rfin-contact",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "format": "email"
            },
            "description": "Optional contact email for higher public rate limits and support diagnostics."
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "Bearer <key>"
            },
            "description": "Optional API-key authorization for higher-volume access tiers."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/rfin_get_otc_dataset_metadataResponse"
                },
                "examples": {
                  "live": {
                    "summary": "Live response",
                    "value": {
                      "meta": {
                        "provider": "finra",
                        "route": "otc_metadata",
                        "dataset": "otcSecurityMaster",
                        "kind": "metadata",
                        "cache": "edge",
                        "generated_at": "2026-06-07T01:32:54.156Z",
                        "freshness": {
                          "as_of": "2026-06-07T01:32:54.156Z",
                          "ttl_seconds": 86400,
                          "stale_seconds": 1036800,
                          "stale": false
                        },
                        "status": "ok",
                        "pagination": {}
                      },
                      "data": {
                        "datasetGroup": "OTCMARKET",
                        "datasetName": "OTCSECURITYMASTER",
                        "description": "OTC Security Master",
                        "partitionFields": [
                          "asOfDate"
                        ],
                        "fields": [
                          {
                            "name": "asOfDate",
                            "type": "Date",
                            "format": "yyyy-MM-dd",
                            "description": "As of date for the OTC Security Master"
                          },
                          {
                            "name": "finraIssuerIdentifier",
                            "type": "String",
                            "description": "FINRA Issuer ID"
                          },
                          {
                            "name": "issueSymbolIdentifier",
                            "type": "String",
                            "description": "Symbol"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. A required parameter is missing, malformed, or outside the supported range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 400 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "bad_request",
                        "message": "Required query parameter is missing or invalid."
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. API-key authenticated tiers use an Authorization bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 401 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "unauthorized",
                        "message": "A valid API key is required for this tier."
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found. The requested route, resource, or symbol could not be resolved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 404 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "not_found",
                        "message": "The requested resource was not found."
                      }
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Source API routes are documented as HTTP GET unless otherwise specified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 405 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "method_not_allowed",
                        "message": "This route does not support the requested HTTP method."
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Retry after the limit reset or include the documented contact/API-key headers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 429 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests. Retry after the rate-limit reset."
                      }
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Upstream source error. The source service rejected or failed the upstream request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 502 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "upstream_error",
                        "message": "The upstream source returned an error."
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable. The source API or an upstream dependency is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 503 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "service_unavailable",
                        "message": "The service is temporarily unavailable."
                      }
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout. The upstream source did not return within the source API timeout window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 504 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "upstream_timeout",
                        "message": "The upstream source timed out."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ContactEmail": []
          },
          {
            "BearerAuth": []
          },
          {
            "RfinApiKey": []
          }
        ],
        "operationId": "rfin_get_otc_dataset_metadata",
        "description": "Returns metadata with source-native fields and identifiers.",
        "tags": [
          "OTC"
        ],
        "x-source-api": "rfin",
        "x-source-name": "FINRA Query API",
        "x-source-upstream": "finra.org",
        "x-docs-example-url": "https://api.rfin.bluedoor.sh/v1/otc/security-master/metadata",
        "x-docs-example-status": 200,
        "x-docs-captured-at": "2026-06-07T01:32:54.164Z"
      }
    },
    "/v1/otc/{dataset}/partitions": {
      "get": {
        "summary": "Partitions",
        "parameters": [
          {
            "name": "dataset",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refresh",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "x-rfin-contact",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "format": "email"
            },
            "description": "Optional contact email for higher public rate limits and support diagnostics."
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "Bearer <key>"
            },
            "description": "Optional API-key authorization for higher-volume access tiers."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/rfin_get_otc_dataset_partitionsResponse"
                },
                "examples": {
                  "live": {
                    "summary": "Live response",
                    "value": {
                      "meta": {
                        "provider": "finra",
                        "route": "otc_partitions",
                        "dataset": "otcSecurityMaster",
                        "kind": "partitions",
                        "cache": "edge",
                        "generated_at": "2026-06-07T01:32:54.424Z",
                        "freshness": {
                          "as_of": "2026-06-07T01:32:54.424Z",
                          "ttl_seconds": 21600,
                          "stale_seconds": 259200,
                          "stale": false
                        },
                        "status": "ok",
                        "pagination": {}
                      },
                      "data": {
                        "datasetGroup": "otcmarket",
                        "datasetName": "otcsecuritymaster",
                        "partitionFields": [
                          "asOfDate"
                        ],
                        "availablePartitions": [
                          {
                            "partitions": [
                              "2026-06-05"
                            ]
                          },
                          {
                            "partitions": [
                              "2026-06-04"
                            ]
                          },
                          {
                            "partitions": [
                              "2026-06-03"
                            ]
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. A required parameter is missing, malformed, or outside the supported range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 400 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "bad_request",
                        "message": "Required query parameter is missing or invalid."
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. API-key authenticated tiers use an Authorization bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 401 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "unauthorized",
                        "message": "A valid API key is required for this tier."
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found. The requested route, resource, or symbol could not be resolved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 404 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "not_found",
                        "message": "The requested resource was not found."
                      }
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Source API routes are documented as HTTP GET unless otherwise specified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 405 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "method_not_allowed",
                        "message": "This route does not support the requested HTTP method."
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Retry after the limit reset or include the documented contact/API-key headers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 429 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests. Retry after the rate-limit reset."
                      }
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Upstream source error. The source service rejected or failed the upstream request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 502 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "upstream_error",
                        "message": "The upstream source returned an error."
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable. The source API or an upstream dependency is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 503 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "service_unavailable",
                        "message": "The service is temporarily unavailable."
                      }
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout. The upstream source did not return within the source API timeout window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 504 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "upstream_timeout",
                        "message": "The upstream source timed out."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ContactEmail": []
          },
          {
            "BearerAuth": []
          },
          {
            "RfinApiKey": []
          }
        ],
        "operationId": "rfin_get_otc_dataset_partitions",
        "description": "Returns partitions with source-native fields and identifiers.",
        "tags": [
          "OTC"
        ],
        "x-source-api": "rfin",
        "x-source-name": "FINRA Query API",
        "x-source-upstream": "finra.org",
        "x-docs-example-url": "https://api.rfin.bluedoor.sh/v1/otc/security-master/partitions",
        "x-docs-example-status": 200,
        "x-docs-captured-at": "2026-06-07T01:32:54.429Z"
      }
    },
    "/v1/otc/{dataset}/query": {
      "post": {
        "summary": "Query",
        "parameters": [
          {
            "name": "dataset",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refresh",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "example": "3",
            "description": "Query parameter `limit`."
          },
          {
            "name": "x-rfin-contact",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "format": "email"
            },
            "description": "Optional contact email for higher public rate limits and support diagnostics."
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "Bearer <key>"
            },
            "description": "Optional API-key authorization for higher-volume access tiers."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/rfin_post_otc_dataset_queryResponse"
                },
                "examples": {
                  "live": {
                    "summary": "Live response",
                    "value": {
                      "meta": {
                        "provider": "finra",
                        "route": "otc_data",
                        "dataset": "otcSecurityMaster",
                        "kind": "data",
                        "cache": "edge",
                        "generated_at": "2026-06-07T01:32:54.682Z",
                        "freshness": {
                          "as_of": "2026-06-07T01:32:54.682Z",
                          "ttl_seconds": 1800,
                          "stale_seconds": 21600,
                          "stale": false
                        },
                        "status": "ok",
                        "pagination": {
                          "record_total": 162168,
                          "record_limit": 3,
                          "record_offset": 0,
                          "record_max_limit": 5000,
                          "response_payload_max_size": "3mb"
                        }
                      },
                      "data": "\"asOfDate\",\"finraIssuerIdentifier\",\"issueSymbolIdentifier\",\"market\",\"securityDescription\",\"issueType\",\"issuerName\"\n\"2026-05-26\",\"2073177\",\"FKURF\",\"OTC Equity\",\"Fujikura Ltd Ordinary Shares (Japan)\",\"Ordinary Shares\",\"Fujikura Ltd\"\n\"2026-05-26\",\"2050852\",\"HISJF\",\"OTC Equity\",\"H I S Co Ltd (Jpn) Ordinary Shares\",\"Ordinar..."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. A required parameter is missing, malformed, or outside the supported range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 400 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "bad_request",
                        "message": "Required query parameter is missing or invalid."
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. API-key authenticated tiers use an Authorization bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 401 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "unauthorized",
                        "message": "A valid API key is required for this tier."
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found. The requested route, resource, or symbol could not be resolved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 404 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "not_found",
                        "message": "The requested resource was not found."
                      }
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Source API routes are documented as HTTP GET unless otherwise specified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 405 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "method_not_allowed",
                        "message": "This route does not support the requested HTTP method."
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Retry after the limit reset or include the documented contact/API-key headers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 429 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "rate_limited",
                        "message": "Too many requests. Retry after the rate-limit reset."
                      }
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Upstream source error. The source service rejected or failed the upstream request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 502 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "upstream_error",
                        "message": "The upstream source returned an error."
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable. The source API or an upstream dependency is temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 503 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "service_unavailable",
                        "message": "The service is temporarily unavailable."
                      }
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Upstream timeout. The upstream source did not return within the source API timeout window.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                },
                "examples": {
                  "default": {
                    "summary": "HTTP 504 error",
                    "value": {
                      "ok": false,
                      "error": {
                        "code": "upstream_timeout",
                        "message": "The upstream source timed out."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ContactEmail": []
          },
          {
            "BearerAuth": []
          },
          {
            "RfinApiKey": []
          }
        ],
        "operationId": "rfin_post_otc_dataset_query",
        "description": "Returns query with source-native fields and identifiers.",
        "tags": [
          "OTC"
        ],
        "x-source-api": "rfin",
        "x-source-name": "FINRA Query API",
        "x-source-upstream": "finra.org",
        "x-docs-example-url": "https://api.rfin.bluedoor.sh/v1/otc/security-master/query?limit=3",
        "x-docs-example-status": 200,
        "x-docs-captured-at": "2026-06-07T01:32:54.691Z"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ContactEmail": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Rfin-Contact"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API keys are available by emailing sam@bluedoor.sh."
      },
      "RfinApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Rfin-Key"
      }
    },
    "schemas": {
      "ErrorEnvelope": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "ok": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "meta": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "rfin_get_otc_datasetResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "meta": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "provider": {
                "type": "string"
              },
              "route": {
                "type": "string"
              },
              "dataset": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "cache": {
                "type": "string"
              },
              "generated_at": {
                "type": "string"
              },
              "freshness": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "as_of": {
                    "type": "string"
                  },
                  "ttl_seconds": {
                    "type": "integer"
                  },
                  "stale_seconds": {
                    "type": "integer"
                  },
                  "stale": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "as_of",
                  "stale",
                  "stale_seconds",
                  "ttl_seconds"
                ]
              },
              "status": {
                "type": "string"
              },
              "pagination": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "record_total": {
                    "type": "integer"
                  },
                  "record_limit": {
                    "type": "integer"
                  },
                  "record_offset": {
                    "type": "integer"
                  },
                  "record_max_limit": {
                    "type": "integer"
                  },
                  "response_payload_max_size": {
                    "type": "string"
                  }
                },
                "required": [
                  "record_limit",
                  "record_max_limit",
                  "record_offset",
                  "record_total",
                  "response_payload_max_size"
                ]
              }
            },
            "required": [
              "cache",
              "dataset",
              "freshness",
              "generated_at",
              "kind",
              "pagination",
              "provider",
              "route",
              "status"
            ]
          },
          "data": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "meta"
        ]
      },
      "rfin_get_fixed_income_dataset_metadataResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "meta": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "provider": {
                "type": "string"
              },
              "route": {
                "type": "string"
              },
              "dataset": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "cache": {
                "type": "string"
              },
              "generated_at": {
                "type": "string"
              },
              "freshness": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "as_of": {
                    "type": "string"
                  },
                  "ttl_seconds": {
                    "type": "integer"
                  },
                  "stale_seconds": {
                    "type": "integer"
                  },
                  "stale": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "as_of",
                  "stale",
                  "stale_seconds",
                  "ttl_seconds"
                ]
              },
              "status": {
                "type": "string"
              },
              "pagination": {
                "type": "object",
                "additionalProperties": true,
                "properties": {}
              }
            },
            "required": [
              "cache",
              "dataset",
              "freshness",
              "generated_at",
              "kind",
              "pagination",
              "provider",
              "route",
              "status"
            ]
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "datasetGroup": {
                "type": "string"
              },
              "datasetName": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "partitionFields": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "format": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "description",
                    "format",
                    "name",
                    "type"
                  ]
                }
              }
            },
            "required": [
              "datasetGroup",
              "datasetName",
              "description",
              "fields",
              "partitionFields"
            ]
          }
        },
        "required": [
          "data",
          "meta"
        ]
      },
      "rfin_get_otc_dataset_metadataResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "meta": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "provider": {
                "type": "string"
              },
              "route": {
                "type": "string"
              },
              "dataset": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "cache": {
                "type": "string"
              },
              "generated_at": {
                "type": "string"
              },
              "freshness": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "as_of": {
                    "type": "string"
                  },
                  "ttl_seconds": {
                    "type": "integer"
                  },
                  "stale_seconds": {
                    "type": "integer"
                  },
                  "stale": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "as_of",
                  "stale",
                  "stale_seconds",
                  "ttl_seconds"
                ]
              },
              "status": {
                "type": "string"
              },
              "pagination": {
                "type": "object",
                "additionalProperties": true,
                "properties": {}
              }
            },
            "required": [
              "cache",
              "dataset",
              "freshness",
              "generated_at",
              "kind",
              "pagination",
              "provider",
              "route",
              "status"
            ]
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "datasetGroup": {
                "type": "string"
              },
              "datasetName": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "partitionFields": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "format": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "description",
                    "format",
                    "name",
                    "type"
                  ]
                }
              }
            },
            "required": [
              "datasetGroup",
              "datasetName",
              "description",
              "fields",
              "partitionFields"
            ]
          }
        },
        "required": [
          "data",
          "meta"
        ]
      },
      "rfin_get_otc_dataset_partitionsResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "meta": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "provider": {
                "type": "string"
              },
              "route": {
                "type": "string"
              },
              "dataset": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "cache": {
                "type": "string"
              },
              "generated_at": {
                "type": "string"
              },
              "freshness": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "as_of": {
                    "type": "string"
                  },
                  "ttl_seconds": {
                    "type": "integer"
                  },
                  "stale_seconds": {
                    "type": "integer"
                  },
                  "stale": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "as_of",
                  "stale",
                  "stale_seconds",
                  "ttl_seconds"
                ]
              },
              "status": {
                "type": "string"
              },
              "pagination": {
                "type": "object",
                "additionalProperties": true,
                "properties": {}
              }
            },
            "required": [
              "cache",
              "dataset",
              "freshness",
              "generated_at",
              "kind",
              "pagination",
              "provider",
              "route",
              "status"
            ]
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "datasetGroup": {
                "type": "string"
              },
              "datasetName": {
                "type": "string"
              },
              "partitionFields": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "availablePartitions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "partitions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "partitions"
                  ]
                }
              }
            },
            "required": [
              "availablePartitions",
              "datasetGroup",
              "datasetName",
              "partitionFields"
            ]
          }
        },
        "required": [
          "data",
          "meta"
        ]
      },
      "rfin_post_otc_dataset_queryResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "meta": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "provider": {
                "type": "string"
              },
              "route": {
                "type": "string"
              },
              "dataset": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "cache": {
                "type": "string"
              },
              "generated_at": {
                "type": "string"
              },
              "freshness": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "as_of": {
                    "type": "string"
                  },
                  "ttl_seconds": {
                    "type": "integer"
                  },
                  "stale_seconds": {
                    "type": "integer"
                  },
                  "stale": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "as_of",
                  "stale",
                  "stale_seconds",
                  "ttl_seconds"
                ]
              },
              "status": {
                "type": "string"
              },
              "pagination": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "record_total": {
                    "type": "integer"
                  },
                  "record_limit": {
                    "type": "integer"
                  },
                  "record_offset": {
                    "type": "integer"
                  },
                  "record_max_limit": {
                    "type": "integer"
                  },
                  "response_payload_max_size": {
                    "type": "string"
                  }
                },
                "required": [
                  "record_limit",
                  "record_max_limit",
                  "record_offset",
                  "record_total",
                  "response_payload_max_size"
                ]
              }
            },
            "required": [
              "cache",
              "dataset",
              "freshness",
              "generated_at",
              "kind",
              "pagination",
              "provider",
              "route",
              "status"
            ]
          },
          "data": {
            "type": "string"
          }
        },
        "required": [
          "data",
          "meta"
        ]
      }
    }
  },
  "x-generated-at": "2026-06-07T01:30:59.456Z",
  "x-source-api": "rfin",
  "x-source-base-url": "https://api.rfin.bluedoor.sh"
}
