Difference between revisions of "Category: API"
(→Petroleum Engineering API) |
|||
| Line 10: | Line 10: | ||
* [[:PVT_API|PVT API]] - Fluid properties calculator | * [[:PVT_API|PVT API]] - Fluid properties calculator | ||
| + | |||
| + | ==Base URL== | ||
| + | |||
| + | <pre>https://api.pengtools.com/</pre> | ||
| + | |||
| + | Endpoints are addressed as <base>/<resource>/<action>, e.g. <pre>https://api.pengtools.com/pvt-calculator/calc</pre>. All examples below use this base URL. | ||
| + | |||
| + | ==Authentication== | ||
| + | |||
| + | Every request must include an API key as a Bearer token: | ||
| + | |||
| + | <pre>Authorization: Bearer <api_key></pre> | ||
| + | |||
| + | A key is a single opaque token. It is stored only as a salted hash on the server, so the plaintext is shown once, at creation time, and cannot be recovered afterwards. | ||
| + | |||
| + | ===Getting a key=== | ||
| + | |||
| + | Manage your keys in the accounts portal: | ||
| + | |||
| + | # Sign in at accounts.pengtools.com. | ||
| + | # Open the API keys section of your profile. | ||
| + | # Click Create to issue a new key, optionally giving it a name. | ||
| + | |||
| + | The new token is displayed once, right after creation. Copy it immediately and store it as a secret (environment variable, secrets manager). If you lose it, revoke the key on the same page and create a new one. The page also lists your existing keys (without the plaintext) and lets you revoke any of them. | ||
| + | |||
| + | A request with no key, or an invalid/revoked key, returns HTTP 401. | ||
| + | |||
| + | ==Response envelope== | ||
| + | |||
| + | Every JSON response is wrapped in a uniform envelope: | ||
| + | |||
| + | <pre> | ||
| + | { "success": true, "data": { "...": "..." } } | ||
| + | { "success": false, "data": { "errors": { "...": "..." } } } | ||
| + | </pre> | ||
| + | |||
| + | success mirrors the HTTP status (2xx → true). Validation problems return 422, rate-limit rejections return 429. See the error reference for details. | ||
==Getting Started== | ==Getting Started== | ||
Revision as of 15:40, 15 July 2026
Contents
REST APIs for Petroleum Engineering
The pengtools API gives programmatic access to the engineering calculators that power www.pengtools.com.
Available APIs
- PVT API - Fluid properties calculator
Base URL
https://api.pengtools.com/Endpoints are addressed as <base>/<resource>/<action>, e.g.
https://api.pengtools.com/pvt-calculator/calc. All examples below use this base URL.
Authentication
Every request must include an API key as a Bearer token:
Authorization: Bearer <api_key>
A key is a single opaque token. It is stored only as a salted hash on the server, so the plaintext is shown once, at creation time, and cannot be recovered afterwards.
Getting a key
Manage your keys in the accounts portal:
- Sign in at accounts.pengtools.com.
- Open the API keys section of your profile.
- Click Create to issue a new key, optionally giving it a name.
The new token is displayed once, right after creation. Copy it immediately and store it as a secret (environment variable, secrets manager). If you lose it, revoke the key on the same page and create a new one. The page also lists your existing keys (without the plaintext) and lets you revoke any of them.
A request with no key, or an invalid/revoked key, returns HTTP 401.
Response envelope
Every JSON response is wrapped in a uniform envelope:
{ "success": true, "data": { "...": "..." } }
{ "success": false, "data": { "errors": { "...": "..." } } }
success mirrors the HTTP status (2xx → true). Validation problems return 422, rate-limit rejections return 429. See the error reference for details.
Getting Started
1. Authentication - API key setup 2. API Reference - Endpoint documentation 3. Rate Limits - Usage policies
Support
For questions or issues, contact Support or visit our contact page.
Pages in category "API"
The following 2 pages are in this category, out of 2 total.
