Environment Setup

This guide covers setting up a development environment for building integrations with the Otesse platform.

Environments

Otesse provides two environments:

EnvironmentAPI Base URLKey Prefix
Test (Sandbox)https://api.otesse.com/v1otessetestsk_
Productionhttps://api.otesse.com/v1otesselivesk_

The base URL is the same — the environment is determined by the API key you use.

Environment Variables

Store your credentials in environment variables. Never hardcode them:

# .env.local (add to .gitignore!)
OTESSE_API_KEY=otesse_test_sk_your_test_key_here
OTESSE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
OTESSE_API_BASE_URL=https://api.otesse.com/v1

Language-Specific Setup

Node.js / TypeScript

npm install node-fetch dotenv
import 'dotenv/config';

const OTESSE_API_KEY = process.env.OTESSE_API_KEY;
const BASE_URL = process.env.OTESSE_API_BASE_URL || 'https://api.otesse.com/v1';

async function otesseRequest(endpoint: string, options: RequestInit = {}) {
  const response = await fetch(`${BASE_URL}${endpoint}`, {
    ...options,
    headers: {
      'Authorization': `Bearer ${OTESSE_API_KEY}`,
      'Content-Type': 'application/json',
      ...options.headers,
    },
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(`Otesse API error: ${error.error.message}`);
  }

  return response.json();
}

// Usage
const customers = await otesseRequest('/customers');
console.log(customers);

Python

pip install requests python-dotenv
import os
import requests
from dotenv import load_dotenv

load_dotenv()

API_KEY = os.getenv('OTESSE_API_KEY')
BASE_URL = os.getenv('OTESSE_API_BASE_URL', 'https://api.otesse.com/v1')

def otesse_request(endpoint, method='GET', data=None):
    headers = {
        'Authorization': f'Bearer {API_KEY}',
        'Content-Type': 'application/json',
    }

    response = requests.request(
        method,
        f'{BASE_URL}{endpoint}',
        headers=headers,
        json=data,
    )

    response.raise_for_status()
    return response.json()

# Usage
customers = otesse_request('/customers')
print(customers)

Local Webhook Testing

For testing webhooks during development, use ngrok or a similar tunneling tool:

# Install ngrok
npm install -g ngrok

# Start your local server
node server.js  # listening on port 3000

# In another terminal, create a tunnel
ngrok http 3000

Copy the ngrok HTTPS URL and register it as a webhook endpoint in the Otesse dashboard.

Testing Checklist

Before going to production:

  • [ ] All API calls work with test keys
  • [ ] Webhook signature verification is implemented
  • [ ] Error handling covers all error types
  • [ ] Rate limit handling with exponential backoff
  • [ ] Token refresh flow works (if using OAuth)
  • [ ] Idempotency keys used for create operations
  • [ ] Sensitive data is not logged