Advertisement

header ad

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 successful
  • volume (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 calculation
  • calculation (string): A human-readable representation of the calculation
  • error (string): Error message (present only on failure)

API Endpoints

GET

Calculate Cube Volume

Endpoint

/api/v1/volume/cube

Parameters

NameTypeDescription
sidenumberLength of one side of the cube
unitstringUnit of measurement (e.g., 'cm', 'm', 'in')

Example Request

/api/v1/volume/cube?side=5&unit=cm

Example Response

{
  "success": true,
  "volume": 125,
  "unit": "cm³",
  "formula": "V = a³",
  "calculation": "V = 5³ = 125 cm³"
}
GET

Calculate Sphere Volume

Endpoint

/api/v1/volume/sphere

Parameters

NameTypeDescription
radiusnumberRadius of the sphere
unitstringUnit of measurement (e.g., 'cm', 'm', 'in')

Example Request

/api/v1/volume/sphere?radius=3&unit=cm

Example Response

{
  "success": true,
  "volume": 113.0973,
  "unit": "cm³",
  "formula": "V = (4/3) × π × r³",
  "calculation": "V = (4/3) × 3.14159 × 3³ ≈ 113.0973 cm³"
}
GET

Calculate Cylinder Volume

Endpoint

/api/v1/volume/cylinder

Parameters

NameTypeDescription
radiusnumberRadius of the base of the cylinder
heightnumberHeight of the cylinder
unitstringUnit of measurement (e.g., 'cm', 'm', 'in')

Example Request

/api/v1/volume/cylinder?radius=2&height=5&unit=cm

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 CodeDescription
400 Bad RequestThe request was invalid or is missing required parameters
401 UnauthorizedInvalid or missing API key
429 Too Many RequestsYou've exceeded the rate limit
500 Server ErrorSomething 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.