S
Samva
S
Samva
DashboardAPISamva DocumentationQuickstart GuideAuthentication

API Reference

Email Management

Conversation Management

Configuration

Analytics & Operations

OpenAPI Specification
API Reference

API Reference

Complete reference for all Samva API endpoints

The Samva API is organized around REST principles with an agent-native architecture. All API requests return JSON responses and use standard HTTP response codes.

OpenAPI Specification: View our live OpenAPI spec at samva.app/api/v1/openapi.json or read more →

Base URL

https://samva.app/api/v1

For development:

https://staging.samva.app/api/v1

Authentication

All API requests require authentication via API key. Include your API key in the X-API-Key header:

curl -H "X-API-Key: your-api-key-here" \
  https://samva.app/api/v1/messages

Getting Your API Key

  1. Log in to your Samva account
  2. Navigate to Settings → API Keys
  3. Click Create API Key
  4. Copy the API key (it's only shown once)

Security Best Practices

  • Never commit API keys - Use environment variables
  • Rotate regularly - Generate new keys periodically
  • Use separate keys - Different keys for dev/staging/prod
  • Revoke unused keys - Delete keys that are no longer needed

Learn more about authentication →

API Endpoints

Browse all available endpoints organized by service:

Core Messaging

  • Messages - Send and manage messages across all channels
  • Email - Email messaging, domains, threading, and management
  • WhatsApp - WhatsApp Business API integration
  • SMS - SMS messaging with DLT support

Conversation Management

  • Conversations - Cross-channel conversation threading
  • Participants - Contact and participant management

Configuration

  • Templates - Message template management
  • Webhooks - Webhook endpoint configuration
  • API Keys - API key management

Analytics & Operations

  • Analytics - Usage metrics and insights
  • Billing - Subscription and usage tracking
  • Organizations - Organization management
  • Attachments - File attachment management

Request Format

Headers

HeaderRequiredDescription
AuthorizationYesBearer token with API key
Content-TypeYesapplication/json
X-Request-IdNoUnique request identifier for tracking
X-Organization-IdNoOverride default organization

Request Body

All POST/PUT/PATCH requests accept JSON:

{
  "channel": "sms",
  "to": "+919876543210",
  "content": {
    "template_id": "dlt_template_123",
    "variables": {
      "otp": "123456"
    }
  }
}

Response Format

Success Response

{
  "id": "msg_abc123",
  "status": "queued",
  "created_at": "2024-01-15T10:30:00Z",
  "credits_used": 1
}

Error Response

{
  "error": {
    "code": "INVALID_PHONE_NUMBER",
    "message": "The phone number format is invalid",
    "details": {
      "field": "to",
      "value": "9876543210",
      "expected": "+919876543210 or E.164 format"
    }
  }
}

HTTP Status Codes

CodeDescription
200Success - Request completed
201Created - Resource created
202Accepted - Request queued
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
403Forbidden - Insufficient permissions
404Not Found - Resource doesn't exist
409Conflict - Duplicate request
422Unprocessable - Validation failed
429Too Many Requests - Rate limited
500Server Error - Internal error
503Service Unavailable - Temporary outage

Rate Limiting

API requests are rate-limited. Check response headers:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200

Pagination

List endpoints support pagination:

GET /v1/messages?page=2&limit=50

Parameters:

  • page - Page number (default: 1)
  • limit - Items per page (default: 20, max: 100)

Response:

{
  "data": [...],
  "pagination": {
    "page": 2,
    "limit": 50,
    "total": 245,
    "pages": 5
  }
}

Filtering & Sorting

# Filter by status
GET /v1/messages?status=delivered

# Sort by created date
GET /v1/messages?sort=-created_at

# Date range
GET /v1/messages?created_after=2024-01-01&created_before=2024-01-31

Idempotency

Prevent duplicate operations with idempotency keys:

curl -X POST https://samva.app/api/v1/messages/send \
  -H "X-Idempotency-Key: unique-request-id-123" \
  -d '{...}'

Webhooks

Receive real-time updates via webhooks:

// Configure webhook endpoint
await client.webhooks.create({
  url: 'https://your-app.com/webhooks',
  events: ['message.delivered', 'message.failed'],
  secret: 'webhook_secret_key'
});

SDK Support

TypeScript SDK

Official TypeScript/JavaScript SDK

REST API

Direct REST API usage

Postman Collection

Import into Postman

Testing

Use test API keys (sk_test_*) for development:

  • No charges applied
  • Simulated delivery statuses
  • Test phone numbers available

Support

Need help with the API?

  • 📧 API Support: api@samva.app
  • 🐛 Report Issues: github.com/samva/api-issues
  • 💬 Developer Discord: discord.gg/samva-dev

Authentication

Secure your API requests and manage user authentication

Add Email Block

Next Page

On this page

Base URLAuthenticationGetting Your API KeySecurity Best PracticesAPI EndpointsCore MessagingConversation ManagementConfigurationAnalytics & OperationsRequest FormatHeadersRequest BodyResponse FormatSuccess ResponseError ResponseHTTP Status CodesRate LimitingPaginationFiltering & SortingIdempotencyWebhooksSDK SupportTestingSupport