# Website Logins API

Website logins are external site sessions that auth-required Browsable tasks can reuse.

## Endpoints

`GET /v1/website-logins` lists sanitized website login accounts.

`POST /v1/website-logins` starts a hosted login flow and returns an invocation to poll.

`DELETE /v1/website-logins/:id` deletes a website login account.

`GET /v1/website-logins/invocations/:id` polls a login invocation.

`DELETE /v1/website-logins/invocations/:id` cancels a login invocation.

`GET /v1/website-logins/location` reads the team auth location and sanitized proxy state.

`PATCH /v1/website-logins/location` sets or resets the team auth location.

## List Website Logins

```bash
curl "https://api-ingress-worker-staging.browsable-staging.workers.dev/v1/website-logins?domain=x.com" \
  -H "x-api-key: $BROWSABLE_API_KEY"
```

## Start Login Flow

```bash
curl -X POST "https://api-ingress-worker-staging.browsable-staging.workers.dev/v1/website-logins" \
  -H "x-api-key: $BROWSABLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"domain":"x.com","display_name":"Team X login"}'
```

Open the returned `hosted_url`, then poll `/v1/website-logins/invocations/:id` until the invocation
        reaches `SUCCESS` or `FAILED`.

## Delete Website Login

```bash
curl -X DELETE "https://api-ingress-worker-staging.browsable-staging.workers.dev/v1/website-logins/acct_123" \
  -H "x-api-key: $BROWSABLE_API_KEY"
```

## Set Location

```bash
curl -X PATCH "https://api-ingress-worker-staging.browsable-staging.workers.dev/v1/website-logins/location" \
  -H "x-api-key: $BROWSABLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"location":{"country_code":"US","region_code":"CA","city":"San Francisco"}}'
```

---
Source: https://browsable-api-ux-staging.pages.dev/docs/api/website-logins
