Complete reference for integrating upstream cost data and SEC financials into your applications. RESTful endpoints with JSON responses and comprehensive filtering.
๐ Get API TokenConnect Claude Desktop, Cursor, Claude Code, or Codex directly to AFE Leaks data. Ask questions naturally and your AI calls our 34 database tools across well-level operations, costs, production, and SEC financials.
Setup Guide
v2 OData exposes the full ~3 million well universe (vs. v1's ~100K cost-data wells) plus permits, completions, frac-focus, and treatment summaries.
API-tier only, lowercase snake_case contract, and cross-database enrichment via state / operator_clean filters.
Permanent API keys for integrations, scripts, and external tools. No expiration or refresh needed.
X-API-Key: afe_your_api_key_here
Get your key: Login to API Portal
Session-based tokens for web applications. Tokens expire and require refresh.
Authorization: Bearer <firebase_token>
Get token: Via Firebase Auth in web applications
Login to get your personal API access token for authentication.
Get API Token โhttps://api.afeleaks.com
All API endpoints are relative to this base URL.
Access well costs, production data, and completion details from 100,000+ wells
Well-level cost summaries
/api/cost-data
Returns summarized cost data by well (API-level)
/api/cost-breakdown
Returns line-item level cost details
Well information and details
/api/wells
General well metadata with dynamic column selection
/api/locations
Well-path or location data (WKT format)
Production and revenue data
/api/production
Production records by well and date
/api/product
Product revenue data with well information
Completion and geology data
/api/casing
Casing design records
/api/formations
Formation tops and geology records
/api/surveys
Directional survey records
/api/welltests
Flow/pressure test data
/api/well-eur-parameters
Per-stream decline-curve fits and EUR estimates (oil/gas/water per well)
Vendor costs and regulatory files
/api/vendor-costs
Vendor cost data with well information
/api/files
Regulatory file links and documents
limit
Max records (default: 100, max: 10,000)
offset
Skip N records for pagination
API
API well number
operator
Operator name
state
State
county
County
reservoir
Reservoir/formation
lease
Lease name
leaseNum
Lease number
wellNum
Well number
district
Regulatory district
spudDateMin
Min spud date (YYYY-MM-DD)
spudDateMax
Max spud date (YYYY-MM-DD)
updateDateMin
Min update date (YYYY-MM-DD)
updateDateMax
Max update date (YYYY-MM-DD)
Detailed descriptions of all columns returned by upstream data endpoints
Note: The /api/wells endpoint supports dynamic column selection using the columns parameter.
You can specify which columns to return (e.g., ?columns=API,operator,state,spudDate) from any of the columns listed below.
API โ 10- or 12-digit API well number (unique well identifier)api12 โ 12-digit API number (alternate format)api14 โ 14-digit API number (alternate format)lease โ Lease nameleaseNum โ Lease numberwellNum โ Well numberdistrict โ Regulatory districtcounty โ County nameoilGas โ Well type (oil/gas/both)field โ Field namefieldNum โ Field numberspudDate โ Date well was spudded (drilling started)lastSpud โ Date of last spud (if re-entered)operator โ Operator name (current or at time of record)operator_clean โ Cleaned operator name (standardized)compDate โ Completion datefirst_production โ Date of first productionlast_production โ Date of last productionreservoir โ Cleaned/standardized reservoir namelateral โ Lateral length (ft)tvd โ True vertical depth (ft)md โ Measured depth (ft)perf_top โ Top of perforated interval (ft)perf_bottom โ Bottom of perforated interval (ft)perf_interval โ Perforated interval length (ft)depth โ Total depth (ft)fluid โ Total fluid used (gallons)proppant โ Total proppant used (lbs)prop_per_ft โ Proppant per foot (lbs/ft)location โ Well location (legal description or lat/lon)state โ Stateplug_date โ Plugging datecasing_design โ Casing design descriptionupdate_date โ Date of last updateTaxpayerNumber โ Primary taxpayer numberTaxpayerName โ Primary taxpayer nameTaxSubType โ Tax subtype (if applicable)date โ Production/revenue dateleaseNum โ Lease numberdistrict โ Regulatory districtSecondaryTaxpayerNumber โ Secondary taxpayer numberSecondaryTaxpayerName โ Secondary taxpayer nameAPIGravity โ API gravity (oil quality measure)volume โ Product volume (e.g., barrels, mcf, etc.)value โ Product value (USD)marketing โ Marketing adjustment or revenueproduct โ Product type (oil, gas, NGL, etc.)leaseOil โ Lease oil production (bbl)leaseGas โ Lease gas production (mcf)update_date โ Date of last updateAPI โ API well numbertype โ AFE/Actualcapex โ Total capital expenditure (USD)component โ Cost component (e.g., drilling, completion)update_date โ Date of last updateoperator โ Operator name (cleaned)state โ Statecounty โ Countyreservoir โ Reservoir namelease โ Lease namewellNum โ Well numberspudDate โ Spud datefp_year โ First production yearperf_interval โ Perforated interval (ft)tvd โ True vertical depth (ft)afedate โ AFE dateAPI โ API well numbercost_type โ AFE/Actualtype โ Cost type (e.g., material, service)component โ Cost component (e.g., casing, cement)code โ Cost code or identifiercategory โ Cost category (e.g., drilling, completion)value โ Cost value (USD)operator โ Operator name (cleaned)state โ Statecounty โ Countyreservoir โ Reservoir namelease โ Lease namewellNum โ Well numberspudDate โ Spud datefp_year โ First production yearperf_interval โ Perforated interval (ft)tvd โ True vertical depth (ft)afedate โ AFE dateAPI โ API well numbertype โ Casing string type (e.g., surface, production)segment โ Casing segment/intervalhole_size โ Hole size (inches)hole_depth โ Hole depth (ft)size โ Casing size (inches)weight โ Casing weight (lbs/ft)grade โ Casing gradeupdate_date โ Date of last updateOne row per well per stream (oil/gas/water). ~600K rows across ~200K wells. Each row carries the Arps multi-segment parameters used to forecast the stream, the actual + forecast cum, and the total EUR. method_category distinguishes direct decline fits from correlation-based estimates for wells with too little history.
state โ State (key)API โ API well number (key)stream โ oil / gas / water (key)eur_method โ Method used (e.g., decline_curve, correlation)method_category โ calculated_eur or correlated_eurfit_status โ fit / failed / etc.county โ County (indexed with state + reservoir)reservoir โ Reservoir namespud_date โ Spud datefirst_production โ First production datelast_production โ Last production datefit_start_date โ Date the fit window beginsfit_start_mop โ Month-of-production at fit startfit_start_reason โ Why fit starts there (e.g., peak)peak_date, peak_mop โ Peak production date / monthmonths_fit โ Number of months in the fit windowactual_months, forecast_months โ Historical vs forecast horizonqi_monthly, qi_daily โ Initial rate (per fit start)di_annual โ Initial annual decline (nominal)b_factor โ Arps b-exponentdmin_annual โ Terminal decline (exponential tail)b_min, b_max โ Bounds applied during fitwell_life_years โ Forecast horizonactual_cum โ Cumulative produced to last_productionforecast_cum โ Remaining forecast cumulativeeur โ Estimated Ultimate Recovery (actual + forecast)last_actual_monthly, fit_last_monthly โ Last actual and last fit monthlycorrelation_scope โ Peer group used for correlated EURscorrelation_multiplier โ Applied scaling factortraining_well_count โ Peer well count (correlated fits)run_date โ Date the fit was generatedAPI โ API well numberdate โ Production dateoil โ Oil produced (barrels)gas โ Gas produced (MCF)water โ Water produced (barrels)update_date โ Date of last updateAPI โ API well numbergeometry_wkt โ Well geometry/location (WKT format)update_date โ Date of last updateAPI โ API well numberMD โ Measured depth (ft)TVD โ True vertical depth (ft)Inclination โ Inclination (degrees)Azimuth โ Azimuth (degrees)DogLegSeverity โ Dog leg severityN โ North coordinateE โ East coordinateVS โ Vertical sectionupdate_date โ Date of last updateAPI โ API well numberdateTst โ Test dateoilD โ Oil rate (barrels/day)gasD โ Gas rate (MCF/day)waterD โ Water rate (barrels/day)chokeSize โ Choke sizetubingPressure โ Tubing pressure (psi)casingPressure โ Casing pressure (psi)testType โ Test typetestHours โ Test duration (hours)reservoir โ Reservoir testedupdate_date โ Date of last updateAPI โ API well numberreservoir โ Formation/reservoir nametvd โ Top TVD (ft)md โ Top MD (ft)update_date โ Date of last updateAPI โ API well numberForm โ File/form typeurl โ File download URLupdate_date โ Date of last updateAPI โ API well numberdate โ Cost datevendor โ Vendor namecode โ Vendor cost codetype โ Cost typedescription โ Cost descriptionnote โ Additional notescost โ Cost amount (USD)link โ Reference linkcost_type โ AFE/Actualrig โ Rig informationphase โ Project phaseAccess SEC XBRL financial data from 10-K and 10-Q filings with comprehensive filtering
Filing metadata
/api/financials/sub
Company submission metadata (filing information)
Display information
/api/financials/pre
Presentation/display info for financial statement elements
Financial values
/api/financials/num
Numeric financial data values from SEC filings
Narrative content
/api/financials/text
Text/narrative financial data
/api/financials/textbig
Large text content (MD&A, footnotes) in chunks
Normalized metrics across companies
/api/financials/standardization
Standardized revenue, EBITDA, cash flow, and other metrics by company and period.
Filters: cik, ticker, name, enddate, metric_name, table, category, sub_category
Proved reserves & reconciliation
/api/financials/reserves
Proved reserves and standardized reserve reconciliation by company and year.
Filters: cik, ticker, name, ownership_view, category, sub_category, metric_name
Volumes, prices & unit costs
/api/financials/operational-metrics
Quarterly production volumes, commodity prices, and per-unit costs by company and segment.
Filters: cik, ticker, name, ownership_view, segment, category, sub_category, metric_name
Acreage & well counts
/api/financials/property-metrics
Acreage, well counts, and property-level metrics by company and year.
Filters: cik, ticker, name, ownership_view, segment, category, sub_category, metric_name
Forward-looking targets
/api/financials/guidance-metrics
Capex guidance, production targets, and other forward-looking metrics by company and target period.
Filters: cik, ticker, name, category, sub_category, basin, target_period, metric_name
Ratings & leverage
/api/financials/credit-metrics
Credit ratings, leverage ratios, and credit-related metrics by company and period.
Filters: cik, ticker, name, category, sub_category, metric_name
13F holdings (row-level)
/api/financials/institutional-holdings
One row per (manager ร issuer ร quarter) from 13F filings, restricted to our energy-coverage universe. Strict and best-effort dollar values, share counts, and confidence flags.
Filters: ticker, cik, issuer_name, manager_name, filer_cik, period_end, period_from, period_to, put_call, include_low_confidence
13F filer profiles
/api/financials/institutional-managers
Per-quarter snapshot of each 13F filer in our coverage universe: specialist score, oil/gas weighted exposure, top-N concentration, position turnover, and confidence flags.
Filters: filer_cik, manager_name, period_end, period_from, period_to, min_specialist_score
Per-issuer ownership snapshot
/api/financials/institutional-summary
Per-quarter ownership snapshot for each covered issuer: holder count, new/exited counts, top-holder share, HHI concentration, and total reported / strict / normalized value.
Filters: ticker, cik, issuer_name, period_end, period_from, period_to
cik โ Central Index Key (company identifier)name โ Company nameadsh โ Accession number (filing identifier)sic โ Standard Industrial Classificationfye โ Fiscal year end (MMDD)form โ SEC form type (10-K, 10-Q, etc.)period โ Reporting period end datefiled โ Filing dateaccepted โ SEC acceptance dateprevrpt โ Previous report indicatordetail โ Detail levelinstance โ XBRL instance documentadsh โ Accession numbertag โ XBRL tag nameversion โ Taxonomy versionplabel โ Presentation labelnegating โ Negating multiplierstmt โ Statement type (BS, IS, CF, EQ)inpth โ Presentation pathrfile โ R file referencerorder โ Report ordertbl โ Table identifieradsh โ Accession numbertag โ XBRL tag nameversion โ Taxonomy versionenddate โ Period end dateqtrs โ Number of quartersuom โ Unit of measurevalue โ Numeric valuefootnote โ Footnote referencefiled โ Filing dateaxis โ Dimensional axissegment โ Dimensional segmentadsh โ Accession numbertag โ XBRL tag nameversion โ Taxonomy versionenddate โ Period end dateqtrs โ Number of quartersvalue โ Text valuefootnote โ Footnote referencefiled โ Filing dateaxis โ Dimensional axissegment โ Dimensional segmentadsh โ Accession numbertag โ XBRL tag nameversion โ Taxonomy versionenddate โ Period end dateqtrs โ Number of quarterschunk_order โ Chunk sequence numbervalue โ Large text chunkfootnote โ Footnote referencefiled โ Filing dateaxis โ Dimensional axissegment โ Dimensional segment
All upstream data endpoints support OData v4 protocol, enabling direct integration with Excel, Power BI, Tableau, and other business intelligence tools.
Query data using standard OData operators like $filter, $select, $orderby, $top, and $skip.
https://api.afeleaks.com/api/odata/
OData endpoints use HTTP Basic Authentication. Use apikey as the username and your API key as the password.
Excel / Power Query: When prompted for credentials, select "Basic" authentication, enter apikey as username, and paste your API key as the password.
| Endpoint | Description |
|---|---|
| Upstream Data (Wells with Cost Data) | |
/api/odata/Wells |
Well metadata (API, operator, county, state, reservoir, depths, etc.) |
/api/odata/CostData |
Summarized well cost data (AFE and Actual totals) |
/api/odata/CostBreakdown |
Detailed line-item cost breakdowns |
/api/odata/Production |
Monthly production data (oil, gas, water volumes) |
/api/odata/Casing |
Casing string details and specifications |
/api/odata/Locations |
Well location coordinates |
/api/odata/Surveys |
Directional survey data |
/api/odata/WellTests |
Well test results and measurements |
/api/odata/Formations |
Formation tops and geological data |
/api/odata/Files |
Available document files for wells |
| Product Revenues & Vendor Costs | |
/api/odata/Product |
Product revenues by lease (oil, gas, NGL sales and GPT costs) |
/api/odata/VendorCosts |
Vendor cost data with breakdown by phase, type, and vendor |
/api/odata/WellEurParameters |
Per-stream decline-curve fits and EUR estimates (oil/gas/water rows per well). Includes Arps parameters, actual + forecast cum, and total EUR. |
| SEC Financial Data (XBRL) | |
/api/odata/FinancialsSub |
SEC filing submissions metadata |
/api/odata/FinancialsNum |
Raw XBRL numeric values from filings |
/api/odata/FinancialsPre |
Presentation linkbase (statement line items) |
/api/odata/FinancialsText |
Text/footnote data from filings |
/api/odata/FinancialsTextBig |
Large text blocks (chunked for performance) |
/api/odata/FinancialsStandardized |
Standardized financial metrics (revenue, EBITDA, etc.) |
/api/odata/Reserves |
Proved reserves and standardized reserve reconciliation by company/year |
/api/odata/OperationalMetrics |
Quarterly operational metrics (volumes, prices, unit costs) by company/segment |
/api/odata/PropertyMetrics |
Acreage, well counts, and property-level metrics by company/year |
/api/odata/GuidanceMetrics |
Forward-looking guidance (capex, production targets) by company/period |
/api/odata/CreditMetrics |
Credit ratings, leverage ratios, and credit-related metrics |
/api/odata/Hedges |
Commodity hedge details โ swaps, collars, floors, ceilings by company, commodity, benchmark, and period |
| 13F Institutional Ownership | |
/api/odata/InstitutionalHoldings |
Row-level 13F holdings โ one row per (manager ร issuer ร quarter) with strict and best-effort dollar values, share counts, and confidence flags |
/api/odata/InstitutionalManagers |
Per-quarter snapshot of each 13F filer in our energy-coverage universe: specialist score, oil/gas weighted exposure, top-N concentration, position turnover |
/api/odata/InstitutionalSummary |
Per-issuer ownership snapshot: holder count, top-holder share, HHI concentration, and total reported / strict / normalized value |
Filter wells by state:
/api/odata/Wells?$filter=state eq 'TX'
Filter by operator and select specific columns:
/api/odata/Wells?$filter=operator_clean eq 'DIAMONDBACK'&$select=API,wellName,county,reservoir
Get production with pagination:
/api/odata/Production?$top=1000&$skip=0&$orderby=prod_date desc
Filter by multiple conditions:
/api/odata/Wells?$filter=state eq 'TX' and county eq 'REEVES' and perf_interval gt 5000
https://api.afeleaks.com/api/odata/Wellsapikey as the username
Tip: For large datasets, use $filter to narrow down results before loading (e.g., filter by state or operator).
A second OData v4 namespace for the full ~3M-well universe and federal/state regulatory data. Cost endpoints stay on v1.
v2 adds four entity families that v1 doesn't cover: permit data, completion / frac-focus / treatment summaries, the full well_header universe (not just wells with cost data), and raw lease-level production from RRC. Existing v1 endpoints are untouched โ you can keep using them. Choose v2 when you need scale (~3M wells vs. ~100K) or surface area (permits / completions) that v1 doesn't have.
https://api.afeleaks.com/api/odata/v2/
Public introspection: /$metadata (EDMX schema), / (service document), /_health (connectivity check). All other endpoints require auth.
v2 is API-tier only. Pass X-API-Key: <your_key> or HTTP Basic Auth (any username, password = your API key). Requests with no auth at all return 401 Unauthorized; Firebase session cookies (basic / premium tiers) authenticate but get a 403 Forbidden from the v2 tier gate โ v2 does not unlock for non-API tiers. Use v1 (/api/odata/*) for browser-session access, or contact sales for an API key.
Every v2 entity returns column names in lowercase snake_case for a uniform contract โ including domain abbreviations:
api_number (not "API")md, tvd, ns, ew, vs, dls, inclination, azimuth on Surveysngl on ProductionTables under v1 still use the legacy mixed casing ("API", "NGL", etc.). If you mix v1 and v2 in the same Power Query, expect to rename columns.
Migrating from v1? Filter field names changed too.
A v1 $filter clause pasted into v2 will return 400 BadRequest because the field names changed alongside the response columns. API is not a recognized v2 filter field โ use api_number. Same goes for any other column the v1 contract spelled in CAPS or PascalCase.
v1 (still valid on v1)
/api/odata/Wells
?$filter=API eq '4234567890'v2
/api/odata/v2/Wells
?$filter=api_number eq '4234567890'Same pattern for $orderby and $select: lowercase the field names. v2 returns 200 with an empty array (not 404) when a filter matches no rows, so an empty result on a known-good query usually means the API number isn't in the dataset, not that the request was malformed.
v2 entities backed by very large tables enforce a minimum filter to prevent full-table scans. A request without one returns 400 BadRequest with the list of acceptable filters.
| Entity | Required (any one of) |
|---|---|
/v2/Wells | state ยท api_number ยท operator_clean |
/v2/Permits | state ยท api_number |
/v2/Production & rich tables | api_number (or any enrich filter) |
/v2/ProductionRaw | state + district + lease_no (composite) |
| summary entities | no required filter (small datasets) |
The rich entities (Production, Casing, Surveys, Formations, FileLinks, Locs) accept well-metadata filters โ state, county, operator_clean, reservoir, operator_cleanStartsWith โ even though those columns don't physically exist on the entity. v2 transparently runs a 2-stage query: it first hydrates the matching api_number list from the well universe, then fetches the rows you asked for.
This lets you ask "all surveys for EOG operators in Texas" in one call, instead of composing /v2/Wells โ collect APIs โ /v2/Surveys?api_number=โฆ.
Cap: 25,000 wells per request. If your enrich filter matches more wells than that, v2 returns 400 EnrichTooBroad. Narrow the filter (add county or reservoir, prefer operator_clean over state alone) or page via api_number directly.
| Endpoint | Description |
|---|---|
| Wells & Permits (full universe) | |
/api/odata/v2/Wells | Well header โ ~3M rows. api_number, state/county/lease, operator (raw + cleaned), reservoir, spud / completion / first-prod / last-prod / shut-in / plug dates, mineral owner type. Requires state, api_number, or operator_clean. |
/api/odata/v2/Permits | Drilling permits with full lifecycle dates (issue / amended / extended / expired / cancelled / spud), application type, directional/horizontal/sidetrack flags. Requires state or api_number. |
/api/odata/v2/CompletionSummary | Per-well completion summary โ fluid / proppant volumes, treatment + proppant + fluid type, stage and filings count, has_fracfocus flag. |
/api/odata/v2/FracFocusSummary | FracFocus-derived completion data โ fluid + proppant + recomplete volumes, job and recomplete dates. |
/api/odata/v2/TreatmentSummary | State-data-derived treatment volumes (proppant / fluid / stages) where reported by the operator. |
/api/odata/v2/TypeCurveCounty | P50 normalized oil/gas type curves at the county ร month-of-production grain. Use for benchmarking. |
| Production | |
/api/odata/v2/Production | Allocated monthly production (oil / gas / water / ngl) per api_number. Requires api_number or any enrich filter. |
/api/odata/v2/ProductionRaw | Lease-level RRC production (oil / gas / cond / casinghead, vent-flare, ending balances). ~143M rows. Requires state + district + lease_no or just state. |
| Wellbore detail (require api_number or enrich filter) | |
/api/odata/v2/Casing | Casing string + cement detail โ type, segment, hole size/depth, weight, grade, top/depth, cement class, TOC/BOC, packer, set date, test pressure. |
/api/odata/v2/Surveys | Directional surveys โ md / tvd / inclination / azimuth / ns / ew / vs / dls + source file URL. |
/api/odata/v2/Formations | Formation tops โ reservoir, tvd, md per well. |
/api/odata/v2/FileLinks | Available document links (form type + URL) for each well. |
/api/odata/v2/Locs | Surface and bottomhole coordinates, lateral length, full WKT geometry. |
| Reserves & forecasts | |
/api/odata/v2/WellEurParameters | Per-stream decline-curve fits (oil / gas / water rows per api_number) โ Arps parameters (qi, di, b, dmin, b_min/b_max), fit window, actual + forecast cum, total EUR, and run_date. Requires state or api_number. |
All wells in Texas Eagle Ford (5K rows max):
/api/odata/v2/Wells?$filter=state eq 'TX' and reservoir eq 'EAGLE FORD'&$top=5000
Operator-prefix lookup (uses text_pattern_ops index):
/api/odata/v2/Wells?$filter=state eq 'TX' and startswith(operator_clean, 'EOG')
All surveys for EOG wells in Texas (cross-DB enrichment):
/api/odata/v2/Surveys?$filter=state eq 'TX' and operator_clean eq 'EOG RESOURCES'
No api_number needed โ v2 hydrates the api list from well_header and joins to Surveys in one call. 25K wells max per request.
Recent permits in Texas:
/api/odata/v2/Permits?$filter=state eq 'TX' and permit_date ge 2025-01-01&$orderby=permit_date desc
Lease-level raw production (composite filter):
/api/odata/v2/ProductionRaw?$filter=state eq 'TX' and district eq '08' and lease_no eq '273604'
Get total well count with $count:
/api/odata/v2/Wells?$filter=state eq 'TX'&$top=0&$count=true
Per-table $count is cached for 10 minutes; first call ~700ms, repeats are free.
| Status | Code | When |
|---|---|---|
| 400 | BadRequest | Required filter missing (e.g. /v2/Wells without state / api_number / operator_clean). |
| 400 | EnrichTooBroad | Cross-DB enrichment matched > 25K wells. Narrow your filter. |
| 401 | Unauthorized | No auth presented. Add X-API-Key header or HTTP Basic Auth (password = your API key). |
| 403 | Forbidden | Authenticated but tier is too low (Firebase basic / premium session). v2 requires API-tier access โ use X-API-Key with an API-tier key. |
| 429 | RateLimited | v2 rate limit is 25,000 req/min (half of v1). The cap is per-API-key. |
Pre-generated .csv.gz
snapshots of every upstream and XBRL table, served directly from Google Cloud Storage via
short-lived signed URLs. Use these when you need a full copy of a table for offline analysis,
ETL into a warehouse, or any workflow where paginating through the REST API would be slow
or expensive.
Plan requirement: Bulk downloads are available only on the
API Enterprise tiers
(enterprise_s,
enterprise_m,
enterprise_l)
and grandfathered
legacy unlimited API (legacy_api_unlimited)
plans. Starter, Professional, and Corporate plans should use the paginated REST /
OData endpoints instead.
.csv.gz and uploads it to
gs://afe-leaks-5cc64.appspot.com/bulk-downloads/latest/.
Dated archive copies are retained for 30 days.GET /api/bulk-download to
discover the table list, file sizes, and the timestamp of the most recent generation.GET /api/bulk-download/<table> with
your bearer token or API key. The server verifies your plan and returns a 15-minute
signed URL./api/bulk-download
ยท Public ยท No auth required
Returns the manifest of all available tables with size, description, and generation timestamp. No authentication needed โ useful for automated catalog discovery.
curl https://api.afeleaks.com/api/bulk-download
/api/bulk-download/:table
ยท Auth required ยท Enterprise / legacy only
Returns a signed download URL for the named table. The url is valid for
15 minutes; the bytes field tells you what to expect before you start
the transfer.
# 1. Resolve the signed URL
curl -H "X-API-Key: afe_your_key" \
https://api.afeleaks.com/api/bulk-download/cost-data
# Response:
# {
# "key": "cost-data",
# "label": "Cost Data",
# "bytes": 48234112,
# "generated_at": "2026-04-14T07:00:00.000Z",
# "url": "https://storage.googleapis.com/...",
# "expires_at": "2026-04-14T12:15:00.000Z",
# "content_encoding": "gzip",
# "content_type": "text/csv"
# }
# 2. Follow the signed URL to download
curl -L -o cost-data.csv.gz "<url from step 1>"
# 3. Decompress
gunzip cost-data.csv.gz
The signed URL already sets Content-Disposition: attachment, so web browsers
save the file directly. Requests with an unsupported plan return
HTTP 403 with a current_plan and
required_plan_codes payload explaining what to upgrade to.
The manifest is the authoritative list โ sizes and row counts update nightly. At a glance:
wells โ well metadatacost-data โ aggregated AFE/Actual costscost-breakdown โ line-item breakdownsproduction โ monthly volumescasing, locations, surveyswelltests, formations, filesproduct โ product revenuesvendor-costs โ vendor breakdownsfinancials-sub โ filing submissionsfinancials-num โ numeric factsfinancials-standardized โ standardized metricsfinancials-pre โ presentation linkbasefinancials-text, financials-textbigreserves โ proved + standardized reservesoperational-metrics โ quarterly volumes / prices / unit costsproperty-metrics โ acreage, well counts, property-level metricsguidance-metrics โ forward-looking capex/production guidancecredit-metrics โ credit ratings, leverage ratios
All upstream tables are restricted to wells with cost data (same policy as the REST and
OData endpoints). All XBRL tables include every ticker present in
xbrl.standardized.
Tip: The UI client pages (Upstream Client, Financial Client) have a one-click "Download" button for each table if you prefer browser-based access.
v1 bulk downloads (above) are restricted to ~100K wells with cost data. v2 bulk downloads cover the full ~770K-well universe, mirroring the OData v2 data model. Same Enterprise / legacy-API-unlimited plan gate.
production-raw CSVs per state (lease-level RRC). Texas is split into 13 per-RRC-district files because it's 77M rows on its own.permits, which regenerates nightly. State zips are rebuilt on every run so they're never more than a day stale./api/bulk-download/v2
ยท Public ยท No auth required
v2 manifest. Lists per-state zip bundles and standalone CSV entries with byte sizes and generation timestamps.
/api/bulk-download/v2/zip/:state
ยท Auth required ยท Enterprise / legacy only
Signed URL for a per-state zip bundle. :state is the 2-letter code (TX, NM, OK, ND, CO, WY, UT, MT, KS, LA, WV).
/api/bulk-download/v2/table/:key
ยท Auth required ยท Enterprise / legacy only
Signed URL for one v2 catalog entry. :key matches manifest entries (e.g. v2-tx-production-raw-d08, v2-nm-wells).
# 1. Discover available bundles
curl https://api.afeleaks.com/api/bulk-download/v2
# 2. Get a signed URL for the Texas state zip
curl -H "X-API-Key: afe_your_key" \
https://api.afeleaks.com/api/bulk-download/v2/zip/TX
# 3. Pull one per-district production-raw file (TX D8 = Midland Permian)
curl -H "X-API-Key: afe_your_key" \
https://api.afeleaks.com/api/bulk-download/v2/table/v2-tx-production-raw-d08
The Upstream Client UI page surfaces the full v2 catalog with a per-state download button โ the same flow as v1. Pick whichever is easier for your workflow.
curl -H "X-API-Key: afe_your_key" \
"https://api.afeleaks.com/api/cost-data?state=TX&limit=100"
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://api.afeleaks.com/api/cost-data?state=TX&limit=100"
curl -H "X-API-Key: afe_your_key" \
"https://api.afeleaks.com/api/production?limit=1000&offset=5000"
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://api.afeleaks.com/api/production?limit=1000&offset=5000"
curl -H "X-API-Key: afe_your_key" \
"https://api.afeleaks.com/api/financials/num?cik=0000078003&form=10-K"
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://api.afeleaks.com/api/financials/num?cik=0000078003&form=10-K"
library(httr)
library(jsonlite)
# Using permanent API key
api_key <- "afe_your_generated_key_here"
resp <- GET(
url = "https://api.afeleaks.com/api/wells",
query = list(limit = 10, state = "TX"),
add_headers(`X-API-Key` = api_key)
)
if (status_code(resp) == 200) {
data <- content(resp, "parsed")
wells_df <- data$data
} else {
print(paste("Error:", status_code(resp)))
}
import requests
import pandas as pd
# Using permanent API key
api_key = "afe_your_generated_key_here"
headers = {"X-API-Key": api_key}
response = requests.get(
"https://api.afeleaks.com/api/wells",
params={"limit": 10, "state": "TX"},
headers=headers
)
if response.status_code == 200:
data = response.json()
wells_df = pd.DataFrame(data["data"])
else:
print(f"Error: {response.status_code}")
// Using permanent API key
const apiKey = "afe_your_generated_key_here";
fetch('https://api.afeleaks.com/api/wells?limit=10&state=TX', {
headers: {
'X-API-Key': apiKey
}
})
.then(response => response.json())
.then(data => {
console.log(`Retrieved ${data.data.length} wells`);
console.log('Wells:', data.data);
})
.catch(error => console.error('Error:', error));
// Power Query M code
let
apiKey = "afe_your_generated_key_here",
url = "https://api.afeleaks.com/api/wells?limit=1000",
headers = [#"X-API-Key" = apiKey],
response = Web.Contents(url, [Headers = headers]),
json = Json.Document(response),
data = json[data],
table = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
table
Corporate and API subscribers can connect AI tools directly to AFE Leaks data using the Model Context Protocol (MCP). Once connected, just ask questions naturally โ your AI calls our database tools automatically.
Two hosted transports: /sse for Claude Desktop, Cursor, and Claude Code; /mcp (Streamable HTTP) preferred for Codex. Works with any MCP-compatible client.
Drop this markdown file into Claude.ai Projects, Claude Code (~/.claude/skills/afeleaks/SKILL.md), Cursor (.cursor/rules/), or Codex (AGENTS.md) to teach your AI client our tool families, operator aliases, basin synonyms, coverage caveats, and workflow recipes โ so it picks the right tool faster and wastes fewer credits exploring.
{
"mcpServers": {
"afeleaks": {
"url": "https://mcp.afeleaks.com/sse?api_key=YOUR_API_KEY"
}
}
}
claude mcp add afeleaks --transport sse "https://mcp.afeleaks.com/sse?api_key=YOUR_API_KEY"
Codex prefers the Streamable HTTP endpoint at /mcp. Pass the API key as a bearer token through an environment variable so it never appears in shell history or request URLs.
export AFELEAKS_API_KEY="afe_..."
codex mcp add afeleaks \
--url "https://mcp.afeleaks.com/mcp" \
--bearer-token-env-var AFELEAKS_API_KEY
Restart Codex after running codex mcp add so it picks up the new server and loads the tool list.
API key missing. /mcp returned 401 because no ?api_key=... query param or Authorization: Bearer ... header was sent. For Codex, confirm the env var referenced by --bearer-token-env-var is exported in the shell that launched Codex.
Invalid key or insufficient access. The key is rejected, or the account does not have Corporate/API MCP access. Verify the key in Account Settings and confirm the subscription tier.
No tools showing up. Restart Codex after codex mcp add โ the tool list is loaded on launch, not refreshed live.
Server status. Hit https://mcp.afeleaks.com/health โ a healthy response lists both sse and streamable-http transports.
The agent picks tools automatically โ you don't call them directly. Every response carries a _usage envelope (see Credits & Usage below).
search_operators
Fuzzy operator-name resolution with cost-data coverage counts
search_wells
Find API numbers by prefix, lease, or operator (full well universe)
lookup_well
Single-well detail: metadata + costs + production in one call
query_dataverse_wells
Broad well discovery across the full ~3M Dataverse well universe
query_dataverse_permits
Permit lifecycle, depths, horizontal/directional flags, applications
query_well_locations
Lat/lng and WKT geometry for mapping wellbore paths
get_basin_info
Basin โ county/state crosswalk for geographic filtering
query_well_costs
Aggregated AFE vs Actual stats (avg and median in one call) with group_by
query_cost_details
Line-item breakdowns (drilling, completion, casing, stimulation, cement, โฆ)
query_vendor_costs
Vendor-level cost detail (who got paid for what)
compare_costs
Side-by-side comparisons across operators, basins, years, reservoirs
query_production
Oil / gas / water by well โ cumulative, monthly avg, or peak
query_well_eur
Estimated ultimate recovery by well or filter set
build_type_curve
Synthesize a normalized type curve from a well selection
query_well_tests
IP / well-test results (initial rates, choke, pressure)
query_completion_metrics
Fluid volume, proppant mass, stages โ summarized across FracFocus + frac summaries
query_completion_raw
Raw completion filings: perf interval, TVD/MD, frac company, choke, text
query_formations
Formation tops and reservoir depths
query_casing
Casing program detail (string, OD, depths, cement)
query_surveys
Directional survey data (inclination, azimuth, MD/TVD)
query_financials
Income, balance sheet, cash flow by ticker
list_financial_metrics
Discover the catalog of standardized metric names
query_financial_reserves
Proved reserves disclosures (PUD, PDP, by category)
query_operational_metrics
Standardized production volumes, realized prices, unit costs
query_property_metrics
Acreage, drilled inventory, property-level disclosures
query_guidance_metrics
Forward-looking company guidance by basin and target period
query_credit_metrics
Debt, revolver, notes, covenants, ratings, liquidity (latest snapshot)
query_hedges
Hedge book โ tranche-level swaps, collars, puts with price + volume
query_cost_disclosures
Well-cost disclosures pulled from SEC filings
query_executive_comp_incentives
Executive compensation and incentive plan structure
search_xbrl_companies
Find companies in the SEC universe (~146 covered)
query_xbrl_raw
Raw XBRL query against any SEC filing โ escape hatch for custom facts
query_vault_knowledge
Query the AFE Leaks research vault (notes, write-ups, analyses)
create_corporate_profile
Auto-synthesize a full corporate profile (multi-tool chained query)
Plus get_mcp_credit_balance โ a free utility tool that returns your remaining credit balance without consuming any.
Once connected, just ask your AI client questions like these โ it will pick the right tools (often chaining several) automatically:
"What's the average well cost in the Delaware Basin since 2023?"
โ query_well_costs
"Compare Diamondback vs Devon drilling costs for 2-mile laterals"
โ search_operators โ compare_costs
"Show me EOG's revenue, EBITDA, and free cash flow trend over the last 2 years"
โ query_financials
"Look up well 42-461-40916"
โ lookup_well
"Build a type curve for Comstock's Haynesville wells with >2-mile laterals"
โ search_wells โ build_type_curve
"What does Ovintiv's 2026 oil hedge book look like?"
โ query_hedges
"Summarize Diamondback's executive comp incentive plan"
โ query_executive_comp_incentives
"Pull a full corporate profile for Permian Resources"
โ create_corporate_profile (chains many tools)
Every tool response carries a _usage envelope with args_tokens, result_tokens, credits_charged, and credit_balance_after. Credits scale with payload size โ narrow filters cost less than broad scans.
get_mcp_credit_balance is free โ calling it never consumes credits. Ask your AI "what's my MCP credit balance?" anytime to confirm remaining usage.
Out of credits? Buy more or review usage history at MCP Credits. Low-balance email alerts fire automatically before the next call would fail.
Duplicate calls don't double-charge. Each tool invocation generates an idempotency key โ retries from a flaky client are detected and the original debit is reused.
afe_)
Get up and running with the AFE Leaks API in minutes
Choose your authentication method and get your credentials.
Test the API with a simple request to get well data.
curl -H "X-API-Key: afe_your_key" \
"https://api.afeleaks.com/api/wells?limit=10"
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://api.afeleaks.com/api/wells?limit=10"
Use the API clients or build custom integrations for your specific needs.
Our team can help you integrate AFE Leaks data into your existing systems and provide custom solutions.