Flow calculator API

Programmatic interface for oil, water, and gas flow rates from pressure drop on a Venturi tube. Uses the same physical model as the Flow from pressure drop tab in the calculator.

Getting an API token

API access is provided via an individual token. Tokens are issued by the administrator after reviewing your request.

To request a token, go to Contact (site registration required) and send a message including:

After approval you will receive the token by email. Keep it like a password: do not publish it in open code or share with third parties.

Purpose

The API solves the direct problem: from measured pressure drop ΔP, MPFM geometry, PVT parameters, and GOR it determines component flow rates.

Typical scenarios:

The API provides flow calculation from ΔP only. Venturi range sizing, inverse ΔP from rates, Pro sizing analysis, and basic converters are available in the web calculator.

Protocol

MethodPOST
URLhttps://gvfcalc.ru/api.php
FormatJSON (Content-Type: application/json)
Response encodingUTF-8

Authorization

Pass the token in one of these ways:

Without a valid active token the server responds with 401.

Rate limiting

No more than one calculation per 5 seconds per token. When exceeded — response 429 with Retry-After header and retry_after_seconds in the body.

Input parameters

Parameters are sent in the POST request body (JSON).

ParameterTypeRequiredDescription
d_inlet_mmnumberyesMPFM inlet diameter, mm (> 0)
d_throat_mmnumberyesMPFM throat diameter, mm (> 0, less than inlet)
dP_kPanumberyesPressure drop, kPa (> 0)
P_MPa_gaugenumberyesOperating (gauge) pressure, MPa (> 0)
T_CnumberyesOperating temperature, °C
WLRnumberyesWater cut (water fraction), 0 ≤ WLR < 1
GORnumberyesGas-oil ratio, std m³/t (≥ 0)
rho_oil_stdnumberyesOil density at std. conditions (20 °C), kg/m³
rho_waternumberyesWater density, kg/m³
compositionarray(14)*Gas molar composition, % (preferred; Peng–Robinson PVT)
rho_gas_stdnumber*Gas density at std. conditions, kg/m³ (if no composition; then Z = 1)
wc_inversnumbernoPhase inversion water cut, 0–1 (default 0.5)
sigma_oil_gasnumbernoσ oil/gas, N/m (default 0.25)
sigma_water_gasnumbernoσ water/gas, N/m (default 0.07)
mu_gas_pasnumbernoGas viscosity, Pa·s (default 1.235×10⁻⁵)
mu_water_pasnumbernoWater viscosity, Pa·s (default 1×10⁻³)
mu_oil_pasnumbernoOil viscosity, Pa·s (default 0.02)

* Provide either composition (14 values) or rho_gas_std.

Order in <code>composition</code>: methane, ethane, propane, n-butane, iso-butane, n-pentane, iso-pentane, n-hexane, iso-hexane, H₂S, nitrogen, CO₂, oxygen, other.

Success response (code 200)

{
  "ok": true,
  "result": {
    "m_oil_t_day": 7.46,
    "m_water_t_day": 49.5,
    "m_gas_t_day": 5.98,
    "m_total_t_day": 62.9,
    "Q_oil_m3day": 8.48,
    "Q_liq_m3day": 57.9,
    "Q_gas_std_day": 6717.9,
    "Q_gas_wrk_day": 1620.4,
    "GVF_inlet_pct": 96.5,
    "alpha_throat_pct": 97.1,
    "flow_regime": "annular",
    "Rs": 0.0,
    "rho_liq": 990.1,
    "rho_gas_work": 3.9,
    "ctrl": { "Z": 0.94, "M_gas": 21.4, "rho_oil_work": 880.2 }
  },
  "meta": {
    "token_label": "Партнёр X",
    "rate_limit_seconds": 5,
    "calculated_at": "2026-06-22T21:00:00+03:00"
  }
}

The result block contains mass and volumetric phase rates, inlet GVF, flow regime, and auxiliary values in ctrl (compressibility Z, densities, viscosity, etc.).

Error codes

CodeMeaning
400Input validation errors (list in errors field)
401Token missing, invalid, or disabled
405Method other than POST used
422Calculation did not converge — no solution for given inputs
429Rate limit exceeded (1 request / 5 s)

Request example

With gas composition (14 components):

curl -X POST https://gvfcalc.ru/api.php \
  -H "Authorization: Bearer ВАШ_ТОКЕН" \
  -H "Content-Type: application/json" \
  -d '{
    "d_inlet_mm": 48,
    "d_throat_mm": 30,
    "dP_kPa": 3.91,
    "P_MPa_gauge": 0.411,
    "T_C": 18.5,
    "WLR": 0.857,
    "GOR": 900.5,
    "rho_oil_std": 901,
    "rho_water": 1003,
    "composition": [76.921,9.358,4.595,1.751,1.478,0.226,0.360,0.181,0.093,0.147,2.697,1.548,0.645,0.000]
  }'

Without gas composition (Z = 1):

curl -X POST https://gvfcalc.ru/api.php \
  -H "X-API-Token: ВАШ_ТОКЕН" \
  -H "Content-Type: application/json" \
  -d '{
    "d_inlet_mm": 48,
    "d_throat_mm": 30,
    "dP_kPa": 6.3,
    "P_MPa_gauge": 2.5,
    "T_C": 24.7,
    "WLR": 0.17,
    "GOR": 69,
    "rho_oil_std": 850,
    "rho_water": 1010,
    "rho_gas_std": 0.89
  }'

Integration recommendations

For access and token requests, use the Contact section.