{
  "openapi": "3.0.1",
  "info": {
    "title": "Financial Datasets API",
    "description": "Stock market API with real-time and historical financial data for 27,000+ tickers over 30+ years. Financial statements, equity prices, insider trades, SEC filings, and more.",
    "version": "1.0.0",
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    },
    "contact": {
      "name": "API Support",
      "url": "mailto:support@financialdatasets.ai",
      "email": "support@financialdatasets.ai"
    },
    "termsOfService": "https://financialdatasets.ai/terms-of-use"
  },
  "servers": [
    {
      "url": "https://api.financialdatasets.ai/",
      "description": "Production server"
    }
  ],
  "security": [
    {
      "X-API-KEY": []
    }
  ],
  "tags": [
    {
      "name": "News"
    }
  ],
  "paths": {
    "/news": {
      "get": {
        "tags": [
          "News"
        ],
        "operationId": "getCompanyNews",
        "summary": "Get company news",
        "description": "Get recent news articles for a specific company. Pass the company's ticker as a query parameter.",
        "parameters": [
          {
            "name": "ticker",
            "in": "query",
            "description": "The ticker symbol of the company, e.g. AAPL.",
            "required": true,
            "schema": {
              "type": "string",
              "example": "AAPL"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "The maximum number of news articles to return (default: 5, max: 10).",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 5,
              "maximum": 10
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque pagination cursor from a previous response's next_page_url. When provided, all other query parameters are ignored: the cursor carries the original request's filters. Treat it as opaque; do not construct or modify it.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "News articles response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NewsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredError"
          },
          "404": {
            "$ref": "#/components/responses/NotFoundError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "X-API-KEY": {
        "type": "apiKey",
        "name": "X-API-KEY",
        "description": "API key for authentication.",
        "in": "header"
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "A short error message."
          },
          "message": {
            "type": "string",
            "description": "A more detailed error message."
          }
        }
      },
      "News": {
        "type": "object",
        "properties": {
          "ticker": {
            "type": "string",
            "description": "The ticker symbol."
          },
          "title": {
            "type": "string",
            "description": "The title of the news article."
          },
          "source": {
            "type": "string",
            "description": "The source of the news article."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "The date the news article was published."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The URL of the news article."
          }
        }
      },
      "NewsResponse": {
        "type": "object",
        "properties": {
          "news": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/News"
            }
          },
          "next_page_url": {
            "type": "string",
            "description": "Absolute URL of the next page of results. Present only when more results remain; request it as-is to continue. Each page holds up to 10 records."
          }
        }
      }
    },
    "responses": {
      "BadRequestError": {
        "description": "Bad request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "error": "Bad Request",
              "message": "Invalid request parameters"
            }
          }
        }
      },
      "UnauthorizedError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "error": "Unauthorized",
              "message": "Invalid API key provided"
            }
          }
        }
      },
      "PaymentRequiredError": {
        "description": "The request requires a paid subscription",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "error": "Payment Required",
              "message": "This endpoint requires a paid subscription. Please upgrade your plan."
            }
          }
        }
      },
      "NotFoundError": {
        "description": "The specified resource was not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "error": "Not Found",
              "message": "Ticker XXXX not found"
            }
          }
        }
      }
    }
  }
}