Sponza API Documentation

Build powerful influencer marketing applications with Sponza's API

Quick Start
Get started with our API in minutes

1. Get Your API Key

Sign up for a developer account and generate your API key from the dashboard. Your API key is required for all API requests.

# Get your access tokencurl -X POST https://api.sponza.in/v1/auth/token \  -H "Content-Type: application/json" \  -d '{"api_key": "your_api_key"}'# Response{"access_token": "eyJhbGciOiJIUzI1NiIs...", "expires_in": 3600}

2. Make Your First Request

Test the API with a simple request to get your account information.

# Get account informationcurl https://api.sponza.in/v1/account \  -H "Authorization: Bearer your_access_token"# Response{
  "id": "acc_123",
  "name": "Your Company",
  "email": "contact@yourcompany.com",
  "plan": "pro",
  "created_at": "2024-01-01T00:00:00Z"
}

3. Code Examples

const axios = require('axios');

const client = axios.create({
  baseURL: 'https://api.sponza.in/v1',
  headers: {
    'Authorization': `Bearer ${process.env.SPONZA_API_KEY}`
  }
});

async function getAccount() {
  try {
    const response = await client.get('/account');
    console.log(response.data);
  } catch (error) {
    console.error(error.response.data);
  }
}

API Endpoints

Campaign Management
Endpoints for managing influencer marketing campaigns

Authentication

All API requests must be authenticated using your API key. Include it in the Authorization header:

Authorization: Bearer your_access_token

Authentication Flow

  1. Generate an API key from your dashboard
  2. Exchange the API key for an access token
  3. Use the access token in all subsequent requests
  4. Refresh the token before it expires (1 hour)
Security
  • • All API requests must be made over HTTPS
  • • API keys should be kept secure and never shared
  • • Rate limiting is applied to all endpoints
  • • IP whitelisting is available for enterprise accounts
  • • Access tokens expire after 1 hour
  • • All sensitive data is encrypted at rest
Rate Limiting
API usage limits and quotas

Free Plan

  • • 100 requests/minute
  • • 10,000 requests/day
  • • Basic endpoints only

Pro Plan

  • • 500 requests/minute
  • • 50,000 requests/day
  • • All endpoints

Enterprise

  • • Custom limits
  • • Unlimited requests
  • • Priority support
# Rate limit headers in responseX-RateLimit-Limit: 100X-RateLimit-Remaining: 95X-RateLimit-Reset: 1611234567
Error Handling
Common error codes and how to handle them

HTTP Status Codes

  • 400 - Bad Request
  • 401 - Unauthorized
  • 403 - Forbidden
  • 404 - Not Found
  • 429 - Too Many Requests
  • 500 - Internal Server Error

Error Response Format

{
  "error": {
    "code": "invalid_request",
    "message": "Invalid request parameters",
    "details": {
      "field": "budget",
      "reason": "must be greater than 0"
    }
  }
}
Webhooks
Receive real-time updates about your campaigns

Configure webhooks to receive real-time notifications about campaign events.

Available Events

  • campaign.created - New campaign created
  • campaign.updated - Campaign details updated
  • campaign.completed - Campaign completed
  • influencer.joined - Influencer joined campaign
  • content.published - New content published
  • payment.processed - Payment processed
# Webhook payload example{
  "event": "campaign.created",
  "timestamp": "2024-01-15T10:00:00Z",
  "data": {
    "campaign_id": "camp_123",
    "name": "Summer Collection Launch",
    "status": "draft"
  },
  "signature": "sha256=..."
}
SDKs & Libraries
Official client libraries for popular programming languages

Install our official SDKs to get started quickly:

# Node.jsnpm install @sponza/api# Pythonpip install sponza-api# PHPcomposer require sponza/api