PressureCode API Guide v0.9.28
App Tutorials Docs

API Reference for Developers & AI Agents

PressureCode provides a REST API that can be called from any programming language, AI agent, Excel/Google Sheets plugin, or automation tool. All endpoints return JSON.

Base URL: https://pressure-app-20.tail4f030f.ts.net
Authentication: Authorization: Bearer <token> or X-API-Key: pc_...
All calculation endpoints: /api/excel/<endpoint>?param1=value1&param2=value2

Table of Contents

Authentication Cylinder / Shell Dished Head Conical Shell Flat End Nozzle Reinforcement Nozzle P_allow (EN 12952) Tube Bend Material Properties Mass / Weight Inner Volume Test Pressure Pipe Schedule Optimize Thickness Standard Comparison Parameter Sweep Reverse Engineering Project API AI Agent Integration

Authentication

All API calls require authentication. Two methods are supported:

Option 1: Bearer Token (Login)

POST /auth/login
Content-Type: application/json

{"email": "user@example.com", "password": "secret"}

Response: {"access_token": "eyJ...", "user": {...}}

Then use: Authorization: Bearer eyJ... on all subsequent requests.

Option 2: API Key (Direct)

Use header: X-API-Key: pc_your_api_key_here

API keys are shown in the user profile after login.

Cylinder / Shell Calculation

GET /api/excel/cylinder

Calculate cylindrical shell under internal pressure. Returns utilization ratio, required thickness, and allowable pressure.

ParameterTypeRequiredDescription
standardstringYesEN13445, AD2000, ASMEVIII, ASMEI, EN12952
DofloatYesOutside diameter [mm]
tfloatYesWall thickness [mm]
PfloatYesDesign pressure [bar]
TfloatNoTemperature [°C] (default: 20)
materialstringNoMaterial designation (default: P265GH)
zfloatNoJoint efficiency 0-1 (default: 1.0)

Example

GET /api/excel/cylinder?standard=EN13445&Do=1200&t=20&P=25&T=300&material=P265GH

{
  "utilization": 0.663,
  "e_required_mm": 13.25,
  "p_allowable_bar": 37.51,
  "status": "PASS"
}
GET /api/excel/head

Dished head calculation (torispherical, ellipsoidal, hemispherical).

ParameterTypeRequiredDescription
standardstringYesDesign code
head_typestringYestorispherical, ellipsoidal, hemispherical
DofloatYesOutside diameter [mm]
tfloatYesWall thickness [mm]
PfloatYesDesign pressure [bar]
T, material-NoOptional (defaults: 20°C, P265GH)

Tube Bend (EN 12952-3)

GET /api/excel/tube_bend

Tube bend check per EN 12952-3 Anhang A. Returns Bi/Bo factors, intrados/extrados stresses, and P_allow.

ParameterTypeRequiredDescription
DofloatYesTube outside diameter [mm]
tfloatYesWall thickness [mm]
bend_radiusfloatYesBend radius to centerline [mm]
PfloatYesDesign pressure [bar]
T, material-NoOptional
GET /api/excel/tube_bend?Do=38&t=3.2&bend_radius=45&P=56.5&T=294&material=P235GH

{
  "Bi": 1.365, "Bo": 0.852,
  "sigma_intrados_MPa": 55.1, "sigma_extrados_MPa": 89.1,
  "P_allow_extrados_bar": 63.4,
  "utilization": 0.89, "passed": true
}

Nozzle Reinforcement P_allow

GET /api/excel/nozzle_reinf

Nozzle reinforcement check — returns allowable pressure at the opening.

ParameterTypeRequiredDescription
standardstringYesDesign code
shell_DofloatYesShell outside diameter [mm]
shell_tfloatYesShell wall thickness [mm]
nozzle_DofloatYesNozzle outside diameter [mm]
nozzle_tfloatYesNozzle wall thickness [mm]
PfloatYesDesign pressure [bar]
protrusion_outsidefloatNoOutside protrusion [mm] (default: 50)
protrusion_insidefloatNoInside protrusion [mm] (default: 0)

Material Properties

GET /api/excel/material

Temperature-dependent material property lookup.

ParameterTypeRequiredDescription
namestringYesMaterial: P265GH, P355GH, SA-516 Gr.70, ...
propstringYesRp02, Rm, E, alpha, density, poisson
TfloatNoTemperature [°C] (default: 20)
GET /api/excel/material?name=P265GH&prop=Rp02&T=300
{"value": 166.0, "unit": "MPa", "property": "Rp0.2", "temperature": 300}

Mass / Weight

GET /api/excel/mass

Component mass in kg. Supports cylinder, dished_head, flat_end.

GET /api/excel/mass?component=cylinder&Do=1200&t=20&L=3000&material=P265GH
{"value": 1467.3, "unit": "kg"}

Inner Volume

GET /api/excel/volume
GET /api/excel/volume?component=cylinder&Do=1200&t=20&L=3000
{"value": 3166.7, "unit": "dm3"}

Test Pressure

GET /api/excel/test_pressure

Required hydraulic test pressure per the applicable standard.

GET /api/excel/test_pressure?standard=EN12952&P=30&T=236&material=P355GH
{"value": 51.49, "unit": "bar"}

Pipe Schedule

GET /api/excel/pipe_schedule

Next standard wall thickness from EN 10216/10220 or ASME B36.10/B36.19.

GET /api/excel/pipe_schedule?Do=219.1&t_min=15.84&standard=EN
{"value": 16.0, "source": "EN 10216 DN200", "unit": "mm"}

Standard Comparison

GET /api/excel/compare

Same geometry against multiple standards. Returns a comparison table (array).

Parameter Sweep

GET /api/excel/sweep

Vary one parameter, compute results at each step. Returns headers + rows (array).

Project API

List Projects

GET /api/projects

Create Project

POST /api/projects

Get Project

GET /api/projects/{id}

Calculate All Components

POST /api/projects/{id}/calculate

Generate PDF Report

POST /api/projects/{id}/report/pdf

AI Agent Integration

Using PressureCode as an AI Tool

PressureCode's API is designed to be called by AI agents (LLMs, copilots, automation). Here's how to integrate:

1. Python Agent Example

import requests

BASE = "https://pressure-app-20.tail4f030f.ts.net"
HEADERS = {"X-API-Key": "pc_your_key_here"}

# Check a cylinder
r = requests.get(f"{BASE}/api/excel/cylinder",
    params={"standard": "EN13445", "Do": 1200, "t": 20, "P": 25, "T": 300, "material": "P265GH"},
    headers=HEADERS)
result = r.json()
print(f"Utilization: {result['utilization']:.1%}")  # 66.3%
print(f"Required thickness: {result['e_required_mm']} mm")
print(f"Status: {result['status']}")

# Get material property at temperature
r2 = requests.get(f"{BASE}/api/excel/material",
    params={"name": "P355GH", "prop": "Rp02", "T": 300},
    headers=HEADERS)
print(f"Rp0.2 at 300C: {r2.json()['value']} MPa")

2. Claude / OpenAI Function Calling

Define PressureCode as a tool for your AI agent:

{
  "name": "pressure_calculation",
  "description": "Calculate pressure vessel wall thickness per EN 13445, ASME VIII, etc.",
  "parameters": {
    "type": "object",
    "properties": {
      "standard": {"type": "string", "enum": ["EN13445", "AD2000", "ASMEVIII", "ASMEI", "EN12952"]},
      "component": {"type": "string", "enum": ["cylinder", "head", "cone", "flat_end"]},
      "Do": {"type": "number", "description": "Outside diameter [mm]"},
      "t": {"type": "number", "description": "Wall thickness [mm]"},
      "P": {"type": "number", "description": "Design pressure [bar]"},
      "T": {"type": "number", "description": "Temperature [C]"},
      "material": {"type": "string"}
    },
    "required": ["standard", "component", "Do", "t", "P"]
  }
}

3. Batch Calculation

# Calculate multiple components in sequence
components = [
    {"name": "Drum", "Do": 1800, "t": 25, "P": 30, "T": 236, "mat": "P355GH"},
    {"name": "Header", "Do": 219.1, "t": 12.7, "P": 30, "T": 236, "mat": "P235GH"},
    {"name": "Tube", "Do": 38.1, "t": 3.6, "P": 30, "T": 296, "mat": "P235GH"},
]
for c in components:
    r = requests.get(f"{BASE}/api/excel/cylinder",
        params={"standard": "EN12952", "Do": c["Do"], "t": c["t"],
                "P": c["P"], "T": c["T"], "material": c["mat"]},
        headers=HEADERS)
    d = r.json()
    print(f"{c['name']:10s} util={d['utilization']:.1%} e_req={d['e_required_mm']:.1f}mm")

4. Available Materials

GET /api/materials

Returns a list of all available materials with their designations and standards.

5. Error Handling

HTTP CodeMeaningAction
200SuccessParse JSON result
400Invalid parametersCheck parameter names/values
401Not authenticatedAdd Authorization or X-API-Key header
404Material not foundCheck material designation spelling
500Server errorReport bug

Complete Endpoint List (24 Endpoints)

#EndpointDescription
1/api/excel/cylinderCylindrical shell check/design
2/api/excel/headDished head check
3/api/excel/coneConical shell check
4/api/excel/flat_endFlat end / tube plate
5/api/excel/nozzleNozzle on shell (utilization)
6/api/excel/nozzle_reinfNozzle P_allow at opening
7/api/excel/flangeFlange connection
8/api/excel/supportSupport (saddle, lug, etc.)
9/api/excel/teeTee piece
10/api/excel/reducerReducer / cone transition
11/api/excel/pipe_bendPipe bend (general)
12/api/excel/tube_bendTube bend EN 12952 (Bi/Bo)
13/api/excel/materialMaterial property at temperature
14/api/excel/massComponent mass [kg]
15/api/excel/volumeInner volume [dm³]
16/api/excel/test_pressureRequired test pressure
17/api/excel/pipe_scheduleNext standard thickness
18/api/excel/optimizeOptimize wall thickness
19/api/excel/compareMulti-standard comparison
20/api/excel/sweepParameter sweep (array)
21/api/excel/sensitivitySensitivity analysis
22/api/excel/recommend_materialMaterial recommendation
23/api/excel/reverse_engineerReverse engineering
24/api/excel/materialsList all materials
PressureCode v0.9.28 — API Guide — ERK Energy Systems