API Documentation
Gas Calculators REST API
Access all our calculators programmatically via REST API. Perfect for integrating into your applications.
Base URL:
https://ywauohshtytmhngkpgoi.supabase.co/functions/v1/calculators-apiAuthentication:
Include your API key in the X-API-Key header with every request.
Available Endpoints
POST
/pressureConvert pressure between different units
Request Body:{
"value": 100,
"fromUnit": "psi"
}Response:{
"conversions": {
"Pa": 689476,
"kPa": 689.48,
"bar": 6.89,
...
},
"inputUnit": "psi",
"inputValue": 100
}POST
/temperatureConvert temperature between C, F, K, and R
Request Body:{
"value": 100,
"fromUnit": "C"
}POST
/volumeConvert volume between different units
Request Body:{
"value": 1,
"fromUnit": "bbl"
}POST
/gas-velocityCalculate gas velocity and related parameters
Request Body:{
"flowrate": 10,
"flowrateUnit": "mmscf",
"pressure": 1000,
"pressureUnit": "psig",
"temperature": 540,
"tempUnit": "R",
"gasSG": 0.65,
"pipeID": 12,
"pipeIDUnit": "in",
"carbonDioxide": 2,
"hydrogenSulfide": 10
}POST
/specific-gravityCalculate specific gravity at 60°F
Request Body:{
"value": 0.85,
"inputType": "SG",
"temperature": 75,
"tempUnit": "F"
}POST
/shrinkageCalculate shrinkage at 60°F
Request Body:{
"specificGravity": 0.85,
"temperature": 75,
"tempUnit": "F",
"measuredShrinkage": 2.5
}POST
/densityConvert density between different units and calculate API/SG
Request Body:{
"value": 850,
"fromUnit": "kg/m³"
}Example cURL Request
curl -X POST https://ywauohshtytmhngkpgoi.supabase.co/functions/v1/calculators-api/pressure \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key_here" \
-d '{
"value": 100,
"fromUnit": "psi"
}'Example JavaScript Request
const response = await fetch('https://ywauohshtytmhngkpgoi.supabase.co/functions/v1/calculators-api/pressure', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your_api_key_here'
},
body: JSON.stringify({
value: 100,
fromUnit: 'psi'
})
});
const data = await response.json();
console.log(data);Rate Limiting
API calls are limited based on your subscription tier. The following headers are included in every response:
X-RateLimit-Limit: Your monthly limitX-RateLimit-Remaining: Remaining calls this month
Error Responses
401 Unauthorized: Missing or invalid API key
403 Forbidden: API key is inactive
429 Too Many Requests: Monthly limit exceeded
404 Not Found: Endpoint doesn't exist
500 Internal Server Error: Server error