Skip to main content

API Errors

FieldValue
Document IDASCEND-API-003
Version1.0.0
Last UpdatedDecember 19, 2025
AuthorAscend Engineering Team
PublisherOW-KAI Technologies Inc.
ClassificationEnterprise Client Documentation
ComplianceSOC 2 CC6.1/CC6.2, PCI-DSS 7.1/8.3, HIPAA 164.312, NIST 800-53 AC-2/SI-4

Reading Time: 5 minutes | Skill Level: Intermediate

Overview

ASCEND uses consistent error codes and formats to help you diagnose and resolve issues. All errors include a unique request ID for support escalation.

Error Response Format

{
"status": "error",
"error": {
"code": "INVALID_API_KEY",
"message": "The provided API key is invalid or expired",
"details": {
"key_prefix": "owkai_admin_abc...",
"reason": "key_expired"
}
},
"meta": {
"request_id": "req_xyz789",
"timestamp": "2025-12-15T10:30:00Z"
}
}

Authentication Errors (4xx)

CodeHTTPDescriptionResolution
INVALID_API_KEY401API key not foundVerify key is correct
EXPIRED_API_KEY401API key expiredGenerate new key
REVOKED_API_KEY401API key revokedContact admin
INVALID_TOKEN401JWT invalidRe-authenticate
EXPIRED_TOKEN401JWT expiredRefresh token
MFA_REQUIRED401MFA not completedComplete MFA flow
ACCOUNT_LOCKED403Account lockedWait or contact admin
INSUFFICIENT_PERMISSIONS403Role not authorizedRequest access

Example: Invalid API Key

{
"status": "error",
"error": {
"code": "INVALID_API_KEY",
"message": "The provided API key is invalid or expired",
"details": {
"key_prefix": "owkai_admin_abc..."
}
}
}

Resolution:

# Test your key by listing API keys
curl "https://pilot.owkai.app/api/keys/list" \
-H "X-API-Key: owkai_admin_..."

Validation Errors (400/422)

CodeHTTPDescriptionResolution
MISSING_REQUIRED_FIELD400Required field missingAdd field
INVALID_FIELD_VALUE400Invalid valueCheck format
VALIDATION_ERROR422Schema validation failedReview schema
INVALID_JSON400Malformed JSONFix JSON syntax

Example: Missing Required Field

{
"status": "error",
"error": {
"code": "MISSING_REQUIRED_FIELD",
"message": "Required field 'agent_id' is missing",
"details": {
"field": "agent_id",
"requirement": "required",
"type": "string"
}
}
}

Resource Errors (404/409)

CodeHTTPDescriptionResolution
RESOURCE_NOT_FOUND404Resource doesn't existCheck ID
AGENT_NOT_FOUND404Agent not registeredRegister agent
ACTION_NOT_FOUND404Action ID invalidVerify ID
RESOURCE_CONFLICT409Duplicate resourceUse existing
AGENT_ALREADY_EXISTS409Agent ID takenUse unique ID

Example: Agent Not Found

{
"status": "error",
"error": {
"code": "AGENT_NOT_FOUND",
"message": "Agent 'trading-bot-001' is not registered",
"details": {
"agent_id": "trading-bot-001",
"suggestion": "Register agent before submitting actions"
}
}
}

Resolution:

# Register the agent first
curl -X POST "https://pilot.owkai.app/api/registry/agents" \
-H "X-API-Key: owkai_..." \
-d '{"agent_id": "trading-bot-001", "agent_type": "trading"}'

Rate Limiting Errors (429)

CodeHTTPDescriptionResolution
RATE_LIMIT_EXCEEDED429Too many requestsWait and retry
QUOTA_EXCEEDED429Monthly quota hitUpgrade plan

Example: Rate Limited

{
"status": "error",
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded. Retry after 60 seconds",
"details": {
"limit": 100,
"window": "1m",
"current": 105,
"retry_after": 60
}
}
}

Headers:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1702656060
Retry-After: 60

Resolution:

import time

response = api_call()
if response.status_code == 429:
retry_after = int(response.headers.get('Retry-After', 60))
time.sleep(retry_after)
response = api_call() # Retry

Governance Errors (4xx)

CodeHTTPDescriptionResolution
ACTION_DENIED403Policy denied actionReview policy
APPROVAL_REQUIRED202Needs human approvalWait for approval
KILL_SWITCH_ACTIVE403Agent killedReactivate agent
POLICY_VIOLATION403Rule violationModify request

Example: Action Denied

{
"status": "error",
"error": {
"code": "ACTION_DENIED",
"message": "Action denied by policy 'no-sensitive-data-access'",
"details": {
"policy_id": "pol_xyz789",
"policy_name": "no-sensitive-data-access",
"risk_score": 95,
"risk_level": "critical",
"reason": "Access to sensitive data prohibited"
}
}
}

Server Errors (5xx)

CodeHTTPDescriptionResolution
INTERNAL_ERROR500Server errorRetry later
SERVICE_UNAVAILABLE503MaintenanceCheck status
GATEWAY_TIMEOUT504TimeoutRetry
DATABASE_ERROR500DB issueContact support

Example: Server Error

{
"status": "error",
"error": {
"code": "INTERNAL_ERROR",
"message": "An internal error occurred. Please try again later.",
"details": {
"request_id": "req_xyz789"
}
}
}

Resolution:

  1. Note the request_id
  2. Check status.owkai.app
  3. Retry with exponential backoff
  4. Contact support if persistent

Error Handling Best Practices

1. Check Error Codes

response = client.submit_action(...)

if response.status_code != 200:
error = response.json().get('error', {})
code = error.get('code')

if code == 'RATE_LIMIT_EXCEEDED':
handle_rate_limit(response)
elif code == 'APPROVAL_REQUIRED':
handle_pending_approval(response)
elif code == 'INVALID_API_KEY':
refresh_api_key()

2. Implement Retries

import time
from functools import wraps

def retry_on_error(max_retries=3, backoff_factor=2):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
for attempt in range(max_retries):
try:
return func(*args, **kwargs)
except RateLimitError as e:
if attempt < max_retries - 1:
time.sleep(backoff_factor ** attempt)
else:
raise
return wrapper
return decorator

3. Log Request IDs

import logging

logger = logging.getLogger(__name__)

response = client.submit_action(...)
request_id = response.headers.get('X-Request-ID')

if response.status_code >= 400:
logger.error(f"API error: {response.json()}, request_id: {request_id}")

Support Escalation

When contacting support, include:

  1. Request ID - From error response or headers
  2. Error Code - e.g., INVALID_API_KEY
  3. Timestamp - When error occurred
  4. Request Details - Endpoint, method, relevant parameters
Support Ticket Template:
- Request ID: req_xyz789
- Error Code: INTERNAL_ERROR
- Timestamp: 2025-12-15T10:30:00Z
- Endpoint: POST /api/v1/actions
- Steps to Reproduce: ...

Next Steps


Document Version: 1.0.0 | Last Updated: December 2025