Social media ROI calculator API
Enter the revenue social media brought in and what it cost (ads, tools, hours, content), and get the ROI, the net return and where the money went.
- Endpoint:
POST https://postboost.co/app/api/tools/social-media-roi-calculator(operationIdcalculateSocialRoi) - Web tool: postboost.co/tools/social-media-roi-calculator
- Token: optional (limits)
- MCP: tool
calculate-social-roionhttps://postboost.co/mcp/tools
Request
| Field | Type | Default | Description |
|---|---|---|---|
revenue | number | Revenue attributed to social media in the period, in USD. | |
costs | object | What social media cost in the period, in USD. Every field is optional. | |
period | string | Optional label for the period, e.g. "Q3 2026". |
Call it
- curl
- Python
- Node.js
- PHP
- Go
- Ruby
- Java
- C#
- Rust
- CLI
curl -X POST https://postboost.co/app/api/tools/social-media-roi-calculator \
-H 'Content-Type: application/json' \
-d '{"revenue":5000,"costs":{"ad_spend":1000,"labor_hours":10,"hourly_rate":50}}'
from postboost import ApiClient, Configuration
from postboost.api.free_tools_api import FreeToolsApi
from postboost.models import FreeToolCalculateSocialRoiRequest
with ApiClient(Configuration()) as client:
api = FreeToolsApi(client)
result = api.calculate_social_roi(FreeToolCalculateSocialRoiRequest.from_dict({"revenue": 5000, "costs": {"ad_spend": 1000, "labor_hours": 10, "hourly_rate": 50}}))
print(result.to_dict())
import { FreeToolsApi } from 'postboost';
const api = new FreeToolsApi();
const { body } = await api.calculateSocialRoi({ revenue: 5000, costs: { adSpend: 1000, laborHours: 10, hourlyRate: 50 } });
console.log(body);
use PostBoostClient\Api\FreeToolsApi;
use PostBoostClient\Model\FreeToolCalculateSocialRoiRequest;
$api = new FreeToolsApi(new GuzzleHttp\Client());
$result = $api->calculateSocialRoi(new FreeToolCalculateSocialRoiRequest(['revenue' => 5000, 'costs' => ['ad_spend' => 1000, 'labor_hours' => 10, 'hourly_rate' => 50]]));
echo $result;
import (
"context"
"encoding/json"
"fmt"
postboost "github.com/postboost-co/postboost-go"
)
var request postboost.FreeToolCalculateSocialRoiRequest
if err := json.Unmarshal([]byte(`{"revenue":5000,"costs":{"ad_spend":1000,"labor_hours":10,"hourly_rate":50}}`), &request); err != nil {
panic(err)
}
client := postboost.NewAPIClient(postboost.NewConfiguration())
result, _, err := client.FreeToolsAPI.CalculateSocialRoi(context.Background()).FreeToolCalculateSocialRoiRequest(request).Execute()
fmt.Println(result, err)
require 'postboost'
api = PostBoost::FreeToolsApi.new
result = api.calculate_social_roi(PostBoost::FreeToolCalculateSocialRoiRequest.new({ revenue: 5000, costs: { ad_spend: 1000, labor_hours: 10, hourly_rate: 50 } }))
puts result.to_hash
import com.postboost.ApiClient;
import com.postboost.api.FreeToolsApi;
import com.postboost.model.FreeToolCalculateSocialRoiRequest;
import com.postboost.model.FreeToolCalculateSocialRoiResponse;
FreeToolsApi api = new FreeToolsApi(new ApiClient());
FreeToolCalculateSocialRoiRequest request = FreeToolCalculateSocialRoiRequest.fromJson("{\"revenue\":5000,\"costs\":{\"ad_spend\":1000,\"labor_hours\":10,\"hourly_rate\":50}}");
FreeToolCalculateSocialRoiResponse result = api.calculateSocialRoi(request);
System.out.println(result.toJson());
using Newtonsoft.Json;
using PostBoost.Client.Api;
using PostBoost.Client.Client;
using PostBoost.Client.Model;
var api = new FreeToolsApi(new Configuration());
var request = JsonConvert.DeserializeObject<FreeToolCalculateSocialRoiRequest>(@"{""revenue"":5000,""costs"":{""ad_spend"":1000,""labor_hours"":10,""hourly_rate"":50}}");
var result = await api.CalculateSocialRoiAsync(request);
Console.WriteLine(result.ToJson());
use postboost::apis::configuration::Configuration;
use postboost::apis::free_tools_api;
use postboost::models::FreeToolCalculateSocialRoiRequest;
let config = Configuration::new();
let request: FreeToolCalculateSocialRoiRequest = serde_json::from_str(r##"{"revenue":5000,"costs":{"ad_spend":1000,"labor_hours":10,"hourly_rate":50}}"##)?;
let result = free_tools_api::calculate_social_roi(&config, request).await?;
println!("{:?}", result);
echo '{"revenue":5000,"costs":{"ad_spend":1000,"labor_hours":10,"hourly_rate":50}}' | ./postboost-cli --content-type application/json calculateSocialRoi -
With a token, send Authorization: Bearer YOUR_API_TOKEN as a default header (how, per SDK).
Response
{
"period": null,
"revenue": 5000,
"total_cost": 1500,
"net_return": 3500,
"roi_percent": 233.3,
"cost_breakdown": [
{
"key": "ad_spend",
"label": "Ad spend",
"amount": 1000,
"share_percent": 66.7
},
{
"key": "labor",
"label": "Labor",
"amount": 500,
"share_percent": 33.3
}
],
"warnings": [],
"formula": "(5,000 − 1,500) ÷ 1,500 × 100 = 233.3%"
}
With MCP
Connect https://postboost.co/mcp/tools (setup) and ask, for example: Calculate social media ROI with the PostBoost calculate-social-roi tool.
Errors
| Status | When |
|---|---|
401 | The Authorization header holds an invalid token. Leave it out to call as a guest. |
413 | The JSON body is larger than 128 KB. |
422 | A field is invalid; the body lists the errors per field. |
429 | A limit is reached; see limits. |