Volume Calculator API
Integrate our powerful volume calculation tools into your own applications with our easy-to-use API.
Note: Our API is currently in beta. To request access, please contact us for an API key and further instructions.
Getting Started
Authentication
All API requests require an API key, which should be included in the request header:
X-API-Key: your_api_key_here
Base URL
All API endpoints are relative to the following base URL:
https://api.volumecalculator.com
Rate Limits
The API is rate-limited to 100 requests per hour for the basic tier. Contact us for information about higher volume needs.
Response Format
All API responses are in JSON format and include the following standard fields:
success
(boolean): Indicates if the request was successfulvolume
(number): The calculated volume (present only on success)unit
(string): The unit of the volume measurement (e.g., "cm³")formula
(string): The formula used for calculationcalculation
(string): A human-readable representation of the calculationerror
(string): Error message (present only on failure)
API Endpoints
Calculate Cube Volume
Endpoint
Parameters
Name | Type | Description |
---|---|---|
side | number | Length of one side of the cube |
unit | string | Unit of measurement (e.g., 'cm', 'm', 'in') |
Example Request
Example Response
{
"success": true,
"volume": 125,
"unit": "cm³",
"formula": "V = a³",
"calculation": "V = 5³ = 125 cm³"
}
Calculate Sphere Volume
Endpoint
Parameters
Name | Type | Description |
---|---|---|
radius | number | Radius of the sphere |
unit | string | Unit of measurement (e.g., 'cm', 'm', 'in') |
Example Request
Example Response
{
"success": true,
"volume": 113.0973,
"unit": "cm³",
"formula": "V = (4/3) × π × r³",
"calculation": "V = (4/3) × 3.14159 × 3³ ≈ 113.0973 cm³"
}
Calculate Cylinder Volume
Endpoint
Parameters
Name | Type | Description |
---|---|---|
radius | number | Radius of the base of the cylinder |
height | number | Height of the cylinder |
unit | string | Unit of measurement (e.g., 'cm', 'm', 'in') |
Example Request
Example Response
{
"success": true,
"volume": 62.8318,
"unit": "cm³",
"formula": "V = π × r² × h",
"calculation": "V = 3.14159 × 2² × 5 ≈ 62.8318 cm³"
}
Error Handling
The API uses standard HTTP status codes to indicate the success or failure of an API request. In addition to the HTTP status, the response body will contain more detailed information.
Common Error Codes
Status Code | Description |
---|---|
400 Bad Request | The request was invalid or is missing required parameters |
401 Unauthorized | Invalid or missing API key |
429 Too Many Requests | You've exceeded the rate limit |
500 Server Error | Something went wrong on our end |
Error Response Format
{
"success": false,
"error": "Error message describing what went wrong",
"code": "ERROR_CODE"
}
Need Help?
If you have any questions about using our API or need assistance with integration, our developer support team is here to help.