> For clean Markdown of any page, append `.md` to the page URL. > For a complete documentation index, see https://docs.sarvam.ai/llms.txt. > For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server. # Get Job Results GET https://api.sarvam.ai/doc-ai/v1/job/{job_id}/results Returns terminal job results. Results are never available while a job is running; requesting them before a terminal status returns `409`. **Digitise results** include `job_id`, `type`, `status`, `usage` and `documents`. **Extract results** include `job_id`, `type`, `status`, `usage`, `result`, `annotations` and `version`. `annotations` mirrors the result shape; every leaf has `confidence` and `sources`. Reference: https://docs.sarvam.ai/api-reference/doc-ai/job/results ## Authentication - `api-subscription-key` header (required) — API Key authentication via header ## Request ### Path parameters - `job_id` (string, required) — The unique identifier of the job ### Query parameters - `format` (string, optional) — Output format of the results, e.g. `json`. ## Response ### 200 OK - `docAI_get_results_Response_200` - `type`: `extract` (extract) - `annotations` (DocAiV1JobJobIdResultsGetResponsesContentApplicationJsonSchemaDiscriminatorMappingExtractAnnotations, required) — Mirrors `result`, with each leaf replaced by its `confidence` and `sources`. - `job_id` (string, required) — The unique identifier of the job. - `result` (DocAiV1JobJobIdResultsGetResponsesContentApplicationJsonSchemaDiscriminatorMappingExtractResult, required) — Structured field values, shaped by the schema or `config_id` used to create the job. - `status` (string, required) — Terminal status of the job: `completed`, `partially_completed`, `failed`, or `rejected`. - `usage` (DocAIUsage, required) - `version` (integer, required) — Version of the schema or config used. - `type`: `digitise` (digitise) - `documents` (list of DocAiV1JobJobIdResultsGetResponsesContentApplicationJsonSchemaDiscriminatorMappingDigitiseDocumentsItems, required) — One entry per input document, each holding per-page content. - `job_id` (string, required) — The unique identifier of the job. - `status` (string, required) — Terminal status of the job: `completed`, `partially_completed`, `failed`, or `rejected`. - `usage` (DocAIUsage, required) ## Errors ### 404 Not Found Error Job not found - `type` (string, optional, default: about:blank) — A URI reference to human-readable documentation for the error. - `title` (string, optional) — A short, human-readable summary of the problem type. - `status` (integer, optional) — HTTP status code. - `detail` (string, optional) — A human-readable explanation specific to this occurrence of the problem. - `instance` (string, optional) — A URI reference that identifies the specific occurrence of the problem. - `errors` (list of DocAIErrorDetail, optional, nullable) — Optional list of individual error details. ### 409 Conflict Error Results requested before the job reached a terminal status - `type` (string, optional, default: about:blank) — A URI reference to human-readable documentation for the error. - `title` (string, optional) — A short, human-readable summary of the problem type. - `status` (integer, optional) — HTTP status code. - `detail` (string, optional) — A human-readable explanation specific to this occurrence of the problem. - `instance` (string, optional) — A URI reference that identifies the specific occurrence of the problem. - `errors` (list of DocAIErrorDetail, optional, nullable) — Optional list of individual error details. ## Types ### DocAiV1JobJobIdResultsGetResponsesContentApplicationJsonSchemaDiscriminatorMappingExtractAnnotations Mirrors `result`, with each leaf replaced by its `confidence` and `sources`. ### DocAiV1JobJobIdResultsGetResponsesContentApplicationJsonSchemaDiscriminatorMappingExtractResult Structured field values, shaped by the schema or `config_id` used to create the job. ### DocAIUsage - `pages_total` (integer, optional) — Total pages in the job. - `pages_processed` (integer, optional) — Pages processed so far. - `pages_succeeded` (integer, optional) — Pages processed successfully. - `pages_failed` (integer, optional) — Pages that failed processing. ### DocAiV1JobJobIdResultsGetResponsesContentApplicationJsonSchemaDiscriminatorMappingDigitiseDocumentsItems - `file_name` (string, optional) - `pages` (list of DocAiV1JobJobIdResultsGetResponsesContentApplicationJsonSchemaDiscriminatorMappingDigitiseDocumentsItemsPagesItems, optional) ### DocAIErrorDetail - `location` (string, optional) — Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'. - `message` (string, optional) — Error message text. - `value` (any, optional) — The value at the given location. ### DocAiV1JobJobIdResultsGetResponsesContentApplicationJsonSchemaDiscriminatorMappingDigitiseDocumentsItemsPagesItems - `page_number` (integer, optional) - `content` (string, optional) — Page content in the requested output_format (HTML or Markdown). ## Examples ### Extract results **Response** ```json { "type": "extract", "annotations": { "insured_name": { "confidence": 0.95, "sources": [ { "document_id": "019fb7da-5106-7839-adc6-4245e437dfe6", "filename": "policy.pdf", "page_num": 1 } ] }, "policy_number": { "confidence": 0.98, "sources": [ { "document_id": "019fb7da-5106-7839-adc6-4245e437dfe6", "filename": "policy.pdf", "page_num": 1 } ] }, "sum_insured": { "confidence": 0.92, "sources": [ { "document_id": "019fb7da-5106-7839-adc6-4245e437dfe6", "filename": "policy.pdf", "page_num": 2 } ] } }, "job_id": "20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7", "result": { "insured_name": "Aditya Chaudhary", "policy_number": "ABC-1234", "sum_insured": 500000 }, "status": "completed", "usage": { "pages_total": 2, "pages_processed": 2, "pages_succeeded": 2, "pages_failed": 0 }, "version": 1 } ``` **SDK Code** ```python Extract results import requests url = "https://api.sarvam.ai/doc-ai/v1/job/20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7/results" querystring = {"format":"json"} headers = {"api-subscription-key": ""} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript Extract results const url = 'https://api.sarvam.ai/doc-ai/v1/job/20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7/results?format=json'; const options = {method: 'GET', headers: {'api-subscription-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Extract results package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.sarvam.ai/doc-ai/v1/job/20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7/results?format=json" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("api-subscription-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Extract results require 'uri' require 'net/http' url = URI("https://api.sarvam.ai/doc-ai/v1/job/20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7/results?format=json") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["api-subscription-key"] = '' response = http.request(request) puts response.read_body ``` ```java Extract results import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.sarvam.ai/doc-ai/v1/job/20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7/results?format=json") .header("api-subscription-key", "") .asString(); ``` ```php Extract results request('GET', 'https://api.sarvam.ai/doc-ai/v1/job/20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7/results?format=json', [ 'headers' => [ 'api-subscription-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Extract results using RestSharp; var client = new RestClient("https://api.sarvam.ai/doc-ai/v1/job/20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7/results?format=json"); var request = new RestRequest(Method.GET); request.AddHeader("api-subscription-key", ""); IRestResponse response = client.Execute(request); ``` ```swift Extract results import Foundation let headers = ["api-subscription-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.sarvam.ai/doc-ai/v1/job/20260707_6eb74174-e2c3-490d-afe5-d2e7e9e2b6c7/results?format=json")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ``` ### Digitise results **Response** ```json { "type": "digitise", "documents": [ { "file_name": "policy.pdf", "pages": [ { "page_number": 1, "content": "

Policy Document

Policy Number: ABC-1234

" }, { "page_number": 2, "content": "

Terms & Conditions

...

" } ] } ], "job_id": "20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5", "status": "completed", "usage": { "pages_total": 2, "pages_processed": 2, "pages_succeeded": 2, "pages_failed": 0 } } ``` **SDK Code** ```python Digitise results import requests url = "https://api.sarvam.ai/doc-ai/v1/job/20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5/results" querystring = {"format":"json"} headers = {"api-subscription-key": ""} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript Digitise results const url = 'https://api.sarvam.ai/doc-ai/v1/job/20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5/results?format=json'; const options = {method: 'GET', headers: {'api-subscription-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Digitise results package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.sarvam.ai/doc-ai/v1/job/20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5/results?format=json" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("api-subscription-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Digitise results require 'uri' require 'net/http' url = URI("https://api.sarvam.ai/doc-ai/v1/job/20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5/results?format=json") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["api-subscription-key"] = '' response = http.request(request) puts response.read_body ``` ```java Digitise results import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.sarvam.ai/doc-ai/v1/job/20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5/results?format=json") .header("api-subscription-key", "") .asString(); ``` ```php Digitise results request('GET', 'https://api.sarvam.ai/doc-ai/v1/job/20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5/results?format=json', [ 'headers' => [ 'api-subscription-key' => '', ], ]); echo $response->getBody(); ``` ```csharp Digitise results using RestSharp; var client = new RestClient("https://api.sarvam.ai/doc-ai/v1/job/20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5/results?format=json"); var request = new RestRequest(Method.GET); request.AddHeader("api-subscription-key", ""); IRestResponse response = client.Execute(request); ``` ```swift Digitise results import Foundation let headers = ["api-subscription-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.sarvam.ai/doc-ai/v1/job/20260707_9f1c2b3a-4d5e-6f70-8a9b-c0d1e2f3a4b5/results?format=json")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ```