> Documentation index: https://www.socialcrawl.dev/llms.txt > Every page is also available as Markdown by adding .md. # cURL for agents (/docs/agent-source-of-truth/curl) The calls to copy when an agent uses SocialCrawl from cURL, with a simple and a complex example for each This page is for an agent that writes SocialCrawl calls in cURL. Copy an example, change the values, and run it. Each family below shows one simple and one complex call. ## Install cURL ships with macOS, Linux and current Windows. There is nothing to install. The paging example reads the cursor with `sed`, which macOS and Linux have. ## Authenticate Send your key in the `x-api-key` header on every call. Keep it in `SOCIALCRAWL_API_KEY`, out of your code. ```bash title="Terminal" export SOCIALCRAWL_API_KEY=sc_your_key_here ``` Check the key with the balance call. It is free. ```bash title="Terminal" curl -s "https://www.socialcrawl.dev/v1/credits/balance" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" ``` ## When to use what Pick the call by the job. Every row links its section. The price of each call is on [Endpoint pricing](/docs/endpoint-pricing.md), and the other calls are in the [API reference](/docs/api-reference.md). | Job | Call | Section | | --- | --- | --- | | Read one account: name, followers, bio | `GET /v1/tiktok/profile` | [Get a profile](#get-a-profile) | | Read an account's recent posts, page by page | `GET /v1/tiktok/profile/videos` | [Get posts one page at a time](#get-posts-one-page-at-a-time) | | Ask one question of many platforms at once | `GET /v1/search/everywhere` | [Search many platforms](#search-many-platforms) | | Price any call before you send it | `GET /v1/utility/estimate` | [Price a call before you send it](#price-a-call-before-you-send-it) | ## Get a profile ### Why use it Use it to read one account. You send a handle and get the name, the follower count and the bio. Other platforms answer in the same shape, so you change the platform in the path and nothing else. ### Preferred call `GET /v1/tiktok/profile`. Pass `handle`. Add `counts=web` for the counts the website shows. ### Simple example One call, no error handling. ```bash title="Terminal" curl -s -G "https://www.socialcrawl.dev/v1/tiktok/profile" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "handle=charlidamelio" ``` ### Complex example Adds more params. With `--fail-with-body` curl exits with an error code on a failed call and still prints the answer, which names its `error.type`. ```bash title="Terminal" curl -sS --fail-with-body -G "https://www.socialcrawl.dev/v1/tiktok/profile" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "handle=charlidamelio" \ --data-urlencode "counts=web" ``` ### Parameters | Name | What it does | | --- | --- | | `handle` | TikTok username without the @ symbol. | | `user_id` | TikTok numeric user ID. | | `counts` | `app` (default) or `web`. | ## Get posts one page at a time ### Why use it Use it to read an account's recent videos. Each answer holds one page. To read the next page, send `pagination.next_cursor` back as `cursor`. Stop when `pagination.has_more` is false. ### Preferred call `GET /v1/tiktok/profile/videos`. Pass `handle`. Add `since` to stop at a date. ### Simple example One call, no error handling. ```bash title="Terminal" curl -s -G "https://www.socialcrawl.dev/v1/tiktok/profile/videos" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "since=2026-09-01" \ --data-urlencode "handle=charlidamelio" ``` ### Complex example Reads the first page, keeps its `pagination.next_cursor`, and sends it back as `cursor` for the second page. ```bash title="Terminal" CURSOR=$(curl -s -G "https://www.socialcrawl.dev/v1/tiktok/profile/videos" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "handle=charlidamelio" \ | sed -n 's/.*"next_cursor":"\([^"]*\)".*/\1/p') curl -s -G "https://www.socialcrawl.dev/v1/tiktok/profile/videos" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "handle=charlidamelio" \ --data-urlencode "cursor=$CURSOR" ``` ### Parameters | Name | What it does | | --- | --- | | `handle` | TikTok username without the @ symbol | | `user_id` | TikTok user id. | | `since` | Only videos published on or after this date: YYYY-MM-DD (midnight UTC) or an ISO 8601 timestamp. | | `cursor` | The `pagination.next_cursor` of the page before. Leave it out for the first page. | ## Search many platforms ### Why use it Use it to ask one question of many platforms in one call. Send it with `dry_run=1` first. A dry run creates nothing, costs nothing and returns the estimate. ### Preferred call `GET /v1/search/everywhere`. Pass `query`. Narrow it with `period` and `sources`. ### Simple example One call, no error handling. ```bash title="Terminal" curl -s -G "https://www.socialcrawl.dev/v1/search/everywhere" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "query=kanye west" \ --data-urlencode "dry_run=1" ``` ### Complex example Adds more params. With `--fail-with-body` curl exits with an error code on a failed call and still prints the answer, which names its `error.type`. ```bash title="Terminal" curl -sS --fail-with-body -G "https://www.socialcrawl.dev/v1/search/everywhere" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "query=kanye west" \ --data-urlencode "period=last_month" \ --data-urlencode "sources=reddit,youtube" \ --data-urlencode "dry_run=1" ``` ### Parameters | Name | What it does | | --- | --- | | `query` | The phrase to search on every platform, 1 to 512 characters. | | `period` | A window by name: `Nd` for the last N days, `yesterday`, `last_week`, `last_month`, `this_year` and more. | | `sources` | Optional CSV allowlist of sources (mutually exclusive with exclude). | | `dry_run` | Send `1` to price the search without running it. Free. | ## Price a call before you send it ### Why use it Use it to learn what a call costs before you make it. You name the endpoint and its params. The answer is the price. The call is free. ### Preferred call `GET /v1/utility/estimate`. Pass `id` as `platform/resource`, and `params` as a query string. ### Simple example One call, no error handling. ```bash title="Terminal" curl -s -G "https://www.socialcrawl.dev/v1/utility/estimate" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "id=tiktok/post/comments" \ --data-urlencode "params=url=https://www.tiktok.com/@stoolpresidente/video/7623818255903329566&label=spam" ``` ### Complex example Adds more params. With `--fail-with-body` curl exits with an error code on a failed call and still prints the answer, which names its `error.type`. ```bash title="Terminal" curl -sS --fail-with-body -G "https://www.socialcrawl.dev/v1/utility/estimate" \ -H "x-api-key: $SOCIALCRAWL_API_KEY" \ --data-urlencode "id=tiktok/profile/videos" \ --data-urlencode "params=handle=charlidamelio" \ --data-urlencode "items=100" ``` ### Parameters | Name | What it does | | --- | --- | | `id` | The endpoint to price, as platform/resource (tiktok/post/comments) or its /v1 path, optionally with its query string. | | `params` | The endpoint's own params, as a URL-encoded query string (url=...&label=spam) or a JSON object. | | `items` | Rows you want. |