Error Handling

Proper error handling is critical for debugging, monitoring, and providing a good integration experience. This document covers error patterns, codes, and best practices for the External Actions API.

Error Types

400 Bad Request

{ 
  "error": { 
    "code": "INVALID_REQUEST", 
    "message": "Missing required field: email", 
    "details": { 
      "field": "objectData.objectContext.leadData.email", 
      "expected": "string", 
      "received": "null" 
    } 
  } 
} 

Causes may be due to:

401 Unauthorized

{ 
  "error": { 
    "code": "UNAUTHORIZED", 
    "message": "Invalid or missing authentication credentials" 
  } 
} 

Causes may be due to:

403 Forbidden

{ 
  "error": { 
    "code": "FORBIDDEN", 
    "message": "Insufficient permissions to access this resource" 
  } 
} 

Causes may be due to:

429 Rate Limit Exceeded

{ 
  "error": { 
    "code": "RATE_LIMIT_EXCEEDED", 
    "message": "Too many requests", 
    "retryAfter": 60 
  } 
} 

Causes may be due to:

500 Internal Server Error

{ 
  "error": { 
    "code": "INTERNAL_ERROR", 
    "message": "An unexpected error occurred" 
  } 
} 

Causes may be due to:

503 Service Unavailable

{ 
  "error": { 
    "code": "SERVICE_UNAVAILABLE", 
    "message": "Service is temporarily unavailable" 
  } 
} 

Causes may be due to:

Error Handling

Callback with Activity Error

When processing fails but you can still send a callback, use activityData to indicate the error:

{ 
  "objectData": [ 
    { 
      "activityData": { 
        "success": false, 
        "errorCode": "ENRICHMENT_FAILED", 
        "reason": "External API returned 503 Service Unavailable" 
      }, 
      "leadData": { 
        "id": 12345 
      } 
    } 
  ] 
} 

Always include:

Use meaningful, consistent error codes. For example:

Code
Description
Use Case
RATE_LIMIT_EXCEEDED
Rate limit hit
Too many API calls
INVALID_DATA
Invalid input data
Data validation error
TIMEOUT
Processing timeout
Took too long
NOT_FOUND
Entity not found
No matching record
EXTERNAL_API_ERROR
Third-party API error
Downstream failure
AUTHENTICATION_FAILED
Auth to external system failed
Credentials invalid
INSUFFICIENT_DATA
Not enough data to process
Missing required fields
DUPLICATE_REQUEST
Request already processed
Idempotency check failed

Callback Error Handling

Adobe Callback Endpoint Errors

When Adobe's callback endpoint returns an error, you will see:

400 Bad Request

{ 
  "error": { 
    "code": "INVALID_CALLBACK", 
    "message": "Invalid token" 
  } 
} 

Possible causes are:

If you see this error:

401 Unauthorized

{ 
  "error": { 
    "code": "UNAUTHORIZED", 
    "message": "Invalid or missing authentication headers" 
  } 
} 

Possible causes are:

Next steps are:

500 Internal Server Error

{ 
  "error": { 
    "code": "INTERNAL_ERROR", 
    "message": "An unexpected error occurred processing the callback" 
  } 
} 

Possible causes are:

To resolve, try:

Best Practices

Always Echo Required IDs

Even in error cases, always include required entity IDs:

{ 
  "activityData": { 
    "success": false, 
    "errorCode": "ENRICHMENT_FAILED" 
  }, 
  "leadData": { 
    "id": 12345  // Always include id 
  } 
} 

Maintain a comprehensive error code reference:

errorCodes: 
  ENRICHMENT_FAILED: 
    description: Data enrichment operation failed 
    httpStatus: 200  # Callback succeeds, processing failed 
    retryable: true 
  INVALID_DATA: 
    description: Input data validation failed 
    httpStatus: 400 
    retryable: false 
  RATE_LIMIT_EXCEEDED: 
    description: API rate limit exceeded 
    httpStatus: 429 
    retryable: true