Skip to main content

GET /v1/platform/settings

Get your platform’s current configuration settings.

Authentication

Requires Platform API Key in the X-API-Key header.

Request

GET https://api.syncline.run/v1/platform/settings

Response

{
  "name": "Your Platform Name",
  "email": "developer@yourplatform.com",
  "redirect_uris": [
    "https://yourplatform.com/oauth/callback",
    "http://localhost:3000/oauth/callback"
  ],
  "webhook_url": "https://yourplatform.com/webhooks/syncline",
  "plan": "growth"
}

PUT /v1/platform/settings

Update your platform settings.

Authentication

Requires Platform API Key in the X-API-Key header.

Request

PUT https://api.syncline.run/v1/platform/settings

Request Body

{
  "redirect_uris": [
    "https://yourplatform.com/oauth/callback",
    "https://staging.yourplatform.com/oauth/callback",
    "http://localhost:3000/oauth/callback"
  ],
  "webhook_url": "https://yourplatform.com/webhooks/syncline"
}
redirect_uris
array
Array of allowed OAuth redirect URIs. Must be HTTPS in production (HTTP allowed for localhost).
webhook_url
string
Webhook endpoint URL. Must be HTTPS.

Response

{
  "success": true,
  "message": "Settings updated successfully",
  "redirect_uris": [
    "https://yourplatform.com/oauth/callback",
    "https://staging.yourplatform.com/oauth/callback",
    "http://localhost:3000/oauth/callback"
  ],
  "webhook_url": "https://yourplatform.com/webhooks/syncline"
}

Configuration Options

Redirect URIs

OAuth redirect URIs where users are sent after connecting their calendar. Requirements:
  • Must be HTTPS in production
  • HTTP allowed only for localhost development
  • Maximum 5 redirect URIs per platform
Example:
{
  "redirect_uris": [
    "https://app.yourplatform.com/oauth/callback",
    "https://staging.yourplatform.com/oauth/callback",
    "http://localhost:3000/oauth/callback"
  ]
}

Webhook URL

URL where Syncline sends webhook events. Requirements:
  • Must be HTTPS
  • Must return 200 OK within 30 seconds
  • Should verify webhook signatures
Example:
{
  "webhook_url": "https://api.yourplatform.com/webhooks/syncline"
}

Use Cases

Development Environment Setup

// Set up localhost redirect for development
await updateSettings({
  redirect_uris: [
    'https://app.yourplatform.com/oauth/callback', // Production
    'http://localhost:3000/oauth/callback'          // Development
  ]
});

Multi-Environment Configuration

// Different settings per environment
const settings = {
  production: {
    redirect_uris: ['https://app.yourplatform.com/oauth/callback'],
    webhook_url: 'https://api.yourplatform.com/webhooks/syncline'
  },
  staging: {
    redirect_uris: ['https://staging.yourplatform.com/oauth/callback'],
    webhook_url: 'https://staging-api.yourplatform.com/webhooks/syncline'
  },
  development: {
    redirect_uris: ['http://localhost:3000/oauth/callback'],
    webhook_url: 'https://webhook-test.com/your-endpoint'
  }
};

const env = process.env.NODE_ENV;
await updateSettings(settings[env]);

Webhook URL Update

// Update webhook URL
await updateSettings({
  webhook_url: 'https://new-api.yourplatform.com/webhooks/syncline'
});

// Test the new webhook
await fetch('https://api.syncline.run/v1/platform/webhook/test', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.SYNCLINE_API_KEY
  }
});

Error Responses

Invalid Redirect URI

{
  "error": "Invalid redirect URI",
  "message": "Redirect URIs must use HTTPS in production (HTTP allowed for localhost only)"
}

Invalid Webhook URL

{
  "error": "Invalid webhook URL",
  "message": "Webhook URL must use HTTPS"
}

Too Many Redirect URIs

{
  "error": "Too many redirect URIs",
  "message": "Maximum 5 redirect URIs allowed per platform"
}

Best Practices

Use Environment Variables

// Good: Environment-specific configuration
const config = {
  redirect_uris: [
    process.env.OAUTH_REDIRECT_URI,
    'http://localhost:3000/oauth/callback' // Development fallback
  ],
  webhook_url: process.env.WEBHOOK_URL
};

// Bad: Hardcoded production URLs
const config = {
  redirect_uris: ['https://myapp.com/oauth/callback'],
  webhook_url: 'https://myapp.com/webhooks'
};

Validate Webhook URL Before Updating

// Test webhook endpoint first
async function updateWebhookSafely(newUrl) {
  // Verify endpoint responds
  try {
    const response = await fetch(newUrl, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ test: true })
    });

    if (!response.ok) {
      throw new Error('Webhook endpoint not responding');
    }
  } catch (error) {
    console.error('Webhook validation failed:', error);
    return;
  }

  // Update if valid
  await updateSettings({ webhook_url: newUrl });

  // Send test webhook
  await sendTestWebhook();
}

Keep Redirect URIs Minimal

// Good: Only necessary URIs
redirect_uris: [
  'https://app.yourplatform.com/oauth/callback',
  'http://localhost:3000/oauth/callback'
]

// Bad: Too many URIs
redirect_uris: [
  'https://app.yourplatform.com/callback1',
  'https://app.yourplatform.com/callback2',
  'https://app.yourplatform.com/callback3',
  'https://staging.yourplatform.com/callback1',
  'https://staging.yourplatform.com/callback2'
]