Skip to main content
The Uplink JavaScript SDK provides a Puppeteer/Playwright-like API for controlling mobile browsers remotely. This reference covers all available classes, methods, and types.
Key terminology:
  • Device: A physical iOS or Android device
  • Worker: A worker created using the native Uplink SDK (a device can create multiple workers)
  • Address: A hex-encoded identifier used to reference specific workers

Installation

npm install @uplink-code/uplink

Optional: AI Automation

For AI-powered browser automation with natural language instructions:
npm install @uplink-code/ai
See the AI Automation section for details.

Quick example

import uplink from '@uplink-code/uplink'

const session = await uplink.session('<organization-api-key>', {
  projectId: '<project-id>',
  include: { ecdsa: true, ecdh: true }
})
const client = await uplink.client.fromSession(session)
const browser = await client.launch()
const page = await browser.newPage()

await page.goto('https://example.com')
const title = await page.evaluate(() => document.title)

await browser.close()
await client.close()

API structure

The SDK is organized into four main classes, plus an optional AI automation package:

TypeScript support

The SDK is written in TypeScript and includes full type definitions:
import type { Page, Cookie, Request } from '@uplink-code/uplink/page/types'
import type { Client } from '@uplink-code/uplink/client/types'
import type { Browser } from '@uplink-code/uplink/browser/types'
import type { Agent, ActResult, ExtractResult } from '@uplink-code/ai'

Error handling

All async methods can throw errors. Always use try-catch for robust automation:
try {
  await page.goto('https://example.com')
} catch (error) {
  console.error('Navigation failed:', error)
}

Common patterns

Connection and cleanup

const session = await uplink.session('<organization-api-key>', {
  projectId: '<project-id>',
  include: { ecdsa: true, ecdh: true }
})
const client = await uplink.client.fromSession(session)

try {
  const browser = await client.launch()
  const page = await browser.newPage()

  // Your automation here

} finally {
  // Always clean up
  await page.close()
  await browser.close()
  await client.close()
}

Waiting for workers

const session = await uplink.session('<organization-api-key>', {
  projectId: '<project-id>',
  include: { ecdsa: true, ecdh: true }
})
const client = await uplink.client.fromSession(session)

// Check currently connected workers
const workers = client.workers()
console.log(`${workers.length} workers connected`)

// Or handle workers as they connect
client.on('worker-connected', async (worker) => {
  console.log('Worker connected:', worker.address)
  const browser = await worker.launch()
  // ... automation
})

Multi-page automation

const browser = await client.launch()

const page1 = await browser.newPage()
const page2 = await browser.newPage()

await Promise.all([
  page1.goto('https://example.com'),
  page2.goto('https://google.com')
])

Next steps