> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.trykeet.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.trykeet.com/_mcp/server.

### You can use playwright or puppeteer to take actions on your users behalf

If you want to write your own automations using playwright to act on your users behalf you can do that by connecting to the playwright instance over CDP.

> **Note**
>
> Venmo is used here as an example but every integration offers the endpoint `POST: /session` to get a websocket url to
> connect via playwright or puppeteer.

#### Get a websocket url to connect to playwright

### Request

POST [https://api.trykeet.com/v1/venmo/session](https://api.trykeet.com/v1/venmo/session)

```curl
curl -X POST https://api.trykeet.com/v1/venmo/session \
     -H "X-Account-Token: X-Account-Token" \
     -H "Authorization: Bearer <token>"
```

```typescript
import { KeetClient } from "@keet-tech/keet-node-client";

const client = new KeetClient({ token: "YOUR_TOKEN", accountToken: "YOUR_ACCOUNT_TOKEN" });
await client.integrations.venmo.createSession();

```

```python
import requests

url = "https://api.trykeet.com/v1/venmo/session"

headers = {
    "X-Account-Token": "X-Account-Token",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.trykeet.com/v1/venmo/session"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-Account-Token", "X-Account-Token")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.trykeet.com/v1/venmo/session")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Account-Token"] = 'X-Account-Token'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.trykeet.com/v1/venmo/session")
  .header("X-Account-Token", "X-Account-Token")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.trykeet.com/v1/venmo/session', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'X-Account-Token' => 'X-Account-Token',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.trykeet.com/v1/venmo/session");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Account-Token", "X-Account-Token");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Account-Token": "X-Account-Token",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.trykeet.com/v1/venmo/session")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Response (200)

```json
{
  "status": "ok",
  "wsUrl": "wsUrl",
  "postSignInUrl": "postSignInUrl",
  "debuggerFullscreenUrl": "debuggerFullscreenUrl"
}
```

You can then use this `wsUrl` to connect to the playwright instance over CDP.

#### Connect to a playwright instance

```ts
const browser = await chromium.connectOverCDP(wsUrl)
const context = browser.contexts()[0]
const page = await context.newPage()
await page.goto("https://accounts.venmo.com")
// Your other automations here...
await browser.close()
```