Status Codes and Errors
Complete reference of status codes returned by the SDK.
Success Codes
| Code | Description |
|---|---|
| 200 | Success - Operation completed |
Client Error Codes (4xx)
| Code | Description | Solution |
|---|---|---|
| 400 | Bad Request | Check sent parameters |
| 401 | Unauthorized | Verify Serial, ApiUser and ApiPassword |
| 403 | Forbidden | Invalid or expired license |
| 404 | Not Found | Message or resource not found |
| 409 | Conflict | Message already processed or expired |
| 429 | Too Many Requests | Slow down your calls |
Server Error Codes (5xx)
| Code | Description | Solution |
|---|---|---|
| 500 | Server Error | Try again later |
| 503 | Service Unavailable | Maintenance in progress |
Error Handling
Recommended Pattern
public class SecureExchangesException : Exception
{
public int StatusCode { get; }
public string Details { get; }
public SecureExchangesException(int statusCode, string details)
: base($"Error {statusCode}: {details}")
{
StatusCode = statusCode;
Details = details;
}
}
public class MessageService
{
public string SendMessage(MutliRecipientArgs args)
{
var response = MessageHelper.MultiRecipientMessage(args);
switch (response.Status)
{
case 200:
return response.RecipientsAnswer[0].Answer.URL;
case 400:
throw new SecureExchangesException(400,
$"Invalid parameters: {response.Data}");
case 401:
throw new SecureExchangesException(401,
"Invalid API credentials. Check your credentials.");
case 403:
throw new SecureExchangesException(403,
"Invalid or expired license. Contact support.");
case 404:
throw new SecureExchangesException(404,
"Resource not found.");
case 500:
throw new SecureExchangesException(500,
$"Server error: {response.Data}. Try again later.");
default:
throw new SecureExchangesException(response.Status,
response.Data ?? "Unknown error");
}
}
}
With Automatic Retry
public async Task<string> SendMessageWithRetry(
MutliRecipientArgs args,
int maxRetries = 3,
int delayMs = 1000)
{
for (int attempt = 1; attempt <= maxRetries; attempt++)
{
var response = MessageHelper.MultiRecipientMessage(args);
if (response.Status == 200)
return response.RecipientsAnswer[0].Answer.URL;
// Retry only for temporary errors
if (response.Status >= 500 || response.Status == 429)
{
if (attempt < maxRetries)
{
await Task.Delay(delayMs * attempt);
continue;
}
}
throw new SecureExchangesException(response.Status, response.Data);
}
throw new Exception("Maximum retry attempts reached");
}
Common Errors and Solutions
"Invalid credentials" (401)
// Verify your GUIDs are correct
Guid serial = new Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
Guid apiUser = new Guid("YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY");
Guid apiPassword = new Guid("ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ");
// Verify the endpoint
Uri endpoint = new Uri("https://www.secure-exchanges.com/_api/0217/0217.asmx");
"License expired" (403)
Contact support@secure-exchanges.com to renew your license.
"File too large" (400)
The limit is 2.5 GB. Compress your files or send them separately.
"Invalid email format" (400)
Verify email format with EmailHelper.IsValidEmail().