> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.sofer.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sofer.ai/_mcp/server.

# Get Ocr Document

GET https://api.sofer.ai/v1/ocr/{document_id}

Get OCR processing status and extracted pages for an owned OCR document.

Reference: https://docs.sofer.ai/api-reference/ocr/get-ocr-document

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `document_id` (UUID, required) — OCR document ID returned by public OCR creation.

## Response

### 200

- `document_id` (UUID, required) — Stable OCR document ID. Internally this is also the current OCR job key.
- `title` (string, required) — Document title.
- `completed_pages` (integer, required) — Pages successfully processed so far.
- `failed_pages` (integer, required) — Pages that failed processing so far.
- `status` (string, required) — OCR status such as PENDING, PROCESSING, COMPLETED, or FAILED.
- `pages` (list of OcrPage, required) — OCR output by page.
- `folder_id` (UUID, optional) — Containing document folder, or null for root.
- `file_name` (string, optional) — Original file name.
- `created_at` (datetime, optional) — Document creation time.
- `num_pages` (integer, optional) — Total number of pages detected.
- `error` (string, optional) — User-facing failure reason, when available. A failed document may still contain successfully extracted pages.

## Errors

### 401 Authentication Error

Authentication error

### 404 OCR Document Not Found

OCR document not found or not owned by the authenticated API user.

## Types

### OcrPage

- `page_num` (integer, required) — 1-indexed page number.
- `content` (string, optional) — OCR output for the page (HTML).

## Examples

**Response**

```json
{
  "document_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "title": "title",
  "completed_pages": 1,
  "failed_pages": 1,
  "status": "status",
  "pages": [
    {
      "page_num": 1,
      "content": "content"
    },
    {
      "page_num": 1,
      "content": "content"
    }
  ],
  "folder_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "file_name": "file_name",
  "created_at": "2024-01-15T09:30:00Z",
  "num_pages": 1,
  "error": "error"
}
```

**SDK Code**

```python
import requests

url = "https://api.sofer.ai/v1/ocr/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"

headers = {"Authorization": "Bearer <apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.sofer.ai/v1/ocr/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32';
const options = {method: 'GET', headers: {Authorization: 'Bearer <apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.sofer.ai/v1/ocr/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.sofer.ai/v1/ocr/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.sofer.ai/v1/ocr/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
  .header("Authorization", "Bearer <apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.sofer.ai/v1/ocr/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32', [
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.sofer.ai/v1/ocr/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sofer.ai/v1/ocr/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")! 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()
```