Skip to navigation

Errors

The API reports errors in two ways, depending on where the request fails.

Request errors

If the request is rejected before the query runs, the API returns an HTTP error status.

StatusMeaning
400 Bad RequestThe request has no operation name. Name the query and send the name in operationName.
401 UnauthorizedThe API key is missing, unknown, or inactive, or it was created in a different region than the endpoint.
429 Too Many RequestsThe hourly rate limit is exhausted. See Rate limits.

The API returns two kinds of 400. The missing-operation-name case uses an actual HTTP 400. Query validation errors come back as HTTP 200 with 400 in extensions.status.

  1. Missing operation name (HTTP 400), rejected before GraphQL runs:
{
"errors": [
{
"message": "Operation name is required",
"extensions": {
"code": "BAD_REQUEST",
"status": 400,
"request_id": "f295efec-3cb1-4ac0-9a43-70d559b7fd76"
}
}
]
}
  1. Query validation error (HTTP 200), for example an unknown field. The query never runs, so there’s no data key, and code describes the validation error:
{
"errors": [
{
"message": "Field 'notAField' doesn't exist on type 'ContactCollection'",
"locations": [{ "line": 1, "column": 29 }],
"path": ["query Contacts", "contacts", "notAField"],
"extensions": {
"code": "undefinedField",
"typeName": "ContactCollection",
"fieldName": "notAField",
"status": 400,
"request_id": "f295efec-3cb1-4ac0-9a43-70d559b7fd76"
}
}
]
}

An invalid argument value, such as an unsupported sortField, is also a validation error:

{
"errors": [
{
"message": "Argument 'sortField' on Field 'contacts' has an invalid value (title). Expected type 'ContactSortFieldEnum'.",
"locations": [{ "line": 1, "column": 18 }],
"path": ["query Contacts", "contacts", "sortField"],
"extensions": {
"code": "argumentLiteralsIncompatible",
"typeName": "Field",
"argumentName": "sortField",
"status": 400,
"request_id": "f295efec-3cb1-4ac0-9a43-70d559b7fd76"
}
}
]
}

There are two 401 responses. Both use HTTP 401 and come back before GraphQL runs.

  1. A missing, invalid, or inactive API key:
{
"errors": [
{
"message": "The API key is missing, invalid, or inactive",
"extensions": {
"code": "UNAUTHORIZED",
"status": 401,
"request_id": "f295efec-3cb1-4ac0-9a43-70d559b7fd76"
}
}
]
}
  1. A valid key whose account is disabled or no longer has app access:
{
"errors": [
{
"message": "You need an active account to access our API",
"extensions": {
"code": "ACCOUNT_INACTIVE",
"status": 401,
"request_id": "f295efec-3cb1-4ac0-9a43-70d559b7fd76"
}
}
]
}

A rate-limited request gets an HTTP 429. It carries the two rate-limit headers, with X-RateLimit-Remaining at 0, and a Retry-After header with the number of seconds until the limit resets:

HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 60
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 0
{
"errors": [
{
"message": "Rate limit exceeded. Try again later.",
"extensions": {
"code": "TOO_MANY_REQUESTS",
"status": 429,
"request_id": "f295efec-3cb1-4ac0-9a43-70d559b7fd76"
}
}
]
}

Include the request_id when you contact Tradespace support about a failed request.

GraphQL errors

Once the query runs, the response is 200 OK even when part of it fails. Failures appear in the errors array. Each error’s extensions.status holds an HTTP-style status. A failing field that can be null resolves to null. Single-record queries such as disclosure or patent cannot be null, so when one of them fails the whole data value is null.

extensions.statusMeaning
403Your account is not allowed to read this record or module.
404No record matches the ID or number you passed.
500Server-side failure.

If you’re getting 500 errors, check status.tradespace.io for outages.

403 feature not enabled or not authorized:

{
"data": { "opportunities": null },
"errors": [
{
"message": "You are not authorized to perform this action",
"locations": [{ "line": 1, "column": 22 }],
"path": ["opportunities"],
"extensions": {
"status": 403,
"code": "FORBIDDEN",
"request_id": "f295efec-3cb1-4ac0-9a43-70d559b7fd76"
}
}
]
}

404 record not found:

{
"data": { "contact": null },
"errors": [
{
"message": "Contact not found",
"locations": [{ "line": 1, "column": 27 }],
"path": ["contact"],
"extensions": {
"status": 404,
"code": "NOT_FOUND",
"request_id": "f295efec-3cb1-4ac0-9a43-70d559b7fd76"
}
}
]
}

500 server-side failure, for example a non-null field that resolved to null:

{
"data": { "contacts": { "metadata": null } },
"errors": [
{
"message": "Cannot return null for non-nullable field CollectionMetadata.count",
"locations": [{ "line": 1, "column": 40 }],
"path": ["contacts", "metadata", "count"],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"status": 500,
"request_id": "f295efec-3cb1-4ac0-9a43-70d559b7fd76"
}
}
]
}

Always check errors before reading data.