{
  "openapi": "3.1.0",
  "info": {
    "title": "Lempile Funding Events API",
    "version": "1.0.0",
    "description": "Startup funding rounds from news and US SEC Form D filings, one event per company and round, each confirmed from the publisher's own article or the filing, with the company's website when found."
  },
  "servers": [
    {
      "url": "https://api.lempile.com",
      "description": "Lempile production API"
    }
  ],
  "tags": [
    {
      "name": "Funding Events",
      "description": "Startup funding rounds, newest first."
    }
  ],
  "paths": {
    "/companies/funding-events": {
      "get": {
        "operationId": "FundingEvents_list",
        "summary": "List funding events",
        "tags": [
          "Funding Events"
        ],
        "description": "Funding rounds found in a time window, newest `found_at` first, with cursor pagination. Requires `companies.read`.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Events found at or after this time. Default: 7 days ago."
          },
          {
            "name": "until",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Events found before this time."
          },
          {
            "name": "round",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma list of normalized round types, e.g. `seed,series_a`."
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma list of ISO 3166-1 alpha-2 codes, e.g. `US,GB`."
          },
          {
            "name": "has_domain",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Only events with a company website."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "`next_cursor` from the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of funding events.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FundingEventList"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is invalid; `message` names it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The workspace has no active trial or subscription.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The API key lacks `companies.read`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-KEY"
      }
    },
    "schemas": {
      "FundingEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Stable id of the round."
          },
          "object": {
            "type": "string",
            "const": "funding_event"
          },
          "company_name": {
            "type": "string"
          },
          "company_domain": {
            "type": [
              "string",
              "null"
            ],
            "description": "The company's own website, checked by reading its homepage."
          },
          "domain_confidence": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 1
          },
          "financing_type": {
            "type": "string",
            "description": "The round as announced, or \"Form D\" for an SEC filing."
          },
          "financing_type_normalized": {
            "type": "string",
            "enum": [
              "pre_seed",
              "seed",
              "series_a",
              "series_b",
              "series_c",
              "series_d",
              "series_e",
              "series_f",
              "series_g",
              "series_h",
              "growth",
              "debt",
              "grant",
              "other"
            ]
          },
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "The amount as announced."
          },
          "amount_normalized": {
            "type": [
              "integer",
              "null"
            ],
            "description": "US dollars at approximate rates, for filtering."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217."
          },
          "effective_date": {
            "type": "string",
            "format": "date"
          },
          "found_at": {
            "type": "string",
            "format": "date-time",
            "description": "When Lempile first saw the round."
          },
          "investors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2 of the company's headquarters."
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "source_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "The publishers' articles or the SEC filing."
          },
          "confirmed": {
            "type": "boolean",
            "description": "Confirmed from the publisher's own article or the filing. Always true for customer keys."
          },
          "company": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "domain": {
                "type": "string"
              },
              "linkedin_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "industry": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "employee_count": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "country": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "required": [
          "id",
          "object",
          "company_name",
          "financing_type",
          "financing_type_normalized",
          "effective_date",
          "found_at",
          "investors",
          "categories",
          "source_urls",
          "confirmed"
        ]
      },
      "FundingEventList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FundingEvent"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "error",
          "message"
        ]
      }
    }
  }
}
