NewsAPI · Schema

ErrorResponse

Error response returned by the NewsAPI when a request fails

NewsHeadlinesArticlesSearchMediaContentRESTJSON

Properties

Name Type Description
status string Always 'error' for error responses.
code string A short code identifying the type of error.
message string A fuller description of the error, usually including how to fix it.
View JSON Schema on GitHub

JSON Schema

newsapi-error-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/newsapi/main/json-schema/newsapi-error-schema.json",
  "title": "ErrorResponse",
  "description": "Error response returned by the NewsAPI when a request fails",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "Always 'error' for error responses.",
      "const": "error"
    },
    "code": {
      "type": "string",
      "description": "A short code identifying the type of error.",
      "enum": [
        "apiKeyDisabled",
        "apiKeyExhausted",
        "apiKeyInvalid",
        "apiKeyMissing",
        "parameterInvalid",
        "parametersMissing",
        "rateLimited",
        "sourcesTooMany",
        "sourceDoesNotExist",
        "unexpectedError"
      ],
      "example": "apiKeyInvalid"
    },
    "message": {
      "type": "string",
      "description": "A fuller description of the error, usually including how to fix it.",
      "example": "Your API key hasn't been entered correctly. Double check it and try again."
    }
  },
  "required": ["status", "code", "message"]
}