Status Codes and Error Responses
GraphQL API queries return HTTP status codes or error responses that describe the query status.
Success with HTTP POST request. The response contains the query result. GraphQL API can also return a 200 OK
in cases where the request contains an error, such as an invalid object name or field. The error is represented by the GraphQLErrorRepresentation type.
A 200 OK
status code is returned even if the query doesn't return any matching items or if you pass in an invalid record ID.
The 4XX status codes are not common for GraphQL. They can signify issues with your network or with your connection to a Salesforce org.
- 401 Unauthorized
The session ID or OAuth token has expired or is invalid. For more information on the error, review the
message
anderrorCode
descriptions in the response body.- 404 Not Found
The specified endpoint was not found. Only the
graphql
endpoint is supported.
Unlike the UI API where a 404 error can mean that a resource was not found or that it has been deleted, GraphQL API usually returns a 200 OK
status code even if a record isn't found or is deleted. See the 200 OK
section above for details.
5XX status codes usually mean there's an internal Salesforce error. To resolve this issue, try your request again or contact Salesforce Customer Support if the issue persists.
- 500 Internal Server Error
An error has occurred within Lightning Platform, so the request could not be completed.
- 503 Service Unavailable
Too many requests in an hour or the server is down for maintenance. See Rate Limiting.