Server-to-Server - API Response Codes & Errors

S2S API Response Codes & Error Handling

Understanding Singular's S2S API response codes and implementing proper error handling ensures robust integration with reliable data transmission and attribution accuracy.


Response Architecture

HTTP Status Code Behavior

Critical Understanding: When integrating with Singular's API, all responses return HTTP 200 status codes, requiring validation of the response body's 'status' field to determine success ('ok') or failure ('error').

The response payload includes a 'reason' field providing detailed error information when status is 'error'.

Response Structure: All API responses follow consistent JSON format regardless of success or failure, enabling standardized parsing and error handling across all endpoint interactions.


Error Handling Strategy

Implementation Best Practices

Implement comprehensive error handling strategy to ensure data integrity and system reliability.

Recommended Approach:

  • Retry Mechanism: Implement exponential backoff retry with configurable maximum attempts
  • Sequential Processing: Maintain request order during retries to ensure data consistency
  • Error Classification: Distinguish between retryable and non-retryable errors (invalid parameters should not retry)
  • Comprehensive Logging: Log all failed requests including original parameters, error messages, device identifiers, and timestamps
  • Monitoring & Alerts: Track retry attempts and implement notification system for critical failures

Exponential Backoff Implementation

Exponential backoff prevents overwhelming servers during temporary failures while providing efficient retry strategy.

Retry Strategy:

  • Initial Delay: Start with 1-2 second delay after first failure
  • Backoff Multiplier: Double delay time with each subsequent retry (2s → 4s → 8s → 16s)
  • Maximum Attempts: Configure limit (recommended: 3-5 attempts)
  • Maximum Delay: Cap delay at reasonable threshold (e.g., 60 seconds)
  • Jitter: Add random jitter to prevent thundering herd effect
PYTHONJAVA
import requests
import time
import random

def exponential_backoff_request(url, params, max_retries=3):
    """
    Make API request with exponential backoff retry logic
    """
    base_delay = 1  # Start with 1 second
    max_delay = 60  # Cap at 60 seconds
    
    for attempt in range(max_retries):
        try:
            response = requests.get(url, params=params, timeout=10)
            
            # All responses return HTTP 200
            if response.status_code == 200:
                data = response.json()
                
                if data.get('status') == 'ok':
                    return {'success': True, 'data': data}
                    
                # Check if error is retryable
                reason = data.get('reason', '')
                if is_retryable_error(reason):
                    if attempt 

Logging & Monitoring

Comprehensive logging enables rapid troubleshooting and provides visibility into integration health.

Log Essential Information:

  • Request Details: Full request URL with all parameters (mask sensitive data)
  • Response Data: HTTP status code, response body, and headers
  • Error Context: Error message, reason field, and error classification
  • Device Information: Device identifiers for troubleshooting specific users
  • Timestamps: Request time, response time, and retry timestamps
  • Retry Metadata: Attempt number, backoff delay, and final outcome

Monitoring Metrics: Track error rates by type, retry success rates, average response times, and failed request volume to identify integration issues proactively.


Success Response

Successful API responses indicate request accepted for processing by Singular's systems.

HTTP 200 - Success

HTTP Response Description
200 - ok

The 200 - ok response without error or reason in response body indicates request successfully sent to queue for processing.

Success Indicator: Status field contains "ok" and no "reason" field present in response.

Response Structure:

{
    "status": "ok"
}

Processing Note: "ok" status confirms request queued for processing but does not guarantee immediate visibility in reports—allow processing time before validating data in Singular platform.


Error Responses

Error responses provide detailed information about request failures, enabling rapid troubleshooting and resolution.

Parameter Errors

Missing Required Parameters

HTTP Response Description
200 - error

Response with reason: missing argument: {param}

Cause: Required parameter missing from request or parameter value empty/null.

Non-Retryable Error: This error indicates invalid request structure. Do not retry without fixing parameter issue.

Resolution:

  • Verify all required parameters included in request
  • Confirm parameter values not null or empty strings
  • Check parameter spelling and case-sensitivity
  • Review endpoint documentation for complete parameter list

Response Example:

{
    "status": "error",
    "reason": "missing argument: a"
}

Common Missing Parameters: a (API key), p (platform), i (app identifier), ip (IP address), device identifiers


Platform Errors

Invalid Platform Value

HTTP Response Description
200 - error

Response with reason: invalid platform: {platform}

Cause: Platform parameter value not in list of supported platforms or incorrectly formatted (case-sensitive).

Non-Retryable Error: Invalid parameter value requires correction before resubmission.

Supported Platforms:

  • Android - Android mobile platform
  • iOS - iOS mobile platform
  • Web - Web applications
  • PC - Desktop applications
  • Xbox - Xbox gaming platform
  • Playstation - PlayStation gaming platform
  • Nintendo - Nintendo gaming platform
  • MetaQuest - Meta Quest VR platform
  • CTV - Connected TV platform

Resolution:

  • Verify platform value matches supported list exactly (case-sensitive)
  • Check for typos or spacing issues
  • Confirm platform appropriate for your application

Response Example:

{
    "status": "error",
    "reason": "invalid platform: Desktop"
}

Common Mistakes: Using "desktop" instead of "PC", lowercase platform names, or unsupported platform values


Device Identifier Errors

Missing Device Identifier

HTTP Response Description
200 - error

Response with reason: no device ID supplied

Cause: Request missing required device identifier for specified platform.

Non-Retryable Error: Device identifier required for attribution. Request cannot be processed without valid identifier.

Resolution:

  • Include platform-specific device identifier in request
  • iOS: Include idfv (always required) and idfa (when available)
  • Android (Google Play): Include asid (always required) and aifa (when available)
  • Android (Amazon): Include amid
  • Android (Chinese OEMs): Include oaid
  • Web/PC/Console/CTV: Include sdid

Response Example:

{
    "status": "error",
    "reason": "no device ID supplied"
}

Refer to Device Identifier Requirements for complete platform-specific identifier documentation.

200 - error

Response with reason: platform: {platform} should have an {identifier} param

Cause: Platform specified but required device identifier for that platform missing or incorrect identifier type provided.

Non-Retryable Error: Platform-identifier mismatch prevents attribution. Correct identifier required.

Common Scenarios:

  • iOS platform without idfv parameter
  • Android (Google Play) platform without asid parameter
  • PC/Web/Console platform without sdid parameter
  • Using wrong identifier type for specified platform

Resolution:

  • Verify correct identifier type for specified platform
  • Ensure identifier parameter name matches platform requirements
  • Confirm identifier value not null or empty

Response Example:

{
    "status": "error",
    "reason": "platform: PC should have an sdid param"
}

Network & Infrastructure Errors

Non-200 HTTP Status Codes

HTTP Response Description
4xx / 5xx

Any non-200 HTTP status code indicates infrastructure or network issue.

Retryable Error: These errors typically transient—implement exponential backoff retry mechanism.

Common Status Codes:

  • 429 - Rate limit exceeded (implement longer backoff)
  • 500 - Internal server error (retry with exponential backoff)
  • 502/503/504 - Gateway/service errors (retry with backoff)

Resolution:

  • Implement retry logic with exponential backoff
  • Log errors for monitoring and alerting
  • Contact Singular support if errors persist
  • Check Singular status page for service issues

Rate Limiting: If receiving 429 errors, reduce request rate and implement request throttling to stay within limits.


Error Classification

Understanding error types enables appropriate retry logic and faster issue resolution.

Retryable vs Non-Retryable

Non-Retryable Errors

These errors indicate invalid request parameters or configuration requiring manual correction before resubmission.

Error Pattern Action Required
missing argument: {param} Add missing parameter to request
invalid platform: {platform} Correct platform value to supported option
no device ID supplied Include required device identifier
platform: {platform} should have an {identifier} param Add correct identifier for specified platform

Retryable Errors

These errors indicate temporary issues that may resolve with retry attempts using exponential backoff.

Error Type Retry Strategy
Non-200 HTTP status codes Retry with exponential backoff (2-3 attempts)
Network timeouts Retry with exponential backoff (3-5 attempts)
Connection errors Retry with exponential backoff (3-5 attempts)
Rate limit errors (429) Longer backoff delay, reduce request rate

Decision Logic: Classify errors based on reason field content. Errors containing "invalid", "missing", or "should have" are typically non-retryable. Infrastructure errors (timeouts, connection failures, 5xx codes) are retryable.


Troubleshooting Guide

Quick reference for resolving common API integration issues.

Common Issues & Solutions

Parameter Issues

Symptom Solution
Missing argument: a

Include SDK Key in a parameter

Invalid platform error

Use correct case-sensitive platform value

  • Verify against supported platforms list
  • Check for typos and proper capitalization
No device ID supplied

Include platform-specific device identifier

  • iOS: idfv required, idfa optional
  • Android: asid required (Google Play)
  • Refer to platform-specific requirements
Platform should have identifier

Match identifier type to platform

  • PC requires sdid, not mobile identifiers
  • iOS requires idfv, not Android identifiers

Request Validation Checklist

Pre-Flight Validation: Verify these items before sending requests to prevent common errors.

  • SDK Key (a) included and correct (not Reporting API Key)
  • Platform (p) value matches supported list exactly
  • App identifier (i) matches platform type (Bundle ID for iOS, Package Name for Android)
  • Device identifier appropriate for platform and not null/empty
  • IP address (ip) or use_ip=true included
  • OS version (ve) included for mobile platforms
  • All required parameters for endpoint included
  • Parameter values URL-encoded where necessary (especially JSON in e parameter)

Support Resources

Additional Help

If issues persist after implementing error handling and troubleshooting:

  • Documentation: Review complete S2S API Documentation
  • Testing: Validate integration using SDK Console
  • Support: Contact Singular Support with error logs, request examples, and device identifiers
  • Status: Check Singular system status for service incidents