# Bubble (/docs/integrations/bubble) Pull social media data into Bubble without writing a server. You can call SocialCrawl from a Bubble app with the API Connector. A call you define there becomes a data source or a workflow action. Setup takes four steps: add the call, mark the key private, initialize it, use it. ## Before you start Create an API key in the dashboard under API Keys. In the API Connector, mark the key's header value private. Bubble ships any value that is not private inside your app's code. Never leave the real key in a test value you have not made private. Prove the key with a call that costs nothing: ```bash title="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 Add a call in the API Connector and set these fields: | Field | Value | | ------- | ------------------------------------------------------ | | Method | `GET` | | URL | `https://www.socialcrawl.dev/v1/tiktok/profile/videos` | | Header | `x-api-key` = your key, with Private ticked | | Param | `handle` = `mrbeast` | Then initialize the call. Initialization sends one real request and reads the response, and until it runs the call does not appear in the editor. Change the path and the parameters to call any other endpoint. ## 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. ```json title="Response (trimmed)" { "success": true, "data": { "items": [{ "id": "7654638524729216287" }] }, "pagination": { "next_cursor": "sc.eyJ2Ijoy…", "has_more": true }, "credits_used": 1, "credits_remaining": 99 } ``` To read the next page, send `next_cursor` back as the `cursor` parameter, and stop when `has_more` is `false`. See [Pagination](/docs/pagination.md). ## When it stops Tick **Include errors in response and allow workflow actions to continue** on the call, then initialize it again, because the option changes the response format. A refused call no longer stops the workflow. The error object carries a status code, a status message and the body. Show it in an alert. When credits run out, the status is 402 and `error.type` is `INSUFFICIENT_CREDITS`. Read `error.message` for the text and `error.details.checkout_url` for the link that opens checkout. When the link is absent, `error.details.top_up_url` opens the billing page. 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](/docs/errors.md). ## What a run costs It depends on the endpoint, and some endpoints are priced by what they return. [Endpoint pricing](/docs/endpoint-pricing.md) lists each one, and [Credits](/docs/credits.md) explains cache hits and refunds. A data source on a page calls the API for every visitor who opens it. `GET /v1/utility/estimate` quotes a call for 0 credits. - [Errors](/docs/errors.md): Every error code, with the fix and whether to retry. - [Authentication](/docs/authentication.md): Where the key goes and where it must never go. - [Endpoint pricing](/docs/endpoint-pricing.md): What each endpoint costs before visitors trigger it.