Back to Blog
Tutorial

Getting Started with SociaVault API: Complete Developer Guide

January 5, 2026
6 min read
S
By SociaVault Team
Getting StartedAPITutorialDocumentationDeveloper Guide

Getting Started with SociaVault API

You want to extract social media data. Profiles, posts, comments, followers—from TikTok, Instagram, YouTube, Twitter, LinkedIn, and more.

SociaVault makes this simple with a unified REST API. One API key, consistent endpoints, clean JSON responses.

Let's get you set up.

Quick Start (5 Minutes)

Step 1: Create an Account

Go to sociavault.com/auth/sign-up and create your free account.

You get 50 free credits to test the API.

Step 2: Get Your API Key

  1. Log in to your dashboard
  2. Find your API key in the settings section
  3. Copy it somewhere safe

Step 3: Make Your First Request

const API_KEY = 'your_api_key_here';

const response = await fetch(
  'https://api.sociavault.com/v1/scrape/tiktok/profile?username=charlidamelio',
  {
    headers: {
      'Authorization': `Bearer ${API_KEY}`
    }
  }
);

const data = await response.json();
console.log(data);

That's it. You're scraping social media data.

Authentication

All requests require an API key in the Authorization header:

Authorization: Bearer your_api_key_here

cURL Example

curl -X GET "https://api.sociavault.com/v1/scrape/tiktok/profile?username=charlidamelio" \
  -H "Authorization: Bearer your_api_key_here"

Python Example

import requests

API_KEY = "your_api_key_here"
headers = {"Authorization": f"Bearer {API_KEY}"}

response = requests.get(
    "https://api.sociavault.com/v1/scrape/tiktok/profile",
    params={"username": "charlidamelio"},
    headers=headers
)

print(response.json())

API Structure

Base URL

https://api.sociavault.com/v1/scrape

Endpoint Pattern

/{platform}/{resource}?{parameters}

Platforms: tiktok, instagram, youtube, twitter, linkedin, reddit, facebook, threads

Resources: Vary by platform (profile, posts, comments, search, etc.)

Common Endpoints

TikTok

EndpointDescription
/tiktok/profileGet user profile
/tiktok/videosGet user's videos
/tiktok/videoGet single video info
/tiktok/commentsGet video comments
/tiktok/searchSearch videos
/tiktok/hashtagGet hashtag videos
// Get TikTok profile
const profile = await fetch(
  'https://api.sociavault.com/v1/scrape/tiktok/profile?username=charlidamelio',
  { headers: { 'Authorization': `Bearer ${API_KEY}` } }
).then(r => r.json());

// Get user's videos
const videos = await fetch(
  'https://api.sociavault.com/v1/scrape/tiktok/videos?username=charlidamelio&count=20',
  { headers: { 'Authorization': `Bearer ${API_KEY}` } }
).then(r => r.json());

Instagram

EndpointDescription
/instagram/profileGet user profile
/instagram/postsGet user's posts
/instagram/postGet single post info
/instagram/reelsGet user's reels
/instagram/commentsGet post comments
/instagram/hashtagGet hashtag posts
// Get Instagram profile
const profile = await fetch(
  'https://api.sociavault.com/v1/scrape/instagram/profile?username=natgeo',
  { headers: { 'Authorization': `Bearer ${API_KEY}` } }
).then(r => r.json());

YouTube

EndpointDescription
/youtube/channelGet channel info
/youtube/videosGet channel videos
/youtube/videoGet video details
/youtube/commentsGet video comments
/youtube/searchSearch videos
/youtube/transcriptGet video transcript
// Get YouTube transcript (great for AI/RAG)
const transcript = await fetch(
  'https://api.sociavault.com/v1/scrape/youtube/transcript?videoId=dQw4w9WgXcQ',
  { headers: { 'Authorization': `Bearer ${API_KEY}` } }
).then(r => r.json());

Twitter

EndpointDescription
/twitter/userGet user profile
/twitter/tweetsGet user's tweets
/twitter/tweetGet single tweet
/twitter/searchSearch tweets

LinkedIn

EndpointDescription
/linkedin/profileGet person profile
/linkedin/companyGet company info

Reddit

EndpointDescription
/reddit/userGet user profile
/reddit/subredditGet subreddit info
/reddit/postsGet subreddit posts
/reddit/commentsGet post comments
/reddit/searchSearch posts

Response Format

All responses follow this structure:

{
  "success": true,
  "data": {
    // Platform-specific data
  },
  "credits_used": 1,
  "credits_remaining": 49
}

Error Response

{
  "success": false,
  "error": {
    "code": "INVALID_USERNAME",
    "message": "The username provided does not exist"
  }
}

Code Examples

JavaScript/Node.js

require('dotenv').config();

const API_KEY = process.env.SOCIAVAULT_API_KEY;
const API_BASE = 'https://api.sociavault.com/v1/scrape';

async function getTikTokProfile(username) {
  const response = await fetch(
    `${API_BASE}/tiktok/profile?username=${username}`,
    { headers: { 'Authorization': `Bearer ${API_KEY}` } }
  );
  
  if (!response.ok) {
    throw new Error(`API error: ${response.status}`);
  }
  
  return response.json();
}

// Usage
const profile = await getTikTokProfile('charlidamelio');
console.log(`${profile.data.nickname}: ${profile.data.follower_count} followers`);

Python

import os
import requests
from dotenv import load_dotenv

load_dotenv()

API_KEY = os.getenv('SOCIAVAULT_API_KEY')
API_BASE = 'https://api.sociavault.com/v1/scrape'

def get_tiktok_profile(username):
    response = requests.get(
        f'{API_BASE}/tiktok/profile',
        params={'username': username},
        headers={'Authorization': f'Bearer {API_KEY}'}
    )
    response.raise_for_status()
    return response.json()

# Usage
profile = get_tiktok_profile('charlidamelio')
print(f"{profile['data']['nickname']}: {profile['data']['follower_count']} followers")

TypeScript

interface SociaVaultResponse<T> {
  success: boolean;
  data: T;
  credits_used: number;
  credits_remaining: number;
}

interface TikTokProfile {
  username: string;
  nickname: string;
  follower_count: number;
  following_count: number;
  like_count: number;
  bio: string;
  avatar_url: string;
}

async function getTikTokProfile(username: string): Promise<SociaVaultResponse<TikTokProfile>> {
  const response = await fetch(
    `https://api.sociavault.com/v1/scrape/tiktok/profile?username=${username}`,
    { headers: { 'Authorization': `Bearer ${process.env.SOCIAVAULT_API_KEY}` } }
  );
  
  return response.json();
}

Best Practices

1. Use Environment Variables

Never hardcode your API key:

// Good
const API_KEY = process.env.SOCIAVAULT_API_KEY;

// Bad
const API_KEY = 'sk_live_abc123...'; // Don't do this!

2. Handle Errors Gracefully

async function safeApiCall(endpoint, params) {
  try {
    const url = new URL(`https://api.sociavault.com/v1/scrape${endpoint}`);
    Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
    
    const response = await fetch(url, {
      headers: { 'Authorization': `Bearer ${API_KEY}` }
    });
    
    if (!response.ok) {
      const error = await response.json();
      throw new Error(error.error?.message || `HTTP ${response.status}`);
    }
    
    return await response.json();
  } catch (error) {
    console.error('API call failed:', error.message);
    return null;
  }
}

3. Implement Caching

const cache = new Map();

async function cachedApiCall(key, fetchFn, ttlMs = 3600000) {
  const cached = cache.get(key);
  
  if (cached && Date.now() - cached.time < ttlMs) {
    return cached.data;
  }
  
  const data = await fetchFn();
  cache.set(key, { data, time: Date.now() });
  return data;
}

// Usage
const profile = await cachedApiCall(
  `tiktok:${username}`,
  () => getTikTokProfile(username),
  3600000 // 1 hour cache
);

4. Rate Limiting

async function batchRequests(items, requestFn, delayMs = 500) {
  const results = [];
  
  for (const item of items) {
    const result = await requestFn(item);
    results.push(result);
    await new Promise(r => setTimeout(r, delayMs));
  }
  
  return results;
}

// Usage
const usernames = ['user1', 'user2', 'user3'];
const profiles = await batchRequests(usernames, getTikTokProfile, 500);

5. Monitor Credit Usage

let totalCreditsUsed = 0;

async function trackCredits(apiCall) {
  const result = await apiCall();
  
  if (result.credits_used) {
    totalCreditsUsed += result.credits_used;
    console.log(`Credits used: ${result.credits_used}, Total: ${totalCreditsUsed}`);
  }
  
  if (result.credits_remaining < 10) {
    console.warn('Low credits! Consider upgrading.');
  }
  
  return result;
}

Common Use Cases

Building an Influencer Database

async function buildInfluencerDatabase(usernames) {
  const influencers = [];
  
  for (const username of usernames) {
    const profile = await getTikTokProfile(username);
    
    influencers.push({
      username: profile.data.username,
      name: profile.data.nickname,
      followers: profile.data.follower_count,
      engagement: calculateEngagement(profile.data),
      niche: detectNiche(profile.data.bio)
    });
    
    await sleep(500);
  }
  
  return influencers;
}

Content Monitoring

async function monitorHashtag(hashtag, interval = 3600000) {
  setInterval(async () => {
    const data = await fetch(
      `${API_BASE}/tiktok/hashtag?name=${hashtag}&count=50`,
      { headers: { 'Authorization': `Bearer ${API_KEY}` } }
    ).then(r => r.json());
    
    const newPosts = filterNewPosts(data.data.videos);
    
    if (newPosts.length > 0) {
      await notifyTeam(newPosts);
    }
  }, interval);
}

Next Steps

  1. Explore the Playground: Test endpoints at sociavault.com/dashboard/playground
  2. Check API Docs: Full documentation at docs.sociavault.com
  3. Join Discord: Get help from the community

Questions? Email us at support@sociavault.com


Related:

Found this helpful?

Share it with others who might benefit

Ready to Try SociaVault?

Start extracting social media data with our powerful API. No credit card required.