SocialCrawl

Use SocialCrawl with Bolt

Pull social media data into Bolt without writing a server.

You can build an app in Bolt that shows SocialCrawl data. A server route makes the call with the key from an environment variable, so the browser never sees it. Setup takes three steps: add the variable, send the prompt, test the app.

Before you start

Create an API key in the dashboard under API Keys. Bolt keeps environment variables outside your code, either in a local .env file or in its Secrets menu. Add the key as SOCIALCRAWL_API_KEY, and never paste it into a prompt. Prove the key with a call that costs nothing:

Check the key (0 credits)
curl "https://www.socialcrawl.dev/v1/credits/balance" \
  -H "x-api-key: sc_your_key_here"

A reply with "success": true and your balance in data.balance means the key works.

Connect

Paste a prompt that names the endpoint and the rule about the key:

Prompt
Add a page that shows the 10 latest videos of a TikTok account. Create a
server route that calls https://www.socialcrawl.dev/v1/tiktok/profile/videos?handle=mrbeast
with the query parameter handle (default: mrbeast). Send the key in the
x-api-key header from the environment variable SOCIALCRAWL_API_KEY. Never
call SocialCrawl from the browser. Show the rows in data.items, and pass
the response status through to the page.

Change the endpoint and the field list to build another view. Browse the platform directory to find endpoints.

Read the answer

Every response has the same shape. Branch on success. A list puts its rows in data.items, and pagination.next_cursor is the token for the next page.

Response (trimmed)
{
  "success": true,
  "data": { "items": [{ "id": "7654638524729216287" }] },
  "pagination": { "next_cursor": "sc.eyJ2Ijoy…", "has_more": true },
  "credits_used": 1,
  "credits_remaining": 99
}

Ask Bolt for a Load more button that sends next_cursor back as cursor, and hides itself when has_more is false. See Pagination.

When it stops

The generated route should return the status it received, and the app should show a toast for a refused call.

When credits run out, the answer is a 402 with error.type set to INSUFFICIENT_CREDITS. Ask for the toast to show error.message and a link to error.details.checkout_url, which opens checkout. When the link is absent, error.details.top_up_url opens the billing page. A 401 means the key variable is not set, which is a different message.

Never retry a 402, because it fails until credits are added. Retry a 429 after the seconds in the Retry-After header, and a 502, 503 or 504 after a short backoff. See Errors.

What a run costs

It depends on the endpoint, and some endpoints are priced by what they return. Endpoint pricing lists each one, and Credits explains cache hits and refunds. Every visitor who opens the page triggers a call on your account unless you cache it. GET /v1/utility/estimate quotes a call for 0 credits.

On this page