Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-access
<?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-access $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": "0.1.20221214", "status_code": 20000, "status_message": "Ok.", "time": "0.0806 sec.", "cost": 0, "tasks_count": 1, "tasks_error": 0, "tasks": [ { "id": "03302011-1535-0161-0000-99c1c52351b3", "status_code": 20000, "status_message": "Ok.", "time": "0.0000 sec.", "cost": 0, "result_count": 46, "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": 40006, "message": "You can set no more than 100 tasks at a time." }, { "code": 40100, "message": "You are not authorized to access this resource. See your login details here: https://app.dataforseo.com/api-access ." }, { "code": 40101, "message": "Internal SE Server Error." }, { "code": 40102, "message": "No Search Results." }, { "code": 40103, "message": "Task execution failed, please try to resubmit the task." }, { "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-settings ." }, { "code": 40204, "message": "Access denied. Visit Plans and Subscriptions to activate your subscription and get access to this API: https://app.dataforseo.com/users/getrows ." }, { "code": 40205, "message": "The duplicate task limit per hour has been exceeded. You can modify your limits in the user panel https://app.dataforseo.com/api-settings ." }, { "code": 40206, "message": "The duplicate task limit per day has been exceeded. You can modify your limits in the user panel https://app.dataforseo.com/api-settings ." }, { "code": 40207, "message": "Access denied. Your IP is not whitelisted. You can modify your IP whitelist in the user panel hhttps://app.dataforseo.com/api-access ." }, { "code": 40209, "message": "Too many simultaneous queries." }, { "code": 40210, "message": "Insufficient Funds. Your account's balance is too low to complete this request." }, { "code": 40400, "message": "Not Found." }, { "code": 40401, "message": "Task Not Found." }, { "code": 40402, "message": "Invalid Path." }, { "code": 40403, "message": "Results Expired." }, { "code": 40404, "message": "No Prepared Data Found. Please Contact Our Support Team." }, { "code": 40405, "message": "Textual content on the target page is insufficient." }, { "code": 40406, "message": "Requested page was not submitted for crawling." }, { "code": 40501, "message": "Invalid Field." }, { "code": 40502, "message": "POST Data Is Empty." }, { "code": 40503, "message": "POST Data Is Invalid." }, { "code": 40504, "message": "The number of intersecting keywords for the specified domains exceeds 10 million. Try specifying different domains." }, { "code": 40505, "message": "You are using old data." }, { "code": 40506, "message": "Unknown Fields in POST Data." }, { "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": 50100, "message": "Not Implemented." }, { "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." }, { "code": 50401, "message": "Internal Error - Timeout." }, { "code": 50402, "message": "Target page took too long to respond." } ] } ] }
This endpoint returns a list of possible DataForSEO API errors and general status codes. Below you will find a list of HTTP response codes and internal messages. We recommend storing the data connected to error codes in your application log and designing a necessary system for handling related exceptional or error conditions.
Note: DataForSEO API servers always return 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-access |
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 | Description |
---|---|---|
20000 |
Ok. | the request has been successfully completed |
20100 |
Task Created. | as a result of the successful request, the task has been created |
40000 |
You can set only one task at a time. | you cannot specify more than one task in the POST array |
40001 |
This id is used by another client, check the id. | the task identifier id is unique to the client used to send the request |
40002 |
This id is used by another search engine, check the Path. | the task identifier id is unique to the search engine used in the URL path of the request |
40003 |
This id is used by another search type, check the Path. | the task identifier id is unique to the search type used in the URL path of the request |
40004 |
This id is used by another function, check the id. | the task identifier id is unique to the function used in the URL path of the request |
40006 |
You can set no more than 100 tasks at a time. | each POST request can contain up to 100 tasks |
40100 |
You are not authorized to access this resource. See your login details here: https://app.dataforseo.com/api-access . | check if the specified credentials match those in your account dashboard |
40101 |
Internal SE server error. | the requested search engine was unable to process your request and responded with an error |
40102 |
No Search Results. | no results matching the details of your request have been found |
40103 |
Task execution failed, please try to resubmit the task. | the task could not be executed, try posting another task with similar parameters |
40200 |
Payment Required. | the request cannot be completed until the balance is recharged; check your balance in the account dashboard |
40201 |
Our algorithms found suspicious activity in your DataForSEO account. It has been temporarily blocked. For further details please contact our support team. | you are using several trial accounts or have violated DataForSEO Terms of Service in some other way; therefore, your account has been blocked and you will not be able to access it or use any of DataForSEO APIs; contact our support team to resolve the issue |
40202 |
The rate-limit per minute has been exceeded. | you can make up to 2000 requests per minute; contact our support team if you need to increase the limit |
40203 |
The cost limit has been exceeded. You can modify your cost limit in the user panel https://app.dataforseo.com/api-access . | you can modify daily cost limits for APIs and endpoints in your account dashboard |
40204 |
Access denied. Visit Plans and Subscriptions to activate your subscription and get access to this API: https://app.dataforseo.com/users/getrows . | the access to Backlinks API is limited by a minimal commitment. Learn more. |
40205 |
The duplicate task limit per hour has been exceeded. You can modify your limits in the user panel https://app.dataforseo.com/api-settings. | you can modify the duplicate task limit in your account dashboard. Learn more. |
40206 |
The duplicate task limit per day has been exceeded. You can modify your limits in the user panel https://app.dataforseo.com/api-settings . | you can modify the duplicate task limit in your account dashboard. Learn more. |
40207 |
Access denied. Your IP is not whitelisted. You can modify your IP whitelist in the user panel https://app.dataforseo.com/api-access . | you can whitelist all the necessary IPs in the account dashboard. Learn more. |
40209 |
Too many simultaneous queries. | the limit for simultaneous requests made by a single user is 30 |
40210 |
Insufficient Funds. Your account’s balance is too low to complete this request. | visit your account dashboard to add funds; learn more about making payments |
40400 |
Not found. | the requested resource doesn’t exist; check the URL of the request |
40401 |
Task Not Found. | the requested task does not exist |
40402 |
Invalid Path. | the URL path of your request is invalid |
40403 |
Results Expired. | it’s not possible to retrieve the results of a task that was created more than a month ago |
40404 |
No Prepared Data Found.Please Contact Our Support Team. | the Sandbox does not contain prepared data for the task you set |
40405 |
Textual content on the target page is insufficient. | target page does not have enough textual data, please try specifying a different page |
40406 |
Requested page was not submitted for crawling. | the page was not submitted for crawling in Task POST |
40501 |
Invalid Field. | one of the fields in the POST request is invalid |
40502 |
POST Data Is Empty. | the body of your POST request is empty, please check the body structure and validity |
40503 |
POST Data is Invalid. | the structure of the POST request is invalid |
40504 |
The number of intersecting keywords for the specified domains exceeds 10 million. Try specifying different domains. | there are too many intersecting keywords for the specified domains, please try again with different domain names |
40505 |
You are using old data. | location parameters you are using are outdated, please check our documentation or call the relevant locations endpoint for up-tp-date parameters |
40506 |
Unknown Fields in POST Data. | the body of your POST request contains unknown fields, please consult the documentation of the requested endpoint and use available fields |
40601 |
Task Handed. | the task has been received but has not yet been enqueued for processing |
40602 |
Task in Queue. | the task has been enqueued for processing |
50000 |
Internal Error. | our system encountered an unexpected condition; please contact our support team |
50001 |
Error While Checking the Balance. | our system failed to check your account balance; please contact our support team |
50100 |
Not Implemented. | you specified a non-existing task or parameter, please check the body of your POST request |
50301 |
3rd Party API Service Unavailable. | one of our external data sources is currently unavailable or responded with an error; the error can be triggered by Google Ads API or other third-party services used by DataForSEO API; message of the error may vary depending on the third-party service status; corresponding message examples: Too many requests Could not connect to host 3rd Party API Service Unavailable
|
50303 |
Update is in progress. Please try after a few minutes | the API you’re requesting is being updated; this can take a few minutes |
50304 |
This function is temporarily unavailable. Please contact support for more information. | the function you’re requesting failed to respond; please contact our support team for more information |
50401 |
Internal Error – Timeout. | our system failed to process a live-mode task in 120 seconds; please try setting a task one more time |
50402 |
Target page took too long to respond. | target page took longer than 50 seconds to respond, please try again later or specify a different page |
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 |