DocumentationAPI ReferenceReact SDKRelease Notes
ScaleAI

Getting Started

OverviewInstallationQuick Start

Core

Provider & Setup

Hooks

AgentsOutbound CallsCall HistoryPhone NumbersIntegration CredentialsWebhooksKnowledge BasesFunction ToolsFunction Logs

Realtime

Realtime

UI

Components

Reference

TypesUtilities
Go to platform

Installation

Install the ScaleAI React SDK from AWS CodeArtifact and configure your package manager.

The ScaleAI React SDK is published as @scalereal/sr-voice-engine-react-sdk in a private AWS CodeArtifact npm repository. Ask your ScaleAI administrator for the CodeArtifact domain, repository, AWS account ID, and region, and for AWS credentials with read access to the repository.

Requirements

  • React 18 or 19 in a client-rendered web application. In Next.js, the SDK must render inside a Client Component.
  • The AWS CLI v2, configured with an AWS identity that can read from the CodeArtifact repository and obtain an authorization token. With npm 10 or later, AWS CLI 2.9.5 or later is required by aws codeartifact login.
  • The CodeArtifact domain, repository, AWS account ID, and region provided by your ScaleAI administrator. Omit --domain-owner if your AWS identity belongs to the domain-owning account.
  • A ScaleAI project ID and SecretKey — you'll need these in the Quick Start.

Authenticate with CodeArtifact

Sign in to AWS using your organization's approved method (for example, an AWS CLI profile or SSO session). Then run the CodeArtifact login command, replacing the placeholders with the values provided by your administrator:

aws codeartifact login \
  --tool npm \
  --domain <domain> \
  --domain-owner <aws-account-id> \
  --repository <repository> \
  --region <region>

This obtains a short-lived authorization token and configures your user-level npm settings. The token is valid for 12 hours by default; run the login command again when it expires. Avoid committing generated credentials or tokens to your project.

The login command configures the default npm registry. If your project needs the public npm registry for other packages, configure CodeArtifact as a scope registry in .npmrc instead, using the repository endpoint and a token obtained through your approved AWS authentication flow. The CodeArtifact endpoint must end with /.

For Yarn Berry (v2+), use the CodeArtifact endpoint and a refreshed authorization token in .yarnrc.yml according to AWS's Yarn configuration. Yarn Classic can use the npm configuration written by aws codeartifact login.

In CI/CD, authenticate the job to AWS with your organization's approved role or federated identity, then run aws codeartifact login before installing dependencies. Do not store a CodeArtifact authorization token as a long-lived secret; it expires and must be refreshed.

Install the package

After authenticating, run the install command for your package manager:

pnpm add @scalereal/sr-voice-engine-react-sdk

Import the stylesheet

When using any SDK UI component, import the stylesheet once from your application's entry point:

src/main.tsx (Vite) or app/layout.tsx (Next.js)
import "@scalereal/sr-voice-engine-react-sdk/css";

Headless hooks do not require the stylesheet. The SDK CSS is scoped to its own components and will not bleed into your application's styles. See Components and styling for theming and class overrides.

Package entry points

Choose the most specific entry point for your use case to keep your bundle lean.

ImportUse when
@scalereal/sr-voice-engine-react-sdkCore entry point — CallingAgentProvider, useCallingAgent, CallingAgentError, config, typed models, custom-attribute filters, and CSV/PDF/formatting helpers. No stylesheet.
@scalereal/sr-voice-engine-react-sdk/uiApps that render SDK components. Import the /css stylesheet once alongside it.
@scalereal/sr-voice-engine-react-sdk/hooksHeadless integration — data, realtime, and behavior hooks plus query keys. No stylesheet and no audio player.
@scalereal/sr-voice-engine-react-sdk/typesType-only domain models with zero runtime code.
@scalereal/sr-voice-engine-react-sdk/cssStylesheet import. Must be imported in your entry file, not inside a component.

Troubleshooting

401 Unauthorized during install

A 401 error means the registry could not authenticate your AWS identity. Check the following:

  1. Your AWS CLI session or profile is active and uses the expected account and region.
  2. Your AWS identity has permission to read from the CodeArtifact repository and obtain an authorization token.
  3. The authorization token has not expired. Run aws codeartifact login again to refresh it.
  4. The login command uses the correct CodeArtifact domain, repository, domain owner, and region.

Package not found

Confirm that the SDK package has been published to the repository you authenticated against and that the repository is configured to serve the @scalereal namespace. Ask your ScaleAI administrator to verify the package and your repository read permissions.

Next steps

Continue with the Quick Start to render a call history list in Vite or Next.js.

Overview

Build on ScaleAI with the @scalereal/sr-voice-engine-react-sdk package — typed data hooks, realtime hooks, and drop-in UI components.

Quick Start

Quick start guide on setting up the ScaleAI React SDK on your project.

On this page

RequirementsAuthenticate with CodeArtifactInstall the packageImport the stylesheetPackage entry pointsTroubleshooting401 Unauthorized during installPackage not foundNext steps