Skip to content

Error Handling

All API errors follow a consistent JSON structure.

Error Response Format

json
{
  "message": "The given data was invalid.",
  "errors": {
    "field_name": [
      "The field name is required."
    ]
  }
}

HTTP Status Codes

CodeMeaningCommon Cause
200OKRequest succeeded
201CreatedResource(s) created successfully
302RedirectDashboard form submission succeeded (redirects back)
401UnauthorizedMissing or invalid authentication token/session
403ForbiddenToken lacks required scope or user lacks permission
404Not FoundResource does not exist or is not within your account scope
422Validation ErrorRequest body failed validation rules
429Too Many RequestsRate limit exceeded
500Server ErrorInternal server error

Validation Errors (422)

When request validation fails, the response includes field-level error messages:

json
{
  "message": "The given data was invalid.",
  "errors": {
    "leads.0.phone": ["The leads.0.phone field is required."],
    "leads.0.products": ["The leads.0.products field is required."]
  }
}

For bulk operations, error keys reference the array index (e.g., leads.0.phone, orders.2.city).

Authorization Errors (403)

Returned when the authenticated token does not have the required scope:

json
{
  "message": "This action is unauthorized."
}

Common causes:

  • API token missing the required permission (e.g., CREATE LEADS)
  • User's role does not have the required policy permission
  • Attempting to access a resource outside your account scope

Authentication Errors (401)

json
{
  "message": "Unauthenticated."
}

Common causes:

  • Missing Authorization: Bearer {token} header
  • Expired or revoked token
  • Invalid token string

Bulk Operation Errors

For bulk create endpoints (leads, orders), partial failures are not supported. If any item in the array fails validation, the entire request is rejected with 422 and all validation errors are returned.

TIP

Validate your data client-side before sending bulk requests to avoid rejections.

WedoCOD Documentation