POST
math
percentage
1 creditCalculate percentage: 'of' computes X% of Y, 'change' computes % change from value to total, 'what_percent' computes what % value is of total.
Endpoint
POST /api/v1/tools/math/percentage
Body Parameters
total
number
required
value
number
required
action
string
required
Options:
of
change
what_percent
Example
input
Request
{
"total": 200,
"value": 25,
"action": "of"
}
output
Response
{
"result": 50,
"description": "25.0% of 200.0 = 50.0"
}
Response Format
HTTP/1.1 200 OK
SUCCESS
{
"success": true,
"data": {
"result": 50,
"description": "25.0% of 200.0 = 50.0"
},
"meta": {
"tool": "percentage",
"credits_consumed": 1
}
}
HTTP/1.1 422 Unprocessable Entity
ERROR
{
"success": false,
"data": null,
"error": {
"code": "validation_error",
"message": "The given data was invalid."
}
}
Sign in to try this tool directly from the docs.
Code Examples
Request Example
lightbulb
Developer Tip
Credits are deducted before execution. If the upstream tool fails, credits are automatically refunded to your account.