Errors

Canvas uses conventional HTTP response codes to indicate success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a request wasn’t found, etc.). Codes in the 5xx range indicate an error with Canvas’ server.

All 4xx errors that could be handled programmatically (e.g., resource not found) include an OperationOutcome that explains the error reported

Error CodeDescription
200 - OKEverything worked as expected.
400 - Bad RequestThe request was malformed or rejected by validation.
401 - UnauthorizedNo valid Bearer token provided.
403 - ForbiddenToken bearer is forbidden from performing the operation.
404 - Not FoundThe requested resource doesn’t exist.
412 - Precondition FailedA conditional request failed because the resource has been modified since the precondition was specified.
422 - Unprocessable EntityThe request was syntactically correct but failed due to request semantics, database state, or a business rule.
5XX - Server ErrorSomething went wrong on Canvas’s end.

400

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "invalid",
      "details": {
        "text": "The request was malformed or failed validation."
      }
    }
  ]
}


401

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "unknown",
      "details": {
        "text": "Authentication failed"
      }
    }
  ]
}


403

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "forbidden",
      "details": {
        "text": "Authorization failed"
      }
    }
  ]
}


404

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "not-found",
      "details": {
        "text": "Unknown Patient resource 'a47c7b0ebbb442cdbc4adf259d148ea1'"
      }
    }
  ]
}


412

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "conflict",
      "details": {
        "text": "The resource has been modified since the precondition was specified."
      }
    }
  ]
}


422

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "business-rule",
      "details": {
        "text": "This appointment time is no longer available."
      }
    }
  ]
}

5XX

{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "exception",
      "details": {
        "text": "Internal server error"
      }
    }
  ]
}