API & Development min read Intermediate

Selgora API Authentication and Getting Started

# Selgora API Authentication and Getting Started Unlock the full potential of your creator platform through programmatic access. The Selgora API transforms your content management from manual tasks t...

By george.olah@code24.ro Sep 29, 2025 4 views

Selgora API Authentication and Getting Started

Unlock the full potential of your creator platform through programmatic access. The Selgora API transforms your content management from manual tasks to automated workflows, enabling sophisticated integrations that scale your business operations while maintaining the personal touch your audience expects.

Why API Integration Amplifies Creator Success

Success scales through automation. When you integrate Selgora's API with your existing tools and workflows, you eliminate repetitive tasks, synchronize customer data across platforms, and create seamless experiences that operate 24/7 without manual intervention.

The Integration Advantage

Workflow Automation: Connect Selgora with your favorite tools to create automated sequences that respond to customer actions, process data, and trigger personalized communications without manual oversight.

Data Synchronization: Keep customer information, purchase history, and engagement metrics synchronized across your entire tool ecosystem, enabling sophisticated marketing automation and customer success programs.

Custom Solutions: Build bespoke applications that leverage Selgora's infrastructure while adding unique functionality tailored to your specific business requirements and customer needs.

Understanding Selgora's API Architecture

RESTful Design Principles

Selgora's API follows REST (Representational State Transfer) conventions, making it intuitive for developers familiar with modern web APIs:

HTTP Methods:

  • GET: Retrieve data from Selgora
  • POST: Create new resources
  • PUT: Update existing resources
  • DELETE: Remove resources

Response Formats: All API responses use JSON format with consistent structure:

{
    "data": { /* resource data */ },
    "meta": { /* pagination, timestamps */ },
    "links": { /* related resources */ }
}

Status Codes: Standard HTTP status codes indicate request outcomes:

  • 200: Success
  • 201: Resource created successfully
  • 400: Bad request (validation errors)
  • 401: Authentication required
  • 403: Insufficient permissions
  • 404: Resource not found
  • 429: Rate limit exceeded
  • 500: Server error

Multi-Tenant Architecture

Each API request operates within your specific tenant (creator account) context, ensuring complete data isolation and security:

Tenant Identification: Your API key automatically identifies your tenant, eliminating the need for explicit tenant parameters in requests.

Data Isolation: All API operations respect tenant boundaries—you can only access and modify data within your own creator account.

API Authentication Methods

API Key Authentication

Primary Authentication Method: Selgora uses API key authentication for secure, straightforward access to your creator data.

Key Generation:

  1. Navigate to Settings → API Keys in your Selgora dashboard
  2. Click "Generate New API Key"
  3. Provide a descriptive name (e.g., "Zapier Integration", "Custom Dashboard")
  4. Copy the generated key immediately (it won't be shown again)
  5. Store securely in your application's environment variables

Authentication Header: Include your API key in the Authorization header of all requests:

Authorization: Bearer your-api-key-here

Rate Limiting and Security

Request Rate Limits:

  • Standard tier: 100 requests per minute
  • Premium tier: 500 requests per minute
  • Enterprise tier: 1000 requests per minute

Security Best Practices:

  • Store API keys in environment variables, never in code repositories
  • Use HTTPS for all API requests
  • Implement retry logic with exponential backoff for rate limit handling
  • Regularly rotate API keys for enhanced security

Core API Endpoints Overview

Contact Management API

Endpoint Base: /api/v1/contacts

Key Operations:

  • List all contacts with filtering and pagination
  • Create new contacts from external sources
  • Update contact information and custom fields
  • Manage contact tags and list memberships
  • Track contact activity and engagement

Example Request:

GET /api/v1/contacts?page=1&limit=50&tag=vip-customer
Authorization: Bearer your-api-key-here

List and Segment Management

Endpoint Base: /api/v1/lists and /api/v1/segments

Functionality:

  • Create and manage contact lists programmatically
  • Build dynamic segments based on behavior and attributes
  • Add/remove contacts from lists and segments
  • Export contact lists for external processing

Use Cases:

  • Synchronize email marketing lists with external ESPs
  • Create behavior-based segments for targeted campaigns
  • Automate list management based on purchase behavior

Custom Fields API

Endpoint Base: /api/v1/custom-fields

Operations:

  • Define custom contact fields for specific data collection
  • Update field values for individual contacts
  • Aggregate field data for analytics and reporting
  • Manage field visibility and organization

Business Applications:

  • Collect industry-specific customer information
  • Track customer preferences and interests
  • Store integration data from external systems

Authentication Examples in Popular Languages

JavaScript/Node.js

const axios = require('axios');

const selgoraApi = axios.create({
  baseURL: 'https://app.selgora.com/api/v1',
  headers: {
    'Authorization': `Bearer ${process.env.SELGORA_API_KEY}`,
    'Content-Type': 'application/json'
  }
});

// Example: Fetch contacts
async function getContacts() {
  try {
    const response = await selgoraApi.get('/contacts');
    return response.data;
  } catch (error) {
    console.error('API Error:', error.response.data);
    throw error;
  }
}

Python

import requests
import os

class SelgoraAPI:
    def __init__(self):
        self.base_url = 'https://app.selgora.com/api/v1'
        self.headers = {
            'Authorization': f'Bearer {os.getenv("SELGORA_API_KEY")}',
            'Content-Type': 'application/json'
        }

    def get_contacts(self, page=1, limit=50):
        response = requests.get(
            f'{self.base_url}/contacts',
            params={'page': page, 'limit': limit},
            headers=self.headers
        )
        response.raise_for_status()
        return response.json()

# Usage
api = SelgoraAPI()
contacts = api.get_contacts()

PHP

<?php

class SelgoraAPI {
    private $baseUrl = 'https://app.selgora.com/api/v1';
    private $apiKey;

    public function __construct($apiKey) {
        $this->apiKey = $apiKey;
    }

    public function getContacts($page = 1, $limit = 50) {
        $url = $this->baseUrl . '/contacts?page=' . $page . '&limit=' . $limit;

        $context = stream_context_create([
            'http' => [
                'method' => 'GET',
                'header' => [
                    'Authorization: Bearer ' . $this->apiKey,
                    'Content-Type: application/json'
                ]
            ]
        ]);

        $response = file_get_contents($url, false, $context);
        return json_decode($response, true);
    }
}

// Usage
$api = new SelgoraAPI($_ENV['SELGORA_API_KEY']);
$contacts = $api->getContacts();
?>

Common Integration Patterns

Webhook + API Combination

Reactive Data Processing: Use webhooks to receive real-time event notifications, then use API calls to retrieve detailed information and perform follow-up actions.

Example Workflow:

  1. Webhook receives "new_subscriber" event
  2. API call retrieves full subscriber details
  3. External system processes subscriber data
  4. API call updates subscriber with additional information

Batch Data Synchronization

Scheduled Sync Operations: Implement regular synchronization jobs that keep external systems aligned with your Selgora data.

Implementation Strategy:

  • Use API pagination to process large datasets efficiently
  • Implement incremental sync based on timestamps
  • Handle rate limits with appropriate delays
  • Include error handling and retry logic

Real-time Dashboard Creation

Custom Analytics Dashboards: Build specialized reporting interfaces that combine Selgora data with other business metrics.

Technical Approach:

  • Cache frequently accessed data to reduce API calls
  • Use efficient query patterns to minimize bandwidth
  • Implement real-time updates through webhooks
  • Create responsive interfaces for mobile and desktop access

Error Handling and Best Practices

Robust Error Handling

HTTP Status Code Handling:

async function handleApiCall(apiFunction) {
  try {
    return await apiFunction();
  } catch (error) {
    if (error.response) {
      switch (error.response.status) {
        case 401:
          throw new Error('Invalid API key - check authentication');
        case 403:
          throw new Error('Insufficient permissions for this operation');
        case 429:
          // Implement exponential backoff retry
          await new Promise(resolve => setTimeout(resolve, 1000));
          return handleApiCall(apiFunction);
        case 500:
          throw new Error('Server error - try again later');
        default:
          throw error;
      }
    }
    throw error;
  }
}

Pagination Handling

Efficient Data Retrieval:

async function getAllContacts() {
  let allContacts = [];
  let page = 1;
  let hasMore = true;

  while (hasMore) {
    const response = await selgoraApi.get('/contacts', {
      params: { page, limit: 100 }
    });

    allContacts.push(...response.data.data);
    hasMore = response.data.meta.has_more;
    page++;

    // Respect rate limits
    await new Promise(resolve => setTimeout(resolve, 100));
  }

  return allContacts;
}

Caching Strategies

Performance Optimization:

  • Cache frequently accessed, slowly-changing data
  • Use cache invalidation based on webhook notifications
  • Implement cache warming for critical data
  • Monitor cache hit rates and adjust strategies accordingly

API Testing and Development

Testing Environment Setup

Sandbox Testing: Use your development tenant for API testing to avoid affecting production data:

  • Generate separate API keys for development
  • Test all CRUD operations thoroughly
  • Validate error handling scenarios
  • Performance test with realistic data volumes

API Testing Tools:

  • Postman: Interactive API testing and documentation
  • Insomnia: Lightweight API client for development
  • curl: Command-line testing for automation
  • Custom test suites: Automated integration testing

Development Workflow

Iterative Development Process:

  1. Design integration requirements and data flow
  2. Generate API keys and set up authentication
  3. Implement core functionality with error handling
  4. Test thoroughly in development environment
  5. Deploy to production with monitoring
  6. Monitor API usage and performance metrics

Security Considerations

API Key Management

Security Best Practices:

  • Generate unique API keys for each integration
  • Use descriptive names to track key usage
  • Store keys in secure environment variables
  • Implement key rotation schedules
  • Monitor API usage for suspicious activity

Data Protection

Privacy and Compliance:

  • Only request necessary data permissions
  • Implement secure data transmission (HTTPS)
  • Handle customer data according to privacy regulations
  • Provide audit trails for data access and modifications
  • Include data retention and deletion capabilities

Access Control

Principle of Least Privilege:

  • Use the minimum API permissions required
  • Regularly review and update access requirements
  • Implement IP whitelisting where appropriate
  • Monitor API usage patterns for anomalies

Success Indicators:

  • API authentication working correctly on first attempt
  • Successful data retrieval and manipulation operations
  • Proper error handling and recovery mechanisms
  • Performance within acceptable ranges for your use case
  • Security best practices implemented and maintained

Next Steps: With authentication configured, explore specific integration patterns:

  • Contact management automation
  • Custom analytics dashboards
  • Third-party tool synchronization
  • Automated customer journey workflows

Remember: The API is a powerful tool that scales your creator business operations. Start with simple integrations and gradually build more sophisticated automation as your confidence and requirements grow.

Was this article helpful?

Your feedback helps us improve our content

Table of Contents

Need Help?

Can't find what you're looking for? Our support team is ready to assist you.

Contact Support