Skip to main content
@run-cloud/sdk is the API-key client for iOS simulator sessions, Android emulator sessions, microVM sandboxes, snapshots, account state, and reusable app assets. It requires Node.js 20 or newer. See the latest SDK reference for the complete class, method, option, and response-type index.

Install

Authenticate

Create an API key in the run.cloud dashboard, then expose it to the process that runs your application:
The client reads RUN_CLOUD_API_KEY automatically. You can also pass the key directly when your application loads secrets another way:
Set RUN_CLOUD_API_URL or pass apiUrl to use a non-default API host. Do not put API keys in source code, browser bundles, logs, or committed environment files.

Run the complete example

The runnable example checks account access, creates iOS and Android sessions, opens a URL on each platform, and releases both sessions even when the run is interrupted or fails:
See newly-app/run-cloud-examples/sdk-ios-android for platform, codec, duration, and JSON-output options.

Create and release sessions

Use the platform client when the platform is known. Always release metered sessions in finally so a failed test does not leave them running:
cloud.ios and cloud.android both provide: The iOS client also provides:
  • screenshot(id), which returns PNG bytes as a Uint8Array.
  • uploadVideo(id, video, options), which accepts an MP4 or QuickTime Blob and imports it into Photos. The uploaded file remains in cloud.assets for reuse or deletion.
  • uploadMicrophoneAudio(id, audio, options), which accepts AAC, M4A, MP3, MP4-audio, or WAV and loops it through the foreground app’s microphone input. Pass bundleId when the intended app is not currently in front.
These methods are not currently available on cloud.android.

Use the generic simulator client

Use cloud.simulators when the platform is selected at runtime. Pass the session platform back to methods that operate on an existing session:
cloud.simulators.list() returns every platform unless platform is supplied. Other generic simulator lifecycle methods default to iOS when platform is omitted.

Check account state

Use account() before starting a larger test matrix when you want to surface access or organization information early:

Upload and reuse assets

Upload an artifact once, then reference its id from one or more sessions:
cloud.assets provides upload, list, and delete. Artifact contents must match the target platform: iOS needs a simulator-compatible build, while Android needs an Android-compatible artifact such as an APK.

Handle API errors

Non-successful responses throw RunCloudError with the HTTP status and the API detail: