Api ошибка 422

HTTP response status code 422 Unprocessable Entity is a client error that is returned by the server to indicate that it understands the content type, and the syntax is correct, but it is unable to process the instructions specified by the request.

Usage

When the 422 Unprocessable Entity error message is sent, the server is indicating that it cannot process the instructions contained in the request. The content type is understood, otherwise, a 415 Unsupported Media Type error will have been sent. Additionally, the syntax is valid, otherwise, a 400 Bad Request error will be more explanatory.

An error of this type can be generated if the request includes an XML instruction block as the message body, which is not only correctly formed but understood by the server, yet contains errors in logic that result in a server-side error.

Note

Search engines like Google will not index a URL with 422 Unprocessable Entity response status, and consequently, URLs that have been indexed in the past but are now returning this HTTP status code will be removed from the search results.

Example

In the example, the client uses an XML document to request that task #100 be started. The XML document is recognized and accepted by the server, and it is syntactically correct. For instance, it does not have an error such as an unmatched tag, nor does it contain a properly matched but unrecognized tag. However, the server does not have a record of a task with id=100. Therefore, the request cannot be processed.

Request

POST /requests HTTP/1.1
Host: www.example.ai
Content-Type: application/xml
Content-Length: 101

<?xml version="1.0" encoding="utf-8"?>
<request>
   <id>100</id>
   <action>start</action>
</request>

Response

HTTP/1.1 422 Unprocessable Entity
Content-Type: text/html
Content-Length: 150

<html>
  <head>
    <title>Request Failed</title>
  </head>
  <body>
   <p>Task #100 is not recognized and cannot be started.</p>
  </body>
</html>

Code references

.NET

HttpStatusCode.UnprocessableEntity

Rust

http::StatusCode::UNPROCESSABLE_ENTITY

Rails

:unprocessable_entity

Go

http.StatusUnprocessableEntity

Symfony

Response::HTTP_UNPROCESSABLE_ENTITY

Python3.5+

http.HTTPStatus.UNPROCESSABLE_ENTITY

Apache HttpComponents Core

org.apache.hc.core5.http.HttpStatus.SC_UNPROCESSABLE_ENTITY

Angular

@angular/common/http/HttpStatusCode.UnprocessableEntity

Takeaway

The 422 Unprocessable Entity status code is a client error that is sent by the server to indicate that the request is syntactically correct and understood by the server, but semantically invalid.

See also

  • RFC 4918

Last updated: June 2, 2022

400 Bad Request would now seem to be the best HTTP/1.1 status code for your use case.

At the time of your question (and my original answer), RFC 7231 was not a thing; at which point I objected to 400 Bad Request because RFC 2616 said (with emphasis mine):

The request could not be understood by the server due to malformed syntax.

and the request you describe is syntactically valid JSON encased in syntactically valid HTTP, and thus the server has no issues with the syntax of the request.

However as pointed out by Lee Saferite in the comments, RFC 7231, which obsoletes RFC 2616, does not include that restriction:

The 400 (Bad Request) status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).


However, prior to that re-wording (or if you want to quibble about RFC 7231 only being a proposed standard right now), 422 Unprocessable Entity does not seem an incorrect HTTP status code for your use case, because as the introduction to RFC 4918 says:

While the status codes provided by HTTP/1.1 are sufficient to
describe most error conditions encountered by WebDAV methods, there
are some errors that do not fall neatly into the existing categories.
This specification defines extra status codes developed for WebDAV
methods (Section 11)

And the description of 422 says:

The 422 (Unprocessable Entity) status code means the server
understands the content type of the request entity (hence a
415(Unsupported Media Type) status code is inappropriate), and the
syntax of the request entity is correct (thus a 400 (Bad Request)
status code is inappropriate) but was unable to process the contained
instructions.

(Note the reference to syntax; I suspect 7231 partly obsoletes 4918 too)

This sounds exactly like your situation, but just in case there was any doubt, it goes on to say:

For example, this error condition may occur if an XML
request body contains well-formed (i.e., syntactically correct), but
semantically erroneous, XML instructions.

(Replace «XML» with «JSON» and I think we can agree that’s your situation)

Now, some will object that RFC 4918 is about «HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)» and that you (presumably) are doing nothing involving WebDAV so shouldn’t use things from it.

Given the choice between using an error code in the original standard that explicitly doesn’t cover the situation, and one from an extension that describes the situation exactly, I would choose the latter.

Furthermore, RFC 4918 Section 21.4 refers to the IANA Hypertext Transfer Protocol (HTTP) Status Code Registry, where 422 can be found.

I propose that it is totally reasonable for an HTTP client or server to use any status code from that registry, so long as they do so correctly.


But as of HTTP/1.1, RFC 7231 has traction, so just use 400 Bad Request!

The server understands the content type of the request entity (hence a 415 Unsupported Media Type status code is inappropriate), and the syntax of the request entity is correct (thus a 400 Bad Request status code is inappropriate) but was unable to process the contained instructions.

For example, this error condition may occur if an XML request body contains well-formed (i.e., syntactically correct), but semantically erroneous, XML instructions.


  • Source: RFC4918 Section 11.2

422 CODE REFERENCES

Rails HTTP Status Symbol :unprocessable_entity

Symfony HTTP Status Constant Response::HTTP_UNPROCESSABLE_ENTITY

.NET HttpStatusCode.UnprocessableEntity

Rust http::StatusCode::UNPROCESSABLE_ENTITY

Go http.StatusUnprocessableEntity

Python3.5+ http.HTTPStatus.UNPROCESSABLE_ENTITY

Apache HttpComponents Core org.apache.hc.core5.http.HttpStatus.SC_UNPROCESSABLE_ENTITY

Angular @angular/common/http/HttpStatusCode.UnprocessableEntity

422 status code example

Here’s an example request and response for a 422 Unprocessable Entity status code:

Request

POST /api/users HTTP/1.1
Host: example.com
Content-Type: application/json

{
"name": "",
"email": "example.com"
}

Response

HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json

{
"error": "Unprocessable Entity",
"message": "Validation failed",
"details": [
{
"field": "name",
"message": "Name is required"
},
{
"field": "email",
"message": "Invalid email address"
}
]
}

In this example, the request is attempting to create a new user by sending a JSON payload to the server via a POST request. However, the server is unable to process the request due to validation errors in the payload.

The server responds with a 422 Unprocessable Entity status code and a JSON payload containing an error message, a description of the error, and details about the specific validation errors that occurred. The client can use this information to correct the errors and resubmit the request.

What causes a 422 status code?

A 422 status code is typically caused when a request is well-formed but the server is unable to process it because it contains semantic errors or does not meet certain conditions. Some common causes of a 422 status code include:

  • Validation errors: The server is unable to process the request because the submitted data contains errors or is incomplete. For example, if a required field is missing or the data format is invalid.
  • Business logic errors: The server is unable to fulfill the request because it violates some business rule or constraint. For example, if a user tries to register with an email address that is already in use.
  • Authorization errors: The server is unable to process the request because the user is not authorized to perform the requested action. For example, if a user tries to delete a resource that they do not have permission to delete.
  • Data conflicts: The server is unable to process the request because it conflicts with existing data. For example, if a user tries to update a resource that has been updated by another user in the meantime.

It is important to note that the exact cause of a 422 status code may vary depending on the specific application and its implementation.

How to fix a 422 status code

A 422 status code indicates that the server was unable to process the request because it contains invalid data. To fix a 422 status code, you need to identify the specific data that caused the issue and correct it. Here are some steps you can follow:

  1. Check the request payload: The 422 status code typically occurs when there is an issue with the request payload. Check the data being sent to the server and ensure that it is formatted correctly and is valid.
  2. Validate the input: Validate the input received by the server to ensure that it adheres to the defined structure and data types. If any of the input data is invalid, return a detailed error message to the client.
  3. Provide helpful error messages: Provide clear and informative error messages that can help the client identify the issue and correct it. This can help the client resolve the issue more quickly and minimize the number of 422 errors in the future.
  4. Test thoroughly: Ensure that your code is thoroughly tested to catch any validation errors or other issues that could cause a 422 status code.

By following these steps, you can fix the issues causing the 422 status code and ensure that the server is able to process the request successfully.

Additional resources

  • Learn about web development
  • Learn about SEO
  • Web development services from WebFX
  • SEO services from WebFX
  • MDN Web Docs
  • W3Schools

Return to List of HTTP Status Codes

Selecting a proper HTTP Response Code makes REST API more descriptive. However, developers are lazy. While reviewing a REST API, I’ve seen a lot of cases, that the only response codes returned were HTTP 500 (aka “backend is not working”) and 400 (broadly known as “frontend messed up”). “Better” APIs were also returning 404 and authentication/authorization failure codes, but still, they should not be named as RESTFull. Such an approach is fast to implement and covers most of the use cases. But have you ever wonder, what will happen if developers have the possibility and time to experiment? They will delve into it.


This article has to make you pay attention to the quality of messages returned by your API, with the biggest focus on 422 Unprocessable Entity status codes. Selecting response codes carefully will make your API more descriptive and easier to use, reducing feedback loop time needed for root cause analysis.

The need for proper status

One day in my work, we were implementing some API, that was consuming JSON. Nothing special, but there was some logic behind two fields sent in a message payload.

curl for sample command invocation.

Generally, the time difference between dates could not be bigger than some period. Tests, that we wrote for this endpoint, were checking if HTTP 400 Bad Request was returned in case of the too broad time range. Looked solid, but during code review, we got a comment, if is this a good status code, as request syntax is perfectly valid, but semantics is here a problem. Well, that started a very long discussion.

Word on Client Error codes

In general, response codes classes start with very broad information. For Client Error codes it is HTTP 400 Bad request, originally meaning “request sent by client has a malformed syntax”, which was very strict about the reason behind this status. Later, in updating RFC 7231, the definition of 400 was defined less restrictive. Since 2014, it is just information about potential client problem, that sent an invalid request. Neither specific nor descriptive. Hopefully, there are a lot of other status codes, that could be used.

Looking on a list published on IANA or Mozilla Developer Center, we can see that they are more and more specific, from authorization issues, through invalid header values, to legal problems, so probably there is an error code that will fit our needs. In our case, we got a suggestion that 422 Unprocessable Entity could be used.

Doubts about 422

Request that we sent was perfectly fine in the matter of syntax, as the content type was understood by the server, and its body was successfully parsed. The problem was just in data that was provided within the body, which made our case a perfect situation for Unprocessable Entity status. Such a situation might happen for some reasons, e.g. because of logic behind command processing, like a requirement that selected period cannot be bigger than 60 days. That could be achieved by changing userRegisteredTo field value to out of the defined range.

In this case, requested command contained date range for over 60 days.

Even if requested command syntax was correct, data inside it was not. It can also happen in other scenarios, that check the quality of provided data, like in one below, where a user wants to set prices for shipping packages to some country but is trying to use the currency that cannot be used within it:

Imagine, that system that you are developing allows for paying in euro and some cryptocurrency in Germany, but not in United States dollars.

Even if our cases looked like a perfect match for 422 status code, we still had concerns regarding if it should be used. It is not a part of the standard HTTP protocol but is a part of its extension called WebDAV. WebDAV is used for managing resources, usually files, directories, and its properties. As we were not implementing anything related to WebDAV, it looked like an overhead. We were going to use only one response code defined in whole, over 120 pages documentation. We liked the response code, but we needed proof that we can use it.

So, why we decided to utilise it?

To get an argument for using code from extension to plain HTTP, we need to take a step back and check original documentation one more time. Fortunately, in a section that is describing status codes there is one, very important sentence for us:

HTTP status codes are extensible.

This opens a lot of doors for using available extensions. There is a huge benefit in using specific response codes, as it provides information about the root cause of the problem. Knowing what was wrong, API clients can perform retry, tell users to fix the data, or authorize again, depending on retrieved status. It could not be possible with returning general HTTP 400 Bad Request in response.

Can the response be more descriptive?

Take the benefit of various response code, and inform clients about the source of a problem. If no code will match your need, remember that HTTP statuses are extensible, so look for best one also within extensions, or as a last resort — create your own one. If that is not enough for your case, consider implementing Problem Details for your API. Problem details can give huge insight for a user that is using your API, e.g. when requested setting price for shipping in invalid currency, apart from status code, it could provide response body like:

{
    "type": "/errors/currency-is-not-supported-in-country",
    "title": "Requested currency cannot be used in this country.",
    "status": 422,
    "detail": "Germany supports only currencies: EUR, BTC",
    "instance": "/errors/currency-is-not-supported-in-country/7291562",
    "requestedCountry": "Germany",
    "requestedCurrency": "USD"
}

Format of response is standardized, if you are interested in it, please refer to the documentation.

Security consideration

Descriptive responses from your API may accidentally expose valuable information for attackers. You should not expose information about your infrastructure (webserver implementation, database version), or used language and its version. Make sure to never return any stack trace within your response body. All this information can allow malicious users to use exploits and break your application. You can also perform some additional steps to protect yourself, as not always returning detail is desirable behaviour.

Hiding some HTTP response codes can increase security

Photo by ÉMILE SÉGUIN 🇨🇦 on Unsplash

Hiding what should not be visible

One of the things, that can improve your API security, is hiding details from a user that do not have access to a resource. Let’s visualize it with resource providing business deal details under /api/contracts/32167. Who should be able to see those details? Probably only allowed users. Even more, probably not allowed users should even not know if such resource exists. Therefore, if an unauthorized user A would request for this contract details, it could get a response 404 Not Found (instead of 403 Forbidden), which will hide from him even existence of such agreement.

A similar situation should happen for a user that is not logged in. Instead of returning 403 Forbidden for protected resources and 404 Not Found for not existing ones, it might be valuable to return 401 Unauthorized for all non-public resources. Usually, users, who are not authorized, are not consumers of API, so they should not retrieve detailed reasons.

Design API responsibly

Meaningful responses are simplifying communication, leaving no room for guesses that may lead to long hours for analysing the root cause. Being strict and precise in HTTP responses will cause your API more discoverable and easier to use for your clients. Just make sure, that you will not tell them too much.

Featured photo by andreas160578 on pixabay.

  1. 400 Bad Request
  2. 403 Forbidden
  3. 404 Not Found
  4. 405 Method Not Allowed
  5. 406 Not Acceptable
  6. 409 Conflict
  7. 410 Gone
  8. 413 Payload Too Large
  9. 415 Unsupported Media Type
  10. 422 Unprocessable Entity
  11. 429 Too Many Requests
  12. The status of verifying the right to manage the site (ApiVerificationState)
  13. Rights verification methods (ApiVerificationType)
  14. Explicit methods of rights verification (ApiExplicitVerificationType)
  15. Reasons for refusal to verify site management rights (ApiVerificationFailReason)
  16. Source of the Sitemap file (ApiSitemapSource)
  17. Type of Sitemap file (ApiSitemapType)
  18. Site indexing status (ApiHostDataStatus)
  19. Indexing indicators (ApiIndexingIndicator)
  20. Query indicators (ApiQueryIndicator)
  21. Query sorting order (ApiQueryOrderField)
  22. Device type indicators (ApiDeviceTypeIndicator)
  23. Indicators of external links (ApiExternalLinksIndicator)
  24. Internal link indicators (ApiInternalLinksBrokenIndicator)
  25. Reindexing request status (RecrawlStatusEnum)
  26. Issue categories on the site (SiteProblemSeverityEnum)
  27. State of the issue (ApiSiteProblemState)
  28. Type of site issue (ApiSiteProblemTypeEnum)
  29. HTTP status codes received by the robot during indexing (IndexingStatusEnum)
  30. Site page status in search results (ApiSearchEventEnum)
  31. Changes to important pages in the search (ApiImportantUrlChangeIndicator)
  32. Reasons for excluding the page from search results (ApiExcludedUrlStatus)
  33. RSS feed upload modes (PagesLoadMode)
  34. RSS feed upload mode filter (TaskTypeFilter)
  35. Status of the RSS feed upload task (LoadStatus)

ENTITY_VALIDATION_ERROR

The request body validation failed.

{
  "error_code": "ENTITY_VALIDATION_ERROR",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
error_message Error message.

FIELD_VALIDATION_ERROR

Invalid parameter passed.

{
  "error_code": "FIELD_VALIDATION_ERROR",
  "error_message": "explicit error message",
  "field_name": "some string",
  "field_value": "some string",
  "error_message": "explicit error message"
}

Parameter Description
error_code Error code.
field_name Field.
field_value Value.
error_message Error message.

INVALID_URL

Wrong URL was passed.

{
  "error_code": "INVALID_URL",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
error_message Error message.

ACCESS_FORBIDDEN

The action is unavailable because the application doesn’t have the necessary permissions.

{
  "error_code": "ACCESS_FORBIDDEN",
  "error_message": "explicit error message"
}

Parameter Description
error_code Error code.
error_message Error message.

INVALID_OAUTH_TOKEN

The OAuth token is missing or invalid.

{
  "error_code": "INVALID_OAUTH_TOKEN",
  "error_message": "explicit error message"
}

Parameter Description
error_code Error code.
error_message Error message.

INVALID_USER_ID

The ID of the user who issued the token differs from the one specified in the request. In the examples below, {user_id} shows the correct uid of the OAuth token owner.

{
  "error_code": "INVALID_USER_ID",
  "available_user_id": 1,
  "error_message": "Invalid user id. {user_id} should be used."
}

Parameter Description
error_code Error code.
available_user_id ID of the user who allowed access.
error_message Error message.

LICENCE_NOT_ACCEPTED

You have to accept the User agreement.

{
  "error_code": "LICENCE_NOT_ACCEPTED",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
error_message Error message.

HOSTS_LIMIT_EXCEEDED

The number of sites in the user’s site list exceeded the limit (the current limit is 1703).

{
 "error_code": "HOSTS_LIMIT_EXCEEDED",
 "limit": 1,
 "error_message": "explicit error message"
}

Parameter Description
error_code Error code.
limit The limit on the number of added sites.
error_message Error message.

RESOURCE_NOT_FOUND

The resource at the requested path does not exist.

{
  "error_code": "RESOURCE_NOT_FOUND",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
error_message Error message.

HOST_NOT_INDEXED

The site isn’t indexed yet.

{
  "error_code": "HOST_NOT_INDEXED", //errorCode. 
  "host_id": "http:ya.ru:80", //id хоста. host id. 
  "error_message": "some string" //Error message. 
}

Parameter Description
error_code Error code.
host_id ID of the requested site.
error_message Error message.

HOST_NOT_LOADED

The site data isn’t uploaded to Yandex.Webmaster yet.

{
  "error_code": "HOST_NOT_LOADED",
  "host_id": "http:ya.ru:80",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
host_id ID of the requested site.
error_message Error message.

HOST_NOT_VERIFIED

Site management rights are not verified.

{
  "error_code": "HOST_NOT_VERIFIED",
  "host_id": "http:ya.ru:80",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
host_id ID of the requested site.
error_message Error message.

HOST_NOT_FOUND

The site is not in the list of the user’s sites.

{
  "error_code": "HOST_NOT_FOUND",
  "host_id": "http:ya.ru:80",
  "error_message": "explicit error message"
}

Parameter Description
error_code Error code.
host_id ID of the requested site.
error_message Error message.

SITEMAP_NOT_FOUND

The Sitemap for the site wasn’t found.

{
  "error_code": "SITEMAP_NOT_FOUND",
  "host_id": "http:ya.ru:80",
  "sitemap_id": "c7-fe:80-c0",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
host_id ID of the requested site.
sitemap_id The Sitemap file ID.
error_message Error message.

SITEMAP_NOT_ADDED

The Sitemap file is missing.

{
  "error_code": "SITEMAP_NOT_ADDED",
  "host_id": "http:ya.ru:80",
  "sitemap_id": "c7-fe:80-c0",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
host_id ID of the requested site.
sitemap_id The Sitemap file ID.
error_message Error message.

TASK_NOT_FOUND

Failed to find a task with the specified ID.

{
  "error_code": "TASK_NOT_FOUND",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
error_message Error message.

QUERY_ID_NOT_FOUND

The specified search query ID does not exist.

{
  "error_code": "QUERY_ID_NOT_FOUND",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
error_message Error message.

The HTTP method is not supported for this resource.

{
  "error_code": "METHOD_NOT_ALLOWED",
  "error_message": "explicit error message"
}

Parameter Description
error_code Error code.
error_message Error message.

The content types passed in the Accept header are not supported.

{
  "error_code": "CONTENT_TYPE_UNSUPPORTED",
  "acceptable_types": [
    "some string", ...
  ],
  "error_message": "explicit error message"
}

Parameter Description
error_code Error code.
acceptable_type List of supported content types.
error_message Error message.

URL_ALREADY_ADDED

The URL was already added for reindexing.

{
  "error_code": "URL_ALREADY_ADDED",
  "error_message": "some string"
}

Parameter Description
error_code Error code.
error_message Error message.

HOST_ALREADY_ADDED

The site with the specified address is already added to the user’s sites list.

{
  "error_code": "HOST_ALREADY_ADDED",
  "host_id": "http:ya.ru:80",
  "verified": false,
  "error_message": "some string"
}

<Data>
  <error_code>HOST_ALREADY_ADDED</error_code> 
  <host_id>http:ya.ru:80</host_id> 
  <verified>false</verified> 
  <error_message>some string</error_message>
</Data>

Parameter Description
error_code Error code.
host_id The site ID.
verified Indicates if the site rights are verified.
error_message Error message.

VERIFICATION_ALREADY_IN_PROGRESS

The rights verification process is in progress.

{
  "error_code": "VERIFICATION_ALREADY_IN_PROGRESS",
  "verification_type": "META_TAG",
  "error_message": "some string"
}

<Data>
  <error_code>VERIFICATION_ALREADY_IN_PROGRESS</error_code>  
  <verification_type>META_TAG</verification_type> 
  <error_message>some string</error_message>
</Data>

Parameter Description
error_code Error code.
verification_type The verification method being processed ( ApiExplicitVerificationType ).
error_message Error message.

TEXT_ALREADY_ADDED

The text you added earlier.

{
  "error_code": "TEXT_ALREADY_ADDED",
  "error_message": "some string"
}

<Data>
  <error_code>TEXT_ALREADY_ADDED</error_code>  
  <error_message>some string</error_message>
</Data>

Parameter Description
error_code Error code.
error_message Error message.

SITEMAP_ALREADY_ADDED

The Sitemap was already added.

{
  "error_code": "SITEMAP_ALREADY_ADDED",
  "sitemap_id": "c7-fe:80-c0",
  "error_message": "some string"
}

<Data>
  <error_code>SITEMAP_ALREADY_ADDED</error_code> 
  <sitemap_id>c7-fe:80-c0</sitemap_id>  
  <error_message>some string</error_message>
</Data>

Parameter Description
error_code Error code.
sitemap_id The Sitemap file ID.
error_message Error message.

Resource unavailable

{
  "error_code": "UPLOAD_ADDRESS_EXPIRED",
  "valid_until": "2016-01-01T00:00:00,000+0300",
  "error_message": "some string"
}

<Data>
  <error_code>UPLOAD_ADDRESS_EXPIRED</error_code>
  <valid_until>2016-01-01T00:00:00,000+0300</valid_until>
  <error_message>some string</error_message>
</Data>

Parameter Description
error_code Error code.
valid_until The date and time until which the URL for task creation is available.
error_message Error message.

The file size exceeds the limits.

{
  "error_code": "REQUEST_ENTITY_TOO_LARGE",
  "error_message": "some string"
}

<Data>
  <error_code>REQUEST_ENTITY_TOO_LARGE</error_code>
  <error_message>some string</error_message>
</Data>

Parameter Description
error_code Error code.
error_message Error message.

CONTENT_TYPE_UNSUPPORTED

The content type in the request is not supported.

{
  "error_code": "CONTENT_TYPE_UNSUPPORTED",
  "supported_content_types": [
    "some string", ...
  ],
  "error_message": "explicit error message"
}

<Data>
    <error_code>CONTENT_TYPE_UNSUPPORTED</error_code>
    <supported_content_type>some string</supported_content_type>
    ...
    <error_message>explicit error message</error_message>
</Data>

Parameter Description
error_code Error code.
supported_content_type List of supported content types.
error_message Error message.

CONTENT_ENCODING_UNSUPPORTED

The request encoding type is not supported.

{
  "error_code": "CONTENT_ENCODING_UNSUPPORTED",
  "supported_content_encodings": [
    "some string"
  ],
  "error_message": "some string"
}

<Data>
  <error_code>CONTENT_ENCODING_UNSUPPORTED</error_code> 
  <supported_content_encoding>some string</supported_content_encoding>  
  <error_message>some string</error_message>
</Data>

Parameter Description
error_code Error code.
supported_content_encoding List of supported encoding types.
error_message Error message.

The passed text is too short or too long.

{
  "error_code": "TEXT_LENGTH_CONSTRAINTS_VIOLATION",
  "max_length": 1,
  "min_length": 1,
  "actual_length": 1,
  "error_message": "explicit error message"
}

<Data>
  <error_code>TEXT_LENGTH_CONSTRAINTS_VIOLATION</error_code>
    <max_length>1</max_length>
    <min_length>1</min_length>
    <actual_length>1</actual_length>
  <error_message>explicit error message</error_message>
</Data>

Parameter Description
error_code Error code.
max_length Maximum length.
min_length Minimum length.
actual_length The length of the text in the request.
error_message Error message.

QUOTA_EXCEEDED

The daily quota for requests was exceeded.

{
  "error_code": "QUOTA_EXCEEDED",
  "daily_quota": 1,
  "exceeded_until": "2016-01-01T00:00:00,000+0300",
  "error_message": "some string"
}

<Data>
  <error_code>QUOTA_EXCEEDED</error_code>  
  <daily_quota>1</daily_quota>  
  <exceeded_until>2016-01-01T00:00:00,000+0300</exceeded_until>  
  <error_message>some string</error_message>
</Data>

Parameter Description
error_code Error code.
daily_quota The maximum number of requests per day.
exceeded_until Time when the new quota starts.
error_message Error message.

TOO_MANY_REQUESTS_ERROR

Too many requests sent.

{
  "error_code": "TOO_MANY_REQUESTS_ERROR",
  "daily_quota": 1,
  "exceeded_until": "2016-01-01T00:00:00,000+0300",
  "error_message": "some string"
}

<Data>
  <error_code>TOO_MANY_REQUESTS_ERROR</error_code>  
  <daily_quota>1</daily_quota>  
  <exceeded_until>2016-01-01T00:00:00,000+0300</exceeded_until>  
  <error_message>some string</error_message>
</Data>

Parameter Description
error_code Error code.
daily_quota The maximum number of requests per day.
exceeded_until Time when the new quota starts.
error_message Error message.
Status Description
NONE Verification wasn’t completed and rights are not confirmed.
VERIFIED The rights are verified.
IN_PROGRESS The rights verification is in progress.
VERIFICATION_FAILED Verification was performed but rights are not confirmed.
INTERNAL_ERROR An unexpected error occurred when verifying the rights.
Verification method Whether a verification check can be requested Description
AUTO No Automatic rights verification (deprecated; only for *.narod.ru sites).
DELEGATED No Rights were delegated.
DNS Yes Verifying rights with the DNS record.
HTML_FILE Yes Placing an HTML file in the site’s root directory.
META_TAG Yes Adding a meta tag to the site’s home page header.
PDD No Rights verification via Yandex.Mail for Domains.
TXT_FILE No Placing a text file in the site’s root directory.
WHOIS Yes

Verifying data with information provided by the WHOIS service.

This method works only for second-level domains (such as example.com).

Verification method Whether a verification check can be requested Description
DNS Yes Verifying rights with the DNS record.
HTML_FILE Yes Placing an HTML file in the site’s root directory.
META_TAG Yes Adding a meta tag to the site’s home page header.
WHOIS Yes

Verifying data with information provided by the WHOIS service.

This method works only for second-level domains (such as example.com).

Reason for refusal Description
DELEGATION CANCELLED Delegation of site management rights was canceled.
DNS_RECORD_NOT_FOUND The specified DNS record doesn’t exist.
META_TAG_NOT_FOUND The meta tag is missing in the site’s home page header.
PDD_VERIFICATION_CANCELLED Verification of site management rights via Yandex.Mail for Domain isn’t allowed for this site.
WHOIS_EMAIL_NOT_FOUND The specified email address is missing in the WHOIS record for this site.
WRONG_HTML_PAGE_CONTENT The HTML file content is set incorrectly.
Source Description
ROBOTS_TXT Sitemap is specified in the site’s robots.txt file.
WEBMASTER The user added the Sitemap in Yandex.Webmaster.
INDEX_SITEMAP Sitemap found in another (index) Sitemap file.
Type Description
SITEMAP Normal Sitemap file that contains the URLs of site pages.
INDEX_SITEMAP The Sitemap index file that contains the URLs of other Sitemap files.
Source Description
NOT_INDEXED The site isn’t indexed yet.
NOT_LOADED The site data isn’t uploaded to Yandex.Webmaster yet.
OK The site is indexed. The data is available in Yandex.Webmaster.
Indicator Description
SEARCHABLE Pages in the search.
DOWNLOADED Downloaded pages.
DOWNLOADED_2XX Pages downloaded with a 2XX code.
DOWNLOADED_3XX Pages downloaded with a 3XX code.
DOWNLOADED_4XX Pages downloaded with a 4XX code.
DOWNLOADED_5XX Pages downloaded with a 5XX code.
FAILED_TO_DOWNLOAD Failed to download.
EXCLUDED Excluded pages.
EXCLUDED_DISALLOWED_BY_USER Excluded at the request of the resource owner (4XX codes or prohibited in robots.txt).
EXCLUDED_SITE_ERROR Excluded due to a site error.
EXCLUDED_NOT_SUPPORTED Excluded as not supported by the Yandex robots.
Indicator Description
TOTAL_SHOWS The number of displays.
TOTAL_CLICKS The number of clicks.
AVG_SHOW_POSITION The average position of the display.
AVG_CLICK_POSITION Average click position.
Indicator Description
TOTAL_SHOWS The number of displays.
TOTAL_CLICKS The number of clicks.
Indicator Description
ALL All device types.
DESKTOP Computers.
MOBILE_AND_TABLET Mobile phones and tablets.
MOBILE Mobile phones.
TABLET Tablets.

If the request does not specify a device type indicator, the default value is ALL.

Indicator Description
LINKS_TOTAL_COUNT The total number of known external links to the host.
Indicator Description
SITE_ERROR The total number of known external links to the site.
DISALLOWED_BY_USER The page doesn’t exist or is prohibited from indexing.
UNSUPPORTED_BY_ROBOT Not supported by the main Search indexing robot.
Indicator Description
IN_PROGRESS The request is being processed.
DONE The robot crawled the URL
FAILED The robot failed to crawl the page. Make sure it is accessible to the robot and the server responds fast enough.
Indicator Description Note
FATAL Fatal errors. Checks the server connection, site availability for indexing, security and compliance with Yandex guidelines.

This may lead to excluding individual pages or the entire site from search results.

We recommend monitoring these errors and fixing them as soon as possible.

CRITICAL Critical issues. Checks the presence and validity of the SSL certificate, the number of broken internal links, and the server response time.
POSSIBLE_PROBLEM Possible issues. Checks the Sitemap and robots.txt file validity, settings for displaying non-existent files, the number of duplicate pages, the presence of redirects, annoying ads, and so on. May affect the quality and speed of site indexing.
RECOMMENDATION Recommendations. Usually includes suggestions for improving the site’s ranking in search results. Use them to improve the site’s ranking in search results.
Indicator Description
PRESENT Present on the site.
ABSENT Missing.
UNDEFINED Not enough data to determine if there are issues.
Indicator Description
FATAL
DISALLOWED_IN_ROBOTS The site is prohibited for indexing in the robots.txt file.
DNS_ERROR Failed to connect to the server due to a DNS error.
MAIN_PAGE_ERROR The site’s home page returns an error.
THREATS Security threats or issues were detected.
CRITICAL
SLOW_AVG_RESPONSE_TIME Slow server response. For more information, see this Help section.
SSL_CERTIFICATE_ERROR Invalid SSL certificate settings. For more information, see this Help section.
POSSIBLE_PROBLEM
BAD_ADVERTISEMENT Ad formats do not comply with IAB Russia recommendations.
DOCUMENTS_MISSING_DESCRIPTION Many pages do not have the Description meta tag.
DOCUMENTS_MISSING_TITLE The title element is missing on many pages.
ERROR_IN_ROBOTS_TXT Errors in the robots.txt file.
ERRORS_IN_SITEMAPS Errors found in the Sitemap file.
MAIN_MIRROR_IS_NOT_HTTPS The site’s main mirror doesn’t use the HTTPS protocol We recommend using the HTTPS protocol. For more information and instructions on switching protocols, see the Help.
MAIN_PAGE_REDIRECTS The main page redirects to another site.
NO_METRIKA_COUNTER_CRAWL_ENABLED Site crawling using Yandex.Metrica tags isn’t enabled. For more information about site indexing using the Yandex.Metrica tag, see the Help.
NO_ROBOTS_TXT The robots.txt file wasn’t found.
NO_SITEMAPS The Sitemap files used by the robot are missing.
NO_SITEMAP_MODIFICATIONS The Sitemap files haven’t been updated for a long time.
NON_WORKING_VIDEO The robot failed to index videos on the site.
SOFT_404 The display of non-existent files and pages is configured incorrectly.
TOO_MANY_DOMAINS_ON_SEARCH The site subdomains are found in the search results.
TOO_MANY_PAGE_DUPLICATES Too many duplicate pages.
RECOMMENDATION
FAVICON_PROBLEM The favicon file was not found. The robot failed to load an image file to display in the browser tab and next to the site name in the search results. For more information about this error and how to fix it, see the help section.
INCOMPLETE_SPRAV_COMPANY_PROFILE Yandex.Directory contains incomplete information about the organization.
NO_CHATS Chats on Search are missing.
NO_METRIKA_COUNTER Yandex.Metrica tag error
NO_REGIONS The site region isn’t set.
NOT_IN_SPRAV The site isn’t registered in Yandex.Directory.
NOT_MOBILE_FRIENDLY The site isn’t optimized for mobile devices.
Indicator Description

HTTP_2XX

HTTP_3XX

HTTP_4XX

HTTP_5XX

For more information about statuses, see the help section.
OTHER Unsupported HTTP code, connection error, or other error.
Indicator Description
APPEARED_IN_SEARCH The page appeared in search results.
REMOVED_FROM_SEARCH The page was removed from search results.
Indicator Description
INDEXING_HTTP_CODE The HTTP response code received by the robot when crawling the page changed.
SEARCH_STATUS The page status in the search changed (it was added or removed).
TITLE The page title changed.
DESCRIPTION The Description meta tag content changed.
Indicator Description
NOTHING_FOUND The robot doesn’t know about the page, or it was unavailable for a long time. Submit the page for reindexing.
HOST_ERROR When trying to access the site, the robot could not connect to the server. Check the server response and make sure that the Yandex robot isn’t blocked by the hosting provider. The site is indexed automatically when it becomes available for the robot. For information about the user agent robots, see the help section.
REDIRECT_NOTSEARCHABLE The page redirects to another page. The target page is indexed (RedirectTarget). Check the indexing of the target page.
HTTP_ERROR An error occurred when accessing the “HTTP error” page. Check the server response. If the problem persists, contact your site administrator or the server administrator. If the page is already available, submit it for reindexing.
NOT_CANONICAL The page is indexed by the canonical URL specified in the rel=»canonical» attribute in its source code. Correct or delete the attribute if it is specified incorrectly. The robot will track the changes automatically.
NOT_MAIN_MIRROR The page belongs to a secondary site mirror, so it was excluded from the search.
PARSER_ERROR When trying to access the page, the robot couldn’t get its content. Check the server response or the presence of prohibiting HTML elements. If the problem persists, contact your site administrator or the server administrator. If the page is already available, send it for reindexing.
ROBOTS_HOST_ERROR Site indexing is prohibited in the robots.txt file. The robot will automatically start crawling the page when the site becomes available for indexing.
ROBOTS_URL_ERROR Page indexing is prohibited in the robots.txt file. The robot will automatically crawl the page when it becomes available for indexing.
DUPLICATE The page duplicates a site page that is already in the search. For more information, see the help section.
LOW_QUALITY The page has been removed from search results due to low quality as determined by a special algorithm. If the algorithm finds the page relevant to users’ search queries, it will appear in the search automatically.
CLEAN_PARAMS The page was excluded from the search after the robot processed the Clean-param directive. To get the page indexed, edit the robots.txt file.
NO_INDEX The page is excluded because the robots meta tag has the noindex value.
OTHER

The robot does not have updated data for the page.

Check the server response or the presence of prohibiting HTML elements.

If the page can’t be accessed by the robot, contact the administrator of your site or server. If the page is already available, send it for reindexing.

Indicator Description
DEBUG Debugging the Turbo page display.
PRODUCTION Turbo pages publishing.
Indicator Description
DEBUG Debugging the Turbo page display.
PRODUCTION Turbo pages publishing.
ALL Getting information about both task types.
Indicator Description
PROCESSING The file is checked for errors.
OK The file is loaded and it doesn’t contain errors.
WARNING XML elements in the file aren’t supported by Yandex or are specified incorrectly.
ERROR The file contains errors (for example, duplicate XML elements).

Понравилась статья? Поделить с друзьями:

Не пропустите эти материалы по теме:

  • Яндекс еда ошибка привязки карты
  • Apex ошибка engine error audio
  • Apple music ошибка 66681
  • Apple music 22950 ошибка
  • Apple mobile device usb driver ошибка

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии