Newer Version Available

This content describes an older version of this product. View Latest

Status Codes and Error Responses

Either when an errors occur, or a response is successful, the response header contains an HTTP code, and the response body usually contains the HTTP response code, the message accompanying that error, and if appropriate, the field or object where the error occurred.
HTTP Response Code Description
200 Success with GET or HEAD request
201 Success with POST request
204 Success with DELETE
400 The request could not be understood, usually because the ID is not valid for the particular resource. For example, if you use a userId where a groupId is required, the request returns 400.
401 The session ID or OAuth token used has expired or is invalid. The response body contains the message and errorCode.
403 The request has been refused. Verify that the context user has the appropriate permissions to access the requested data, or that the context user is not an external user.
404 Either the specified resource was not found, or the resource has been deleted.
409 A conflict has occurred. For example, an attempt was made to update a request to join a group, but that request had already been approved or rejected.
412 A precondition has failed. For example, in a batch request, if haltOnError is true and a sub-request fails, subsequent sub-requests return 412.
500 An error has occurred within Force.com, so the request could not be completed. Contact salesforce.com Customer Support.
503 Too many requests in an hour.

Examples

The following are examples of what is returned for errors.

  • Incorrect ID:

    Using a non-existent ID in a request using JSON or XML (request_body.json or request_body.xml)

    1{
    2  "fields" : [ "Id" ],
    3  "message" : "User ID: id value of incorrect type: 001900K0001pPuOAAU",
    4  "errorCode" : "MALFORMED_ID"
    5}
  • Resource does not exist:
    Requesting a resource that does not exist, for example, you try to create a record using a misspelled object name
    1{
    2  "message" : "The requested resource does not exist",
    3  "errorCode" : "NOT_FOUND"
    4}