> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.mercoa.com/embedded-ap-ar/api-reference/ocr/run-async-ocr/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mercoa.com/_mcp/server. # Run OCR (Async) POST https://api.mercoa.com/ocr-async Content-Type: application/json Run OCR on an Base64 encoded image or PDF. This endpoint will return immediately and the OCR will be processed asynchronously. Reference: https://docs.mercoa.com/embedded-ap-ar/api-reference/ocr/run-async-ocr ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Body (application/json) This endpoint expects an object. - `mimeType` (string, required) — MIME type of the image. Supported types are image/png, image/jpeg, and application/pdf. - `image` (string, required) — Base64 encoded image or PDF. PNG, JPG, WEBP, and PDF are supported. 10MB max. - `vendorNetwork` (enum, optional) — Limit OCR vendor search to a specific network - Allowed values: `all`, `platform`, `entity` - `entityId` (string, optional) — When using the Entity vendor network, specify the entity to use. EntityId on an auth token will take precedence over this parameter. - `splitDocument` (boolean, optional) — If true, attempt to split the document into subdocuments before processing. Default is false. If a document is split into subdocuments, the linked OCR jobs will be accessible via the linkedJobIds field on each OCR job response. ## Response ### 200 - `jobId` (string, required) ## Errors ### 400 Bad Request - `errorName` ("BadRequest", required) - `content` (string, required) ### 401 Unauthorized - `errorName` ("Unauthorized", required) - `content` (string, required) ### 403 Forbidden - `errorName` ("Forbidden", required) - `content` (string, required) ### 404 Not Found - `errorName` ("NotFound", required) - `content` (string, required) ### 409 Conflict - `errorName` ("Conflict", required) - `content` (string, required) ### 500 Internal Server Error - `errorName` ("InternalServerError", required) - `content` (string, required) ### 501 Unimplemented - `errorName` ("Unimplemented", required) - `content` (string, required) ## Examples **Request** ```json { "mimeType": "image/png", "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII", "vendorNetwork": "entity", "entityId": "ent_8f86116b-3b4d-4ded-99ef-3bc929d8c33c" } ``` **Response** ```json { "jobId": "ocr_8f86116b-3b4d-4ded-99ef-3bc929d8c33c" } ``` **SDK Code** ```python Default import requests url = "https://api.mercoa.com/ocr-async" payload = { "mimeType": "image/png", "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII", "vendorNetwork": "entity", "entityId": "ent_8f86116b-3b4d-4ded-99ef-3bc929d8c33c" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```typescript Default import { MercoaClient } from "@mercoa/javascript"; const client = new MercoaClient({ token: "YOUR_TOKEN" }); await client.ocr.runAsyncOcr({ vendorNetwork: "entity", entityId: "ent_8f86116b-3b4d-4ded-99ef-3bc929d8c33c", mimeType: "image/png", image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII" }); ``` ```go Default package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.mercoa.com/ocr-async" payload := strings.NewReader("{\n \"mimeType\": \"image/png\",\n \"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII\",\n \"vendorNetwork\": \"entity\",\n \"entityId\": \"ent_8f86116b-3b4d-4ded-99ef-3bc929d8c33c\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Default require 'uri' require 'net/http' url = URI("https://api.mercoa.com/ocr-async") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"mimeType\": \"image/png\",\n \"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII\",\n \"vendorNetwork\": \"entity\",\n \"entityId\": \"ent_8f86116b-3b4d-4ded-99ef-3bc929d8c33c\"\n}" response = http.request(request) puts response.read_body ``` ```java Default import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.mercoa.com/ocr-async") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"mimeType\": \"image/png\",\n \"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII\",\n \"vendorNetwork\": \"entity\",\n \"entityId\": \"ent_8f86116b-3b4d-4ded-99ef-3bc929d8c33c\"\n}") .asString(); ``` ```php Default request('POST', 'https://api.mercoa.com/ocr-async', [ 'body' => '{ "mimeType": "image/png", "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII", "vendorNetwork": "entity", "entityId": "ent_8f86116b-3b4d-4ded-99ef-3bc929d8c33c" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Default using RestSharp; var client = new RestClient("https://api.mercoa.com/ocr-async"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"mimeType\": \"image/png\",\n \"image\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII\",\n \"vendorNetwork\": \"entity\",\n \"entityId\": \"ent_8f86116b-3b4d-4ded-99ef-3bc929d8c33c\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Default import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "mimeType": "image/png", "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII", "vendorNetwork": "entity", "entityId": "ent_8f86116b-3b4d-4ded-99ef-3bc929d8c33c" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/ocr-async")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```