# Browser profiles

> Keep a site's login in an encrypted profile, log in by hand in a live browser, and scrape, crawl and run browser jobs logged in.

A **browser profile** keeps a login for the browser: its cookies, each site's `localStorage` and IndexedDB, stored encrypted (AES-256-GCM), and the same user agent, locale, time zone, viewport and residential IP country on every run, so the site keeps seeing the same device. Scrapes, crawls, browser jobs and [skills jobs](/docs/social-skills) that name a profile start logged in, and save the login they end with, so refreshed tokens stay valid.

## Create a profile

```bash
curl https://api.hoshime.com/v1/browser/profiles \
  -H "Authorization: Bearer $HOSHIME_TOKEN" \
  -d '{"name": "Shop admin", "country": "US"}'
```

`country` routes every run of the profile through one residential IP in that country. `saveChanges` (on by default) keeps the login each run ends with; turn it off to start every run from the saved login. A profile's login is never returned by the API.

## Save a default tunnel

In **Browser profiles**, open a profile and click **Edit**. Under **Default tunnel**, select a tunnel and save the profile.

The default applies to live logins, browser jobs, skills, scrapes, crawls, and social API calls that use the profile. You can select another tunnel for a single run. If the selected tunnel is offline, the run fails.

To set the default with the API, send `{"tunnel":"m1"}` in a `PATCH /v1/browser/profiles/{profileId}` request. Send an empty string to clear the default.

## Log in

Pick one of three ways.

**By hand in a live browser.** It works for any login: passwords, 2FA codes, passkeys on the person's phone, captchas.

```bash
curl https://api.hoshime.com/v1/browser/live \
  -H "Authorization: Bearer $HOSHIME_TOKEN" \
  -d '{"profileId": "bpr_…", "url": "https://shop.example.com/login"}'
```

The answer holds `liveUrl`. Whoever opens it sees the browser, logs in and presses **Save login**; the profile then holds that login. The session stays open for `maxSeconds` (600 by default, up to 840) and bills 50 units per started minute it was open, at least 50, when it ends. Follow it with `GET /v1/browser/live/{liveSessionId}` until `status` is `saved`, or close it with `POST /v1/browser/live/{liveSessionId}/stop`. Set the profile's default tunnel to use your own machine for this and later runs. You can also pass `"tunnel": "home"` for a single login. See [Tunnels](/docs/tunnels). In the dashboard, **Browser profiles › Log in** does the same.

**Import cookies** exported from a browser where you are logged in: a JSON list from Cookie-Editor, EditThisCookie, DevTools or Puppeteer, a Playwright `storageState`, or a Netscape `cookies.txt`.

```bash
curl https://api.hoshime.com/v1/browser/profiles/bpr_…/state \
  -H "Authorization: Bearer $HOSHIME_TOKEN" \
  --data-binary @- <<'JSON'
{"data": "[{\"name\":\"session\",\"value\":\"…\",\"domain\":\".shop.example.com\"}]", "merge": true}
JSON
```

**Import directly from Chrome or Brave.** Install yt-dlp so the hoshime CLI can read cookies from your local browser. [yt-dlp installation guide](https://github.com/yt-dlp/yt-dlp/wiki/Installation)

```bash
hoshime profile import --from-browser chrome --domain example.com --save-as "Shop"
hoshime profile import --from-browser "brave:Work" --domain example.com --save-as "Shop Work"
```

`brave:Work` selects the local Brave profile named Work. With just `chrome` or `brave`, yt-dlp selects the most recently accessed profile. The CLI uploads cookies for the specified domain and its subdomains. Repeat `--domain` for additional sites.

`--save-as` creates a hoshime profile or saves to the existing profile with that name. Use `--merge` to keep the profile's other cookies and storage. If several hoshime profiles share the name, run `hoshime profile list` and select the ID with `--profile`.

The key `hoshime login` creates has access to your browser profiles. To use a dashboard key, give it the `browser:read` and `browser:write` scopes and save it with `hoshime login --with-key`.

To import an existing export, pass the file path or use `-` for standard input.

**With a browser job** that types the password and the 2FA code itself. Store the password and the TOTP secret (the setup key an authenticator app takes) as env variables, then write `{{env.NAME}}` and `{{totp.NAME}}` in the steps:

```json
{
  "browser": {
    "url": "https://shop.example.com/login",
    "profileId": "bpr_…",
    "env": ["SHOP_PASSWORD", "SHOP_TOTP"],
    "actions": [
      { "type": "fill", "selector": "#email", "text": "ops@example.com" },
      { "type": "fill", "selector": "#password", "text": "{{env.SHOP_PASSWORD}}" },
      { "type": "click", "selector": "button[type=submit]" },
      { "type": "fill", "selector": "#otp", "text": "{{totp.SHOP_TOTP}}" },
      { "type": "press", "key": "Enter" },
      { "type": "waitForUrl", "urlPattern": "/dashboard" }
    ]
  }
}
```

## Use it

Add `profileId` to a scrape, to a crawl's `request` or to a browser job:

```bash
curl https://api.hoshime.com/v1/browser/scrape \
  -H "Authorization: Bearer $HOSHIME_TOKEN" \
  -d '{"url": "https://shop.example.com/orders", "profileId": "bpr_…"}'
```

A request with a profile renders in the browser (`engine` `auto` or `browser`), and takes the proxy from the profile: leave `proxy` and `country` unset. When two runs of a profile overlap, the one that saves first wins and the other's login is not written over it.

### Call endpoints logged in

Every public data endpoint takes `profileId` too. The call sends the profile's cookies, so the platform answers as that account, and leaves through the profile's own residential IP so the platform sees the address it logged in from. Add `tunnel` or `proxy` to leave through your machine or your proxy instead.

```bash
curl "https://api.hoshime.com/v1/instagram/profile?username=nasa&profileId=bpr_…" \
  -H "Authorization: Bearer $HOSHIME_TOKEN"
```

It needs an API key with `browser:read` as well as `social:read`. Such calls are never cached and use the profile's login without changing it. A platform may limit or lock an account that reads too much, so keep the pace of a person, and only use accounts you own: data read logged in is for your use only.

`DELETE /v1/browser/profiles/{profileId}/state` logs a profile out; deleting the profile deletes its login.

## In MCP

The MCP server has `browser_list_profiles`, `browser_create_profile`, `browser_import_cookies`, `browser_start_login` (it answers the `liveUrl` the assistant hands you) and `browser_get_login`, and `browser_scrape` and `call_endpoint` take `profileId`. See [MCP](/docs/mcp).