Installation & Client Setup
Add the SDK package to your project and initialize the VTONClient.
1. Installation
Install the official snapit_sdk package from the NPM registry:
npm install snapit_sdk2. Environment Configuration
To use the SDK, you need an API key (`smd_live_...`) and your developer User ID, which you can obtain from the Developer Console.
Define the following environment variables in your project root `.env` file:
.env
SMD_API_KEY=smd_live_your_key_here
SMD_USER_ID=your_developer_user_id3. Initialize VTONClient
Initialize the client either by explicitly passing the API key, or let the SDK automatically load it from your environment variables.
TypeScript / JavaScript
import { VTONClient } from 'snapit_sdk';
// Option A: Explicit Configuration
const client = new VTONClient({
apiKey: 'smd_live_your_api_key_here',
// baseUrl: 'https://apisdk.snapmydesign.com/api/v1' // Optional base override
});
// Option B: Auto-load from Environment variables (process.env.SMD_API_KEY)
const clientFromEnv = new VTONClient();