---
schema_version: "1"
id: 806935b043bd049b2e7c891c8b9320c047ceae525950d062682d7da397027396
title: Status Codes and Error Responses
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/graphql-api/graphql/guides/query/query-status.md
canonical_url: https://developer.salesforce.com/docs/platform/graphql/guide/query-status.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 73ac7e6571053e9422256aac44983f138ec892ddb51f2778119f355242844440
products:
  - GraphQL API
---
# Status Codes and Error Responses

GraphQL API queries return HTTP status codes or error responses that describe the query status.

## 200 OK

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 [GraphQLErrorRepresentation](/docs/platform/graphql/references/graphql?meta=type%3AGraphQLErrorRepresentation) type represents the error.

```
{
  "data": {},
  "errors": [
    {
      "extensions": {
        "ErrorType": "ValidationError"
      },
      "locations": [
        {
          "column": 7,
          "line": 4
        }
      ],
      "message": "Validation error of type FieldUndefined: Field &#39;Accounts&#39; in type &#39;RecordQuery&#39; is undefined @ &#39;uiapi/query/Accounts&#39;",
      "paths": []
    }
  ]
}
```

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.

```
{
    "data": {
        "uiapi": {
            "query": {
                "Case": {
                    "edges": []
                }
            }
        }
    },
    "errors": []
}
```

The `ErrorType` field returns one of these errors.

- `InvalidSyntax` - The request contains a syntax error.
- `ValidationError` - The request isn’t valid against the GraphQL API schema. For example, this error can occur if an object or field name included in the query doesn’t exist.
- `DataFetchingException` - An exception occurred while fetching data, for example, invalid credentials.
- `OperationNotSupported` - Although the request is valid against the GraphQL API schema and successfully parsed, the server can’t resolve which operation to run.
- `ExecutionAborted` - The request didn’t complete successfully.

## 4XX Status Codes

The 4XX status codes signify issues with your network, connection to a Salesforce org, or access to GraphQL API.

- 401 Unauthorized

  - : The session ID or OAuth token has expired or is invalid. For more information about the error, review the `message` and `errorCode` descriptions in the response body.

- 403 Forbidden

  - : Unauthenticated guest users don’t have access to GraphQL API in the org. Starting in API v67.0, admins can turn on guest user access from Setup. In the Quick Find box, enter and select **API Access Controls**, and then turn on guest user access.

- 404 Not Found

  - : The specified endpoint wasn’t found. Only the [`graphql` endpoint](/docs/platform/graphql/references/graphql?meta=Send%2BQuery) is supported.

**note:** GraphQL API usually returns a `200 OK` status code even if a record isn’t found or is deleted. Contrastingly, UI API returns a 404 error if a resource isn’t found or is deleted. See the previous [`200 OK`](#200-ok) section for details.

## 5XX Status Codes

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 didn’t complete.

- 503 Service Unavailable

  - : Too many requests in an hour or the server is down for maintenance. See [Rate Limiting](https://developer.salesforce.com/docs/platform/graphql/rate-limit.md).
