NAVNavbar
Logo
php python csharp java

Errors

Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-dashboard

<?php
// You can download this file from here https://api.dataforseo.com/v3/_examples/php/_php_RestClient.zip
require('RestClient.php');
$api_url = 'https://api.dataforseo.com/';
try {
	// Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-dashboard
	$client = new RestClient($api_url, null, 'login', 'password');
} catch (RestClientException $e) {
	echo "\n";
	print "HTTP code: {$e->getHttpCode()}\n";
	print "Error code: {$e->getCode()}\n";
	print "Message: {$e->getMessage()}\n";
	print  $e->getTraceAsString();
	echo "\n";
	exit();
}
try {
	// using this method you can get a list of errors
	// GET /v3/appendix/errors
	$result = $client->get('/v3/appendix/errors');
	print_r($result);
	// do something with result
} catch (RestClientException $e) {
	echo "\n";
	print "HTTP code: {$e->getHttpCode()}\n";
	print "Error code: {$e->getCode()}\n";
	print "Message: {$e->getMessage()}\n";
	print  $e->getTraceAsString();
	echo "\n";
}
$client = null;
?>

The above command returns JSON structured like this:

{
  "version": "3.20191128",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.1062 sec.",
  "cost": 0,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "11281504-0696-0161-0000-a7e936db4c09",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0 sec.",
      "cost": 0,
      "result_count": 33,
      "path": [
        "v3",
        "appendix",
        "errors"
      ],
      "data": {
        "api": "appendix",
        "function": "errors"
      },
      "result": [
        {
          "code": 20000,
          "message": "Ok."
        },
        {
          "code": 20100,
          "message": "Task Created."
        },
        {
          "code": 40000,
          "message": "You can set only one task at a time."
        },
        {
          "code": 40001,
          "message": "This id is used by another client, check the id."
        },
        {
          "code": 40002,
          "message": "This id is used by another search engine, check the Path."
        },
        {
          "code": 40003,
          "message": "This id is used by another search type, check the Path."
        },
        {
          "code": 40004,
          "message": "This id is used by another function, check the id."
        },
        {
          "code": 40005,
          "message": "This id is used by another device type, check the id."
        },
        {
          "code": 40100,
          "message": "You are not authorized to access this resource. See your login details here: https://app.dataforseo.com/api-dashboard ."
        },
        {
          "code": 40101,
          "message": "Internal SE Server Error."
        },
        {
          "code": 40102,
          "message": "No Search Results."
        },
        {
          "code": 40200,
          "message": "Payment Required."
        },
        {
          "code": 40201,
          "message": "Our algorithms found suspicious activity in your DataForSEO account. It has been temporarily blocked. For further details please contact our support team."
        },
        {
          "code": 40202,
          "message": "The rate-limit per minute has been exceeded."
        },
        {
          "code": 40203,
          "message": "The cost limit has been exceeded. You can modify your cost limit in the user panel https://app.dataforseo.com/api-dashboard ."
        },
        {
          "code": 40400,
          "message": "Not Found."
        },
        {
          "code": 40401,
          "message": "Task Not Found."
        },
        {
          "code": 40402,
          "message": "Invalid Path."
        },
        {
          "code": 40403,
          "message": "Results Expired."
        },
        { 
          "code": 40501, 
          "message": "Invalid Field." 
        },
        {
          "code": 40601,
          "message": "Task Handed."
        },
        {
          "code": 40602,
          "message": "Task In Queue."
        },
        {
          "code": 50000,
          "message": "Internal Error."
        },
        {
          "code": 50001,
          "message": "Error While Checking the Balance."
        },
        {
          "code": 50301,
          "message": "3rd Party API Service Unavailable."
        },
        {
          "code": 50303,
          "message": "Update in progress. Please try after a few minutes."
        },
        {
          "code": 50304, 
          "message": "This function temporarily unavailable. Please contact support for more information." 
        }
      ]
    }
  ]
}

The DataForSEO API server always returns the 200 HTTP response code, except for the following cases.

HTTP response codes:

Code Message Description
401 Unauthorized You are not authorized to access this resource. See your login details here: https://app.dataforseo.com/api-dashboard
402 Payment Required We had a problem billing your account. Please, check your account’s balance.
404 Not Found Requested endpoint not found
500 Internal Server Error Sorry, we could not process your request due to the internal server error. Please, try again later.

 

Alongside the 200 HTTP code, our system also generates internal status codes which you may find in status_code and status_message fields of the API response.

Note: status messages can be expanded in the API response and may vary depending on the event that triggered them.

Internal status codes and messages:

Code Message
20000 Ok.
20100 Task Created.
40000 You can set only one task at a time.
40001 This id is used by another client, check the id.
40002 This id is used by another search engine, check the Path.
40003 This id is used by another search type, check the Path.
40004 This id is used by another function, check the id.
40005 This id is used by another device type, check the id.
40006 You can set no more than 100 tasks at a time.
40100 You are not authorized to access this resource. See your login details here: https://app.dataforseo.com/api-dashboard .
40101 Internal SE Server Error.
40102 No Search Results.
40200 Payment Required.
40201 Our algorithms found suspicious activity in your DataForSEO account. It has been temporarily blocked. For further details please contact our support team.
40202 The rate-limit per minute has been exceeded.
40203 The cost limit has been exceeded. You can modify your cost limit in the user panel https://app.dataforseo.com/api-dashboard .
40400 Not Found.
40401 Task Not Found.
40402 Invalid Path.
40403 Results Expired.
40501
Invalid Field.
40601 Task Handed.
40602 Task In Queue.
50000 Internal Error.
50001 Error While Checking the Balance.
50301 3rd Party API Service Unavailable.
50303 Update in progress. Please try after a few minutes.
50304 This function temporarily unavailable. Please contact support for more information.

 

You can also get the list of internal error codes by calling the ‘Errors’ endpoint:

By calling this endpoint you will receive information about the possible error codes.

‌‌As a response of the API server, you will receive JSON-encoded data containing a tasks array with the information specific to the set tasks.

Field name Type Description
version string the current version of the API
status_code integer general status code
you can find the full list of the response codes here
status_message string general informational message
you can find the full list of general informational messages here
time string total execution time, seconds
cost float total tasks cost, USD
tasks_count integer the number of tasks in the tasks array
tasks_error integer the number of tasks in the tasks array returned with an error
tasks array array of tasks
        id string task identifier
unique task identifier in our system in the UUID format
        status_code integer status code of the task
generated by DataForSEO, can be within the following range: 10000-60000
you can find the full list of the response codes here
        status_message string informational message of the task
you can find the full list of general informational messages here
        time string execution time, seconds
        cost float cost of the task, USD
        result_count integer number of elements in the result array
        path array URL path
        data array contains the same parameters that you specified in the POST request
        result array array of results
            code integer code
            message string message