Format
Responses are JSON, except when you ask for one value with embed: then the API answers with that value itself, such as an image or an HTML document.
The JSON follows the JSend specification. Every response has a
status, and the other fields depend on it:{
"status": "success",
"data": { "title": "Example Domain" },
"statusCode": 200,
"headers": { "content-type": "text/html" },
"redirects": []
}{
"status": "fail",
"code": "EINVALURL",
"message": "The request has been not processed. See the errors above to know why.",
"more": "https://microlink.io/einvalurl",
"report": "https://feedback.microlink.io/api/v1/feedback?…",
"data": { "url": "The URL `notaurl` is not valid. Ensure it has protocol, hostname and is reachable." }
}A
pending response is only { "status": "pending" }.status
Type: <string>
The status associated with the response. The value can be:
- 'success': The request was resolved successfully. Associated with a 2xx HTTP status code other than 202.
- 'pending': A detach request is queued or running. Associated with the 202 HTTP status code. Send the same request again later.
- 'fail': The request failed. Associated with a 4xx or 5xx HTTP status code: a 4xx usually means a missing or wrong value for a parameter, and a 5xx something that went wrong on our side. The error code says which.
A simple rule here is, if the request was resolved successfully, then the 'success' status will be associated. In other case it is 'fail', and the HTTP status code tells a client error from a server one.
data
Type: <object>
On 'success', the data fields of the page. On 'fail', when present, what went wrong, keyed by the parameter it is about.
statusCode
Type: <number>
On 'success', the HTTP status code the target URL answered with, when known.
headers
Type: <object>
On 'success', the HTTP response headers of the target URL.
redirects
Type: <array>
On 'success', the redirects followed to reach the target URL, when known.
code
Type: <string>
message
Optional
Type: <string>
Type: <string>
On 'fail', a human readable sentence. When the response has
data, the details of the error are there.more
Type: <string>
On 'fail', a link to the documentation of the error code.
report
Optional
Type: <string>
Type: <string>
On 'fail', a link to report the problem to us, with the request already filled in.