Skip to main content
The Oumla TypeScript SDK provides a type-safe, easy-to-use interface for interacting with the Oumla API. This reference documents all available SDK methods organized by resource.
Two Ways to Use Oumla: You can interact with Oumla either through our TypeScript SDK (documented here) or through direct REST API calls (see API Reference). Both methods provide the same functionality - choose the one that best fits your project. The SDK is recommended for TypeScript/JavaScript projects as it provides type safety and better developer experience.

Installation

npm install @oumla/sdk
or
yarn add @oumla/sdk
or
pnpm add @oumla/sdk

Quick Start

import { OumlaSdkApiClient, OumlaSdkApiEnvironment } from '@oumla/sdk';

const client = new OumlaSdkApiClient({
  environment: OumlaSdkApiEnvironment.Sandbox,
  apiKey: 'your-api-key-here'
});
Get your API key from the dashboard.

SDK Resources

The SDK is organized into the following resource modules:

Type Safety

The SDK provides full TypeScript support with comprehensive type definitions:
import type { CreateProfileRequest, CreateProfileResponse } from '@oumla/sdk';

const request: CreateProfileRequest = {
  reference: 'user-123',
  type: 'User'
};

const response: CreateProfileResponse = await client.profiles.create(request);

Error Handling

All SDK methods throw typed errors that you can catch and handle:
import { OumlaSdkApiError } from '@oumla/sdk';

try {
  const profile = await client.profiles.create({ reference: 'user-123', type: 'User' });
} catch (error) {
  if (error instanceof OumlaSdkApiError) {
    console.error('API Error:', error.statusCode, error.message);
    // Handle specific error codes
    if (error.statusCode === 401) {
      // Authentication error
    }
  }
}

Environments

The SDK supports multiple environments:
import { OumlaSdkApiEnvironment } from '@oumla/sdk';

// Sandbox environment (for testing)
const sandboxClient = new OumlaSdkApiClient({
  environment: OumlaSdkApiEnvironment.Sandbox,
  apiKey: 'your-sandbox-api-key'
});

// Production environment
const productionClient = new OumlaSdkApiClient({
  environment: OumlaSdkApiEnvironment.Production,
  apiKey: 'your-production-api-key'
});

// Custom base URL
const customClient = new OumlaSdkApiClient({
  baseUrl: 'https://custom-api.example.com',
  apiKey: 'your-api-key'
});

Request Options

All SDK methods accept optional request options:
const profile = await client.profiles.create(
  { reference: 'user-123', type: 'User' },
  {
    timeoutInSeconds: 30,
    maxRetries: 3,
    apiKey: 'override-api-key', // Override default API key
    headers: { 'Custom-Header': 'value' }
  }
);

Next Steps