{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tppflow-com/json-schema/tppflow-com-wellbores-response-schema.json",
  "title": "WellboresResponse",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tppflow-com-openapi.json#/components/schemas/WellboresResponse",
  "properties": {
    "count": {
      "type": "integer",
      "title": "Count",
      "description": "Rows in this response"
    },
    "total_matching": {
      "type": "integer",
      "title": "Total Matching",
      "description": "Rows matching the query in the corpus"
    },
    "metadata": {
      "$ref": "#/$defs/ResponseMetadata"
    },
    "query": {
      "additionalProperties": true,
      "type": "object",
      "title": "Query"
    },
    "free_tier": {
      "type": "boolean",
      "title": "Free Tier",
      "description": "True when served without a key"
    },
    "upgrade": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Upgrade",
      "description": "Present on the free tier: how to get the rest"
    },
    "wellbores": {
      "items": {
        "$ref": "#/$defs/Wellbore"
      },
      "type": "array",
      "title": "Wellbores"
    }
  },
  "type": "object",
  "required": [
    "count",
    "total_matching",
    "metadata",
    "query",
    "free_tier",
    "wellbores"
  ],
  "$defs": {
    "ResponseMetadata": {
      "properties": {
        "total_matched": {
          "type": "integer",
          "title": "Total Matched",
          "description": "Wellbores matching this query"
        },
        "corpus_wells": {
          "type": "integer",
          "title": "Corpus Wells",
          "description": "Total wellbores in the corpus"
        },
        "returned": {
          "type": "integer",
          "title": "Returned",
          "description": "Rows in this response"
        },
        "withheld": {
          "type": "integer",
          "title": "Withheld",
          "description": "Matching rows not returned"
        },
        "last_ingested": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Ingested",
          "description": "UTC timestamp of the most recent corpus load"
        },
        "free_tier": {
          "type": "boolean",
          "title": "Free Tier"
        },
        "free_rows_per_request": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Free Rows Per Request"
        },
        "free_queries_per_day": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Free Queries Per Day"
        },
        "queries_used_today": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Queries Used Today"
        }
      },
      "type": "object",
      "required": [
        "total_matched",
        "corpus_wells",
        "returned",
        "withheld",
        "free_tier"
      ],
      "title": "ResponseMetadata"
    },
    "Wellbore": {
      "properties": {
        "api_number": {
          "type": "string",
          "title": "Api Number",
          "description": "Texas API well number, 42-CCC-UUUUU"
        },
        "district": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "District",
          "description": "RRC district"
        },
        "api_county": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Api County",
          "description": "Texas county code"
        },
        "completion_date": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Completion Date",
          "description": "ISO date of original completion (W-2/G-1). NULL when the source value is not a valid calendar date."
        },
        "completion_date_raw": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Completion Date Raw",
          "description": "The source's own CCYYMMDD integer, preserved even when it fails the calendar, so dirt is visible not hidden."
        },
        "total_depth": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Total Depth",
          "description": "Total depth, feet"
        },
        "total_bonded_depth": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Total Bonded Depth"
        },
        "shut_in_month": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Shut In Month",
          "description": "YYYY-MM"
        },
        "plugged": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Plugged",
          "description": "Wellbore has been plugged"
        },
        "subject_to_14b2": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Subject To 14B2",
          "description": "Inactive well operating under a 14(b)(2) extension"
        },
        "pending_removal_14b2": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pending Removal 14B2"
        },
        "orphan_well_hold": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Orphan Well Hold",
          "description": "Flagged in the orphan-well program"
        },
        "fresh_water_protected": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Fresh Water Protected"
        },
        "except_13a_filed": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Except 13A Filed"
        },
        "completion_data_on_file": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Completion Data On File"
        },
        "newest_drilling_permit_nbr": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Newest Drilling Permit Nbr"
        },
        "previous_api_nbr": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Previous Api Nbr"
        }
      },
      "type": "object",
      "required": [
        "api_number"
      ],
      "title": "Wellbore"
    }
  }
}