Skip to main content

Initialize Client

Connect to the SCP API and authenticate. This is required before using other cookbook recipes.



Interactive Demo​

Connect
Login
Ready

Development Environments​

Choose your development environment:

EnvironmentURLUse Case
Local Dockerhttp://localhost:4000 or http://localhost:7000Local development with full control
Iteration Stackhttps://iteration.service-commerce-platform.alvera.aiShared development environment on AWS Lightsail

Code Reference​

Install the SDK​

# Generate SDK from OpenAPI spec
npx openapi-typescript-codegen \
--input http://localhost:4000/api/openapi \
--output ./generated \
--name ScpClient

# Or use the pre-built SDK package
npm install @scp/sdk

Authenticate​

import { OpenAPI, AuthenticationService } from '@scp/sdk';

// Configure the base URL
OpenAPI.BASE = 'http://localhost:4000';

// Authenticate and get token
const authResponse = await AuthenticationService.scpApiSessionControllerCreate({
requestBody: {
email: '[email protected]',
password: 'DevPassword123!',
tenant_name: 'alvera-scp-dev',
},
});

// Set the token for all subsequent requests
OpenAPI.TOKEN = authResponse.token;

console.log('Authenticated as:', authResponse.user.email);

Next Steps​

  1. Merchant Onboarding - Create merchant organization and location
  2. Service Manager - Manage service categories