Get started

Evaluate SocialTap

Compare SocialTap with another social media API fairly: the same inputs, the cost of each successful result, null as unknown, and the pitfalls.

On this page
  1. Start with the endpoints people use most
  2. Send every vendor the same inputs
  3. Measure the cost of each successful result
  4. Read null as unknown, never as zero
  5. Compare the full answer
  6. Leave caching out while you measure
  7. Compare lists by the item
  8. Time requests on your side
  9. Keep the request ID of anything odd
  10. Common pitfalls
  11. A comparison script

Run a fair comparison of SocialTap with another social media API: send both the same inputs, count what each successful result cost, and read every answer the same way. This page is for the developer or the agent running the test.

The shortest test is one request. This calls the TikTok Profile API with its example input; send the same input to the other API, then compare the two answers and what each cost (meta.credits_charged here):

cURL
curl 'https://socialtap.dev/v1/tiktok/profile?handle=nasa' \
  -H "x-api-key: $SOCIALTAP_API_KEY"
TypeScript SDK
// Save this as app.mjs (an ES module) and run: node app.mjs
import { SocialTap } from "socialtap";

const client = new SocialTap(); // apiKey defaults to process.env.SOCIALTAP_API_KEY

const res = await client.tiktok.profile.get({ handle: "nasa" });
console.log(res.data);
console.log(res.credits.charged, res.meta.request_id);
Python SDK
from socialtap import SocialTap

client = SocialTap()  # api_key defaults to os.environ["SOCIALTAP_API_KEY"]

res = client.tiktok.profile.get(handle="nasa")
print(res.data)
print(res.credits.charged, res.meta.request_id)
Go SDK
package main

import (
	"context"
	"fmt"
	"log"

	socialtap "socialtap.dev/sdk/go"
)

func main() {
	ctx := context.Background()
	client, err := socialtap.NewClient() // the API key defaults to $SOCIALTAP_API_KEY
	if err != nil {
		log.Fatal(err)
	}
	res, err := client.TikTok.Profile.Get(ctx, socialtap.TikTokProfileParams{Handle: "nasa"})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(res.Data)
	fmt.Println(res.Credits.Charged, res.Meta.RequestID)
}
Node.js (fetch)
// Node 18+: save this as app.mjs (an ES module) and run: node app.mjs
const params = new URLSearchParams({
  handle: "nasa",
});
const res = await fetch(`https://socialtap.dev/v1/tiktok/profile?${params}`, {
  headers: { "x-api-key": process.env.SOCIALTAP_API_KEY ?? "" },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const { data, meta } = body;
console.log(data, meta.credits_charged);
Python (requests)
import os

import requests

res = requests.get(
    "https://socialtap.dev/v1/tiktok/profile",
    params={"handle": "nasa"},
    headers={"x-api-key": os.environ["SOCIALTAP_API_KEY"]},
)
body = res.json()
if not res.ok:
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
data, meta = body["data"], body["meta"]
print(data, meta["credits_charged"])
Go (net/http)
package main

import (
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"net/url"
	"os"
)

func main() {
	q := url.Values{}
	q.Set("handle", "nasa")
	req, err := http.NewRequest("GET", "https://socialtap.dev/v1/tiktok/profile?"+q.Encode(), nil)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("x-api-key", os.Getenv("SOCIALTAP_API_KEY"))
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer res.Body.Close()
	var body struct {
		Data  json.RawMessage `json:"data"`
		Meta  map[string]any  `json:"meta"`
		Error *struct {
			Code    string `json:"code"`
			Message string `json:"message"`
		} `json:"error"`
	}
	if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
		log.Fatal(err)
	}
	if body.Error != nil {
		log.Fatalf("%s: %s", body.Error.Code, body.Error.Message)
	}
	fmt.Println(string(body.Data), body.Meta["credits_charged"])
}
PHP
<?php

$query = http_build_query([
    'handle' => 'nasa',
]);
$ch = curl_init('https://socialtap.dev/v1/tiktok/profile?' . $query);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['x-api-key: ' . getenv('SOCIALTAP_API_KEY')],
]);
$body = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
    throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
echo $body['meta']['credits_charged'], PHP_EOL;
Ruby
require "json"
require "net/http"

uri = URI("https://socialtap.dev/v1/tiktok/profile")
uri.query = URI.encode_www_form('handle' => 'nasa')
req = Net::HTTP::Get.new(uri)
req["x-api-key"] = ENV.fetch("SOCIALTAP_API_KEY")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
body = JSON.parse(res.body)
raise "#{body["error"]["code"]}: #{body["error"]["message"]}" unless res.is_a?(Net::HTTPSuccess)
pp body["data"]
puts body["meta"]["credits_charged"]
Java
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) throws Exception {
        String query = "handle=" + encode("nasa");
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://socialtap.dev/v1/tiktok/profile?" + query))
            .header("x-api-key", System.getenv("SOCIALTAP_API_KEY"))
            .GET()
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        // An error is {"error": {"code", "message", ...}}; success is {data, meta}, meta.credits_charged its price.
        if (response.statusCode() >= 400) throw new RuntimeException(response.body());
        System.out.println(response.body());
    }

    static String encode(String value) {
        return URLEncoder.encode(value, StandardCharsets.UTF_8);
    }
}
.NET
using System.Text.Json;

using var http = new HttpClient();
http.DefaultRequestHeaders.Add("x-api-key", Environment.GetEnvironmentVariable("SOCIALTAP_API_KEY"));

var query = string.Join("&",
    "handle=" + Uri.EscapeDataString("nasa"));
var res = await http.GetAsync("https://socialtap.dev/v1/tiktok/profile?" + query);
using var body = JsonDocument.Parse(await res.Content.ReadAsStringAsync());
if (!res.IsSuccessStatusCode)
{
    var error = body.RootElement.GetProperty("error");
    throw new Exception($"{error.GetProperty("code")}: {error.GetProperty("message")}");
}
Console.WriteLine(body.RootElement.GetProperty("data"));
Console.WriteLine(body.RootElement.GetProperty("meta").GetProperty("credits_charged"));
Rust
// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }, serde_json = "1"
use std::env;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let res = reqwest::blocking::Client::new()
        .get("https://socialtap.dev/v1/tiktok/profile")
        .query(&[("handle", "nasa")])
        .header("x-api-key", env::var("SOCIALTAP_API_KEY")?)
        .send()?;
    let ok = res.status().is_success();
    let body: serde_json::Value = res.json()?;
    if !ok {
        return Err(format!("{}: {}", body["error"]["code"], body["error"]["message"]).into());
    }
    println!("{} {}", body["data"], body["meta"]["credits_charged"]);
    Ok(())
}

Start with the endpoints people use most

Each row is a kind of data people ask for most, on the platform they ask for it most. Every other endpoint is in the API reference.

DataTry firstPrice
PostsTikTok Post API1 credit
ProfilesTikTok Profile API1 credit
CommentsTikTok Comments API1 credit per page
TranscriptsTikTok Transcript API1 credit (captions) or 2 credits + 2 per started minute of media (speech-to-text, automatic up to 3 minutes, longer with transcribe_audio=true)
AdsTikTok Ad Library Search API1 credit per page
HashtagsTikTok Hashtag API1 credit

For any other need, ask the MCP server's find_endpoint tool in plain words or with a link. It names the endpoint, its arguments and its price, free and without a key. The script below uses it.

Send every vendor the same inputs

  • Pick the inputs first. Use real links, handles and searches from your own product. Mix large and small accounts, new and old posts, and a few that should fail (a deleted post, a private account).
  • Send each input to every vendor within minutes. Counts change by the minute, so a test run hours apart compares two different moments.
  • Send links the way your users paste them. Mobile, short and tracking links included. Each endpoint's reference lists the link forms and IDs it takes.

Measure the cost of each successful result

Failed requests are free here, so the number that matters is what you paid divided by the results you can use, not by the requests you sent.

  • Read what each answer cost in meta.credits_charged, or the x-credits-charged header, and add them up. A retry after a failure adds nothing.
  • An empty answer that succeeds is charged, such as a search with no results. Count it as a request, not a result.
  • Convert credits to money with the price per credit of the plan or pack you would buy, on the pricing page.

Read null as unknown, never as zero

  • null means the platform doesn't show the value. Another API's 0 for the same field is not more data. Compare a field only where both answers know it, and count how often each one knows it.
  • approximate_fields lists the values the platform rounded or showed as display text ("1.5M"). Compare those with a tolerance.
  • unknown_fields lists the lists whose [] means unknown, not none.

The Requests guide has every rule.

Compare the full answer

A REST answer has every field of the schema. An MCP tool's result is concise: it leaves out null fields and empty objects. Pass detail="full" to a tool for every field, so you compare the same answer another API sends whole.

Leave caching out while you measure

max_age accepts a stored answer up to that many seconds old, and a cache hit is free, with meta.is_cached true. Leave it out while you measure, so every answer is read live. Add it in production, where a free repeat is what you want.

Compare lists by the item

A list is priced per page. A smaller limit costs the same per page, so leave it out. Walk the same number of pages on each API and divide what you paid by the items you got. A page with page.has_more true and no items is not the end of the list: the Pagination guide says why.

Time requests on your side

Time each request from the same machine for every vendor, with the same inputs, at the same time of day. The first request for an item reads the platform; a repeat with max_age can come from the cache, much faster, so keep cached answers out of a speed test.

Keep the request ID of anything odd

A success carries meta.request_id, an error error.request_id, and both the x-request-id header. When an answer looks wrong, send the ID and what you expected to support: we can see that exact request.

Common pitfalls

PitfallDo this instead
Scoring another API's 0 higher than a nullCompare a field only where both answers know it
Comparing a concise MCP result with a full answerPass detail="full"
Counting failed requests in the costAdd up meta.credits_charged: failures add nothing
Leaving max_age setLeave it out while you measure: cache hits are free and fast
Lowering limit to saveLeave it out: a page costs the same at any size
Typing an input differently per vendorSend the same string to each
Reading rounded values as exactCheck approximate_fields
Testing only inputs that workInclude a deleted post and a private account, and compare the error codes: not_found and private_or_unavailable here

A comparison script

The script finds the endpoint for each need with find_endpoint and calls it with your inputs. It prints one line per answer: whether it succeeded, the error code, the credits it cost and the seconds it took. It uses the Python SDK (pip install socialtap) and its agent tools, which call the MCP server's tools, and reads the key from SOCIALTAP_API_KEY.

Python
import json, time
from socialtap import SocialTap
from socialtap.tools import call_tool

client = SocialTap()
# Each need in plain words, and the inputs you also send every other vendor.
TESTS = [
    ("<your need, in plain words>", [{"<param>": "<your link, handle or search>"}]),
]

for need, inputs in TESTS:
    match = call_tool(client, "find_endpoint", {"query": need, "limit": 1}).output["results"][0]
    for args in inputs:
        started = time.monotonic()
        r = call_tool(client, match["tool"], {**match["arguments"], **args, "detail": "full"})
        print(json.dumps({
            "need": need,
            "endpoint": match["endpoint"],
            "input": args,
            "ok": not r.is_error,
            "error": r.output["error"]["code"] if r.is_error else None,
            "credits": r.output.get("credits_charged", 0),
            "seconds": round(time.monotonic() - started, 2),
        }))

match["params"] names the parameters the endpoint takes, and match["example_arguments"] shows the kind of input each one wants.

Last updated