{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/compabase/main/json-schema/compabase-company-list-response-schema.json",
  "title": "CompanyListResponse",
  "description": "Search/list response. `data` is an array of companies.",
  "x-generated": "2026-10-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/compabase-openapi.yaml#/components/schemas/CompanyListResponse",
  "type": "object",
  "required": [
    "data",
    "pagination"
  ],
  "properties": {
    "data": {
      "type": "array",
      "description": "One page of result rows (same filters as the request); length ≤ `pagination.limit`.",
      "items": {
        "$ref": "#/$defs/CompanyListItem"
      }
    },
    "pagination": {
      "$ref": "#/$defs/CompanyListPagination"
    }
  },
  "$defs": {
    "CompanyListItem": {
      "type": "object",
      "description": "Row from `company_search` (fields depend on query path) plus enrichment: `email`, `website`, `logo_url`,\n`currency`, `period_to`, and normalized `company_name_display`. `full_address` is derived from postal data when present.\n",
      "properties": {
        "entity_id": {
          "type": "string",
          "format": "uuid"
        },
        "company_name": {
          "type": "string"
        },
        "company_name_display": {
          "type": [
            "string",
            "null"
          ]
        },
        "registry_number": {
          "type": [
            "string",
            "null"
          ]
        },
        "nip": {
          "type": [
            "string",
            "null"
          ]
        },
        "regon": {
          "type": [
            "string",
            "null"
          ]
        },
        "legal_form": {
          "type": [
            "string",
            "null"
          ]
        },
        "city": {
          "type": [
            "string",
            "null"
          ]
        },
        "postal_code": {
          "type": [
            "string",
            "null"
          ]
        },
        "county": {
          "type": [
            "string",
            "null"
          ]
        },
        "municipality": {
          "type": [
            "string",
            "null"
          ]
        },
        "region": {
          "type": [
            "string",
            "null"
          ]
        },
        "full_address": {
          "type": [
            "string",
            "null"
          ]
        },
        "primary_pkd": {
          "type": [
            "string",
            "null"
          ]
        },
        "all_pkd_codes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "is_active": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "latest_snapshot_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "revenue_total": {
          "type": [
            "number",
            "null"
          ]
        },
        "revenue_total_usd": {
          "type": [
            "number",
            "null"
          ]
        },
        "revenue_operating": {
          "type": [
            "number",
            "null"
          ]
        },
        "profit_operating": {
          "type": [
            "number",
            "null"
          ]
        },
        "profit_net": {
          "type": [
            "number",
            "null"
          ]
        },
        "profit_net_usd": {
          "type": [
            "number",
            "null"
          ]
        },
        "operating_costs_total": {
          "type": [
            "number",
            "null"
          ]
        },
        "income_tax": {
          "type": [
            "number",
            "null"
          ]
        },
        "cost_wages": {
          "type": [
            "number",
            "null"
          ]
        },
        "cost_amortization": {
          "type": [
            "number",
            "null"
          ]
        },
        "total_assets": {
          "type": [
            "number",
            "null"
          ]
        },
        "capital_total": {
          "type": [
            "number",
            "null"
          ]
        },
        "has_email": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "has_website": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "extracted_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "state_date": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "email": {
          "type": [
            "string",
            "null"
          ]
        },
        "website": {
          "type": [
            "string",
            "null"
          ]
        },
        "logo_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "currency": {
          "type": [
            "string",
            "null"
          ]
        },
        "period_to": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "CompanyListPagination": {
      "type": "object",
      "required": [
        "limit",
        "offset",
        "total",
        "hasMore"
      ],
      "properties": {
        "limit": {
          "type": "integer",
          "description": "Page size (capped at 100 for `GET /companies`; up to 500 for `GET /companies/export`)."
        },
        "offset": {
          "type": "integer"
        },
        "total": {
          "type": "integer",
          "description": "Total rows matching filters. May be `-1` when not computed (e.g. some cursor-based responses)."
        },
        "hasMore": {
          "type": "boolean"
        },
        "cursor": {
          "type": "string",
          "description": "Last `entity_id` from this page; pass as `cursor` query param for the next page when supported."
        }
      }
    }
  }
}