API Documentation

Code Examples

Ready-to-use integration examples in multiple programming languages. Replace mg_live_your_key_here with your actual API key from the dashboard.

List Reports

Retrieve all market research reports for the authenticated user.

cURL
curl -X GET "https://marketgeist.com/api/v1/public/reports" \
  -H "X-API-Key: mg_live_your_key_here"
Python
import requests

API_KEY = "mg_live_your_key_here"
BASE_URL = "https://marketgeist.com/api/v1/public"

response = requests.get(
    f"{BASE_URL}/reports",
    headers={"X-API-Key": API_KEY}
)

data = response.json()
for report in data["data"]["reports"]:
    print(f"{report['id']}: {report['niche']} ({report['status']})")
JavaScript / Node.js
const API_KEY = "mg_live_your_key_here";
const BASE_URL = "https://marketgeist.com/api/v1/public";

const response = await fetch(`${BASE_URL}/reports`, {
  headers: { "X-API-Key": API_KEY },
});

const { data } = await response.json();
data.reports.forEach((report) => {
  console.log(`${report.id}: ${report.niche} (${report.status})`);
});
Go
package main

import (
    "encoding/json"
    "fmt"
    "net/http"
    "io"
)

func main() {
    client := &http.Client{}
    req, _ := http.NewRequest("GET",
        "https://marketgeist.com/api/v1/public/reports", nil)
    req.Header.Set("X-API-Key", "mg_live_your_key_here")

    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    var result map[string]interface{}
    json.Unmarshal(body, &result)
    fmt.Println(result)
}
Ruby
require "net/http"
require "json"

uri = URI("https://marketgeist.com/api/v1/public/reports")
req = Net::HTTP::Get.new(uri)
req["X-API-Key"] = "mg_live_your_key_here"

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(req)
end

data = JSON.parse(res.body)
data["data"]["reports"].each do |report|
  puts "#{report['id']}: #{report['niche']} (#{report['status']})"
end
PHP
<?php

$apiKey = "mg_live_your_key_here";
$baseUrl = "https://marketgeist.com/api/v1/public";

$ch = curl_init("$baseUrl/reports");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "X-API-Key: $apiKey",
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
foreach ($data["data"]["reports"] as $report) {
    echo "{$report['id']}: {$report['niche']} ({$report['status']})\n";
}

Generate a Report

Create a new AI-powered market research report.

cURL
curl -X POST "https://marketgeist.com/api/v1/public/reports" \
  -H "X-API-Key: mg_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"niche": "AI recruitment platforms", "report_type": "comprehensive_analysis"}'
Python
import requests

API_KEY = "mg_live_your_key_here"
BASE_URL = "https://marketgeist.com/api/v1/public"

response = requests.post(
    f"{BASE_URL}/reports",
    headers={
        "X-API-Key": API_KEY,
        "Content-Type": "application/json",
    },
    json={
        "niche": "AI recruitment platforms",
        "report_type": "comprehensive_analysis",
    }
)

result = response.json()
print(f"Report created: ID {result['data']['id']}")
JavaScript / Node.js
const API_KEY = "mg_live_your_key_here";
const BASE_URL = "https://marketgeist.com/api/v1/public";

const response = await fetch(`${BASE_URL}/reports`, {
  method: "POST",
  headers: {
    "X-API-Key": API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    niche: "AI recruitment platforms",
    report_type: "comprehensive_analysis",
  }),
});

const { data } = await response.json();
console.log("Report created:", data.id);

Get Social Trends

Fetch trending topics from Reddit, X, TikTok, or Google Trends.

cURL
# Reddit trends
curl "https://marketgeist.com/api/v1/public/social-trends/reddit" \
  -H "X-API-Key: mg_live_your_key_here"

# TikTok trends
curl "https://marketgeist.com/api/v1/public/social-trends/tiktok" \
  -H "X-API-Key: mg_live_your_key_here"

# Cross-platform feed
curl "https://marketgeist.com/api/v1/public/social-trends/feed" \
  -H "X-API-Key: mg_live_your_key_here"
Python
import requests

API_KEY = "mg_live_your_key_here"
BASE_URL = "https://marketgeist.com/api/v1/public"

platforms = ["reddit", "x", "tiktok", "google_trends"]

for platform in platforms:
    response = requests.get(
        f"{BASE_URL}/social-trends/{platform}",
        headers={"X-API-Key": API_KEY}
    )
    data = response.json()
    print(f"\n--- {platform} ---")
    for item in data["data"][:5]:
        print(f"  {item.get('title', item.get('keyword', 'N/A'))}")

Search Market Data

Search for companies by name, ticker symbol, or industry.

cURL
curl "https://marketgeist.com/api/v1/public/market-data/search?q=salesforce&limit=5" \
  -H "X-API-Key: mg_live_your_key_here"
Python
import requests

API_KEY = "mg_live_your_key_here"
BASE_URL = "https://marketgeist.com/api/v1/public"

response = requests.get(
    f"{BASE_URL}/market-data/search",
    headers={"X-API-Key": API_KEY},
    params={"q": "salesforce", "limit": 5}
)

data = response.json()
for company in data["data"]:
    rev = company['revenue']
    print(f"{company['ticker']}: {company['name']} - {rev:,.0f} revenue")