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

# Get Document Image By Page Number

GET https://api.staple.io/v1/documents/{docId}/page/{page}

Get the image of a document by specifying the doc ID and the page number of the image within the document.

Reference: https://docs.staple.ai/api-reference/v1/documents/get-document-image-by-page-number

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: v1
  version: 1.0.0
paths:
  /v1/documents/{docId}/page/{page}:
    get:
      operationId: getDocumentImageByPageNumber
      summary: Get Document Image By Page Number
      description: >-
        Get the image of a document by specifying the doc ID and the page number
        of the image within the document.
      tags:
        - documents
      parameters:
        - name: docId
          in: path
          required: true
          schema:
            type: string
        - name: page
          in: path
          required: true
          schema:
            type: string
        - name: x-api-key
          in: header
          description: API key issued by Staple.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Documents_getDocumentImageByPageNumber_Response_200
servers:
  - url: https://api.staple.io
    description: https://api.staple.io
components:
  schemas:
    Documents_getDocumentImageByPageNumber_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: Documents_getDocumentImageByPageNumber_Response_200
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key issued by Staple.
    bearerAuth:
      type: http
      scheme: bearer
      description: JWT obtained from the login endpoint.

```

## Examples



**Response**

```json
{
  "getDocumentImageByPage": {
    "fileURL": "https://staple-new-product-staging.s3.ap-southeast-1.amazonaws.com/documents/hS-lpiVhi9SM6FTl3PER8cmpN9DD4lRVykW8/0.jpg?AWSAccessKeyId=AXXXXXXXXXXXX&Expires=1601380217&Signature=CNO0AwKXF1bE8NGzpSt5dI9ZMJM%3D&response-content-disposition=inline%3B%20filename%3D%22documents%2FhS-lpiVhi9SM6FTl3PER8cmpN9DD4lRVykW8%2F0.jpg%22&response-content-type=image%2Fjpeg",
    "hasNextPage": true
  }
}
```

**SDK Code**

```python Get Document By Doc Id And Page Number
import requests

url = "https://api.staple.io/v1/documents/docId/page/page"

headers = {"x-api-key": "<apiKey>"}

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

print(response.json())
```

```javascript Get Document By Doc Id And Page Number
const url = 'https://api.staple.io/v1/documents/docId/page/page';
const options = {method: 'GET', headers: {'x-api-key': '<apiKey>'}};

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

```go Get Document By Doc Id And Page Number
package main

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

func main() {

	url := "https://api.staple.io/v1/documents/docId/page/page"

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

	req.Header.Add("x-api-key", "<apiKey>")

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

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

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

}
```

```ruby Get Document By Doc Id And Page Number
require 'uri'
require 'net/http'

url = URI("https://api.staple.io/v1/documents/docId/page/page")

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

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'

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

```java Get Document By Doc Id And Page Number
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.staple.io/v1/documents/docId/page/page")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Get Document By Doc Id And Page Number
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.staple.io/v1/documents/docId/page/page', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Get Document By Doc Id And Page Number
using RestSharp;

var client = new RestClient("https://api.staple.io/v1/documents/docId/page/page");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Get Document By Doc Id And Page Number
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staple.io/v1/documents/docId/page/page")! 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()
```