Skip to content

Profile persistence

When an interact call succeeds, FairCrawl can return a profile_id. Reuse that value on the next call to keep cookies, local storage, and the broader browser session state.

Common pattern

  1. call /interact to log in or establish a session
  2. save the returned profile_id
  3. issue a second /interact call with that same profile_id
  4. extract the protected page or continue the workflow
const login = await fc.interact({
url: "https://example.com/login",
actions: [
{ type: "fill", selector: "#email", value: "user@example.com" },
{ type: "fill", selector: "#password", value: "super-secret" },
{ type: "click", selector: 'button[type="submit"]' },
{ type: "wait_for_selector", selector: ".dashboard", timeout_ms: 10000 },
],
});
const followup = await fc.interact({
url: "https://example.com/settings",
profile_id: login.profile_id,
actions: [{ type: "extract", format: "markdown" }],
});

Session-establishing request

```bash curl https://api.faircompany.ai/v1/crawl/interact \ -X POST \ -H "Authorization: Bearer fc_live_xxx" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/login", "actions": [ { "type": "fill", "selector": "#email", "value": "user@example.com" }, { "type": "fill", "selector": "#password", "value": "super-secret" }, { "type": "click", "selector": "button[type=\"submit\"]" }, { "type": "wait_for_selector", "selector": ".dashboard", "timeout_ms": 10000 }, { "type": "extract", "format": "markdown" } ] }' ```