> Documentation index: https://www.socialcrawl.dev/llms.txt > Every page is also available as Markdown by adding .md. # Post numbers (/docs/recipes/post-numbers-into-a-sheet) Paste post links into a Google Sheet, refresh views, likes and comments each morning, and chart them over time Send up to 100 post links in one call, and get back each post's views, likes and comments. Write them into a sheet with the date, once a morning, and the sheet becomes a chart of how each post grew. The links can mix Instagram, TikTok, YouTube and other platforms. Measured on 23/11/2026: ten public posts, four on Instagram, three on TikTok and three on YouTube, cost 14 credits in one call. All ten came back. ## Start in five minutes Set your key once. Every block on this page reads it. ```bash title="Terminal" export SOCIALCRAWL_API_KEY=YOUR_API_KEY ``` Paste this prompt into your coding agent: ```text title="Prompt" Read https://www.socialcrawl.dev/docs/recipes/post-numbers-into-a-sheet.md and follow it to refresh the numbers of the post links in posts.txt. Use the key in SOCIALCRAWL_API_KEY. Price the call with a dry run first and show me the hold. Send at most 100 links a call, and stop and ask me before a morning's calls pass 200 credits a run. ``` Or price the call yourself. A dry run quotes it for 0 credits: ```bash title="cURL" curl -X POST "https://www.socialcrawl.dev/v1/prism/post-stats" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ -H "content-type: application/json" \ -d '{"urls": ["https://www.tiktok.com/@nasa/video/7710449624397450509", "https://www.youtube.com/watch?v=224QFgY9PTM", "https://www.instagram.com/p/Df3Rp0bKNdr/"], "dry_run": true}' ``` ## How it works - `prism/post-stats` takes a list of post links from any mix of platforms. - It reads each post and returns its numbers in `data.results`, in the order you sent them. - Each link is billed at its own platform's rate, and a link that fails is refunded. - The call holds the worst case up front and refunds the rest when it ends. - Run it each morning and add a dated row per post. The rows over time are the chart. ## What you need | Call | What it gives | Credits | | --- | --- | --- | | `POST /v1/prism/post-stats` | Views, likes, comments, shares and saves for up to 100 posts | 1 a post, 2 on Instagram, 5 on LinkedIn | | `POST /v1/prism/post-stats` with `"dry_run": true` | The hold for the same links | 0 | | A Google Sheet with Apps Script | The rows and the chart | Free | ## Steps ### Step 1: send your links **cURL** ```bash title="cURL" curl -X POST "https://www.socialcrawl.dev/v1/prism/post-stats" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ -H "content-type: application/json" \ -d '{"urls": ["https://www.tiktok.com/@nasa/video/7710449624397450509", "https://www.youtube.com/watch?v=224QFgY9PTM", "https://www.instagram.com/p/Df3Rp0bKNdr/"]}' ``` **Python** ```python title="Python" import json, os, urllib.request body = {"urls": ["https://www.tiktok.com/@nasa/video/7710449624397450509", "https://www.youtube.com/watch?v=224QFgY9PTM"]} req = urllib.request.Request( "https://www.socialcrawl.dev/v1/prism/post-stats", data=json.dumps(body).encode(), headers={"x-api-key": os.environ["SOCIALCRAWL_API_KEY"], "content-type": "application/json"}, ) page = json.load(urllib.request.urlopen(req, timeout=180)) for r in page["data"]["results"]: print(r["url"], r["status"], r["engagement"]["views"], r["engagement"]["likes"]) ``` - Each result has the link, its `status` (`ok`, `not_found` or `unsupported`) and its `engagement`. - `data.summary.credits_charged` is what the whole call cost. ```json title="Response (trimmed)" { "data": { "results": [ { "url": "https://www.tiktok.com/@nasa/video/7710449624397450509", "status": "ok", "engagement": { "views": 53000, "likes": 2174, "comments": 289 }, "cost": 1 } ], "summary": { "total": 10, "ok": 10, "credits_charged": 14, "credits_refunded": 0 } } } ``` ### Step 2: put the sheet to work In Google Sheets, open Extensions, then Apps Script. Paste the [SocialCrawl script](/blueprints/google-sheets/Code.gs) over `Code.gs`, save, and reload the sheet. A SocialCrawl menu appears. - Choose Set API key and paste your key. It is kept in your own user properties, which other editors of the sheet cannot read. - Put one post link a row in column A of a tab named Posts, under a header. - Choose Refresh post numbers. Each post gets a dated row in the Post numbers tab. - Choose Refresh every morning to run it daily at about 08:00 in the script's time zone. ### Step 3: chart it Select the Post numbers tab and choose Insert, then Chart. Put the read time on the X axis and views on the Y axis, with one series per post. For a dashboard, add the sheet as a Google Sheets source in Looker Studio. ## Store only what is new - The numbers change, so keep every reading. Each refresh adds rows and replaces none. - Key a reading on the post link and the read time together. - A post that is deleted or made private comes back as `not_found` and costs nothing. Leave it in the list, or remove its link. - Instagram reports no view count on photo posts, so `views` is empty there. ## What it costs Each post costs its platform's rate: 1 credit on most platforms, 2 on Instagram and 5 on LinkedIn. The [roster](/docs/endpoint-pricing.md) lists every price. What the runs measured on 23/11/2026: | Run | Posts | Credits | | --- | --- | --- | | The dry run | 10 | 0 (it holds 14) | | Four Instagram, three TikTok, three YouTube | 10 | 14 | | The sheet's refresh, TikTok, YouTube and Instagram | 3 | 4 | A sheet of 100 TikTok posts refreshed every morning costs about 100 credits a day. ## Run this every day The sheet's morning refresh is the schedule. A Monitor re-runs only GET requests, so it cannot hold this batch call. When every post comes from one account, a numbers-only Monitor keeps the same numbers for you. Price it with a dry run, which creates nothing: ```bash title="cURL" curl -X POST "https://www.socialcrawl.dev/v1/monitors?dry_run=1" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ -H "content-type: application/json" \ -d '{"recipe": "tiktok/profile/videos", "params": {"handle": "nasa"}, "cadence": "daily", "track": {"metrics": ["items[].post.engagement.views", "items[].post.engagement.likes"]}}' ``` - On 23/11/2026 this quoted 2 credits a run: the page and 1 scheduling credit. - It stores views and likes per video every day. Download them as a CSV from the Monitor's export. - The answer carries `would_be_refused` when your plan has no free Monitor slot. ## Tips, and what not to use - Send links, not handles. This call reads known posts. To find an account's new posts, use [Track a list of accounts](/docs/recipes/track-a-list-of-accounts.md). - Make a key for the sheet alone. You can then revoke it without touching anything else. - Keep a shared copy of the sheet private to people you trust. Each editor sets their own key. - Refresh once a day. Views on a post a week old change slowly, and each refresh is billed. ## Copy it - [Get a free key](/auth/register?utm_source=docs&utm_medium=playbook&utm_campaign=post-numbers-into-a-sheet): New accounts start with free credits. No card needed. - [Sheets script](/blueprints/google-sheets/Code.gs): The SocialCrawl menu for Google Sheets: post numbers, list jobs, comments and search. - [Google Sheets guide](/docs/integrations/google-sheets.md): Every menu item, the quotas and the key. ## Full program and agent brief **Full program (Python)** ```python title="Python" # post_numbers.py: refresh the numbers of every link in posts.txt into post_numbers.csv. # Run: SOCIALCRAWL_API_KEY=... python3 post_numbers.py (Python 3.9+, nothing to install) import csv import datetime import json import os import time import urllib.error import urllib.request KEY = os.environ["SOCIALCRAWL_API_KEY"] URL = "https://www.socialcrawl.dev/v1/prism/post-stats" LINKS = [line.strip() for line in open("posts.txt") if line.strip().startswith("http")] OUT = "post_numbers.csv" def post_stats(urls): data = json.dumps({"urls": urls}).encode() for attempt in range(6): req = urllib.request.Request(URL, data=data, headers={"x-api-key": KEY, "content-type": "application/json"}) try: with urllib.request.urlopen(req, timeout=180) as res: return json.load(res) except urllib.error.HTTPError as err: if err.code == 402: raise SystemExit(json.load(err)["error"]["message"]) # never retry a 402 if err.code not in (429, 503) or attempt == 5: raise time.sleep(int(err.headers.get("Retry-After", "2"))) now = datetime.datetime.now(datetime.timezone.utc).isoformat() new_file = not os.path.exists(OUT) spent = 0 with open(OUT, "a", newline="") as f: out = csv.writer(f) if new_file: out.writerow(["read_at", "url", "views", "likes", "comments", "status"]) for i in range(0, len(LINKS), 100): # 100 links a call page = post_stats(LINKS[i : i + 100]) spent += page["data"]["summary"]["credits_charged"] for r in page["data"]["results"]: e = r.get("engagement") or {} out.writerow([now, r["url"], e.get("views"), e.get("likes"), e.get("comments"), r["status"]]) print(f"{len(LINKS)} posts read, {spent} credits") ``` **Agent brief** ```text title="Agent brief" Goal: a dated row of views, likes and comments for each post link, every morning. Read https://www.socialcrawl.dev/docs/recipes/post-numbers-into-a-sheet.md first. 1. Send POST /v1/prism/post-stats with up to 100 links and "dry_run": true in the body. Show me the hold. 2. Send the same body without dry_run. Write one row per result with the read time. 3. Keep every reading. Never overwrite an earlier row. 4. Stop and ask me before a morning's calls pass 200 credits. ``` ## Next steps - [Google Sheets](/docs/integrations/google-sheets.md): The SocialCrawl menu in a sheet, step by step. - [Track a list of accounts](/docs/recipes/track-a-list-of-accounts.md): The new posts of a list of accounts, every morning. - [Batch endpoints](/docs/batch.md): Many links in one request.