> ## Documentation Index
> Fetch the complete documentation index at: https://developers.ambersearch.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Download document

> Download a document by its ID.

This endpoint allows downloading a document’s content using its unique identifier. The response will be the actual file content with appropriate content type headers.

The document ID is passed as the `document_id` query parameter and must be URL-encoded. Use your HTTP client’s parameter support rather than building the query string by hand — IDs of documents from SMB / Windows file shares are file paths and may contain `/`, spaces and `&`.

**Breaking change:** the ID was previously part of the URL path; the old `/document/{document_id}/download` form is no longer supported.


<RequestExample>
  ```bash cURL theme={null}
  curl -G "https://customerDomain.ambersearch.de/api/beta/document/download" \
  --data-urlencode "document_id={document_id}" \
  -H "Authorization: Bearer ambrs-exampletoken"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://customerDomain.ambersearch.de/api/beta/document/download",
      params = {
          "document_id": "{document_id}"
      },
      headers = {
          "Authorization": "Bearer ambrs-exampletoken"
      }
  )
  print(response.content)
  ```

  ```javascript Javascript theme={null}
  const axios = require("axios");

  axios
      .get("https://customerDomain.ambersearch.de/api/beta/document/download", {
          params: {
              document_id: "{document_id}",
          },
          headers: {
              Authorization: "Bearer ambrs-exampletoken",
          }
      })
      .then((res) => console.log(res.data));
  ```
</RequestExample>


## OpenAPI

````yaml get /api/beta/document/download
openapi: 3.1.0
info:
  title: amber
  version: v0.1.46
servers:
  - url: https://{customerDomain}.ambersearch.de
    variables:
      customerDomain:
        default: customerDomain
security: []
paths:
  /api/beta/document/download:
    get:
      tags:
        - Public REST API
      summary: Download Document
      description: >-
        Download a document by its ID.


        This endpoint allows downloading a document's content using its unique
        identifier.

        The response will be the actual file content with appropriate content
        type headers.


        The document ID is passed as the `document_id` query parameter and must
        be URL-encoded. Use your HTTP

        client's parameter support rather than building the query string by hand
        -- IDs of documents from

        SMB / Windows file shares are file paths and may contain `/`, spaces and
        `&`.


        ## Returns


        A FileResponse object containing:

        - The document's content as a downloadable file

        - Appropriate content type headers

        - File name and other metadata


        ## Raises


        - **HTTPException**: If the document is not found or if the user is not
        authenticated
      operationId: Download Document
      parameters:
        - name: document_id
          in: query
          required: true
          schema:
            type: string
            minLength: 1
            description: >-
              The unique identifier of the document to download, exactly as
              returned in the `id` field by `/beta/search`. Must be URL-encoded:
              ids may contain `/`, spaces and `&` -- documents from SMB /
              Windows file shares are identified by their file path (e.g.
              `//fileserver01/Marketing/Report.pdf`).
            examples:
              - doc_123456
            title: Document Id
          description: >-
            The unique identifier of the document to download, exactly as
            returned in the `id` field by `/beta/search`. Must be URL-encoded:
            ids may contain `/`, spaces and `&` -- documents from SMB / Windows
            file shares are identified by their file path (e.g.
            `//fileserver01/Marketing/Report.pdf`).
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - Bearer: []
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.