> ## 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.

# Get document metadata

> Retrieve metadata for a specific document.

This endpoint returns the metadata for a document identified by its ID. Optionally, it can include the document’s text content.

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}/metadata` form is no longer supported.


<RequestExample>
  ```bash cURL theme={null}
  curl -G "https://customerDomain.ambersearch.de/api/beta/document/metadata" \
  --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/metadata",
      params = {
          "document_id": "{document_id}"
      },
      headers = {
          "Authorization": "Bearer ambrs-exampletoken"
      }
  )
  print(response.json())
  ```

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

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


## OpenAPI

````yaml get /api/beta/document/metadata
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/metadata:
    get:
      tags:
        - Public REST API
      summary: Get Document Metadata
      description: >-
        Retrieve metadata for a specific document.


        This endpoint returns the metadata for a document identified by its ID.
        Optionally,

        it can include the document's text content.


        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 dictionary containing the document's metadata with the following
        structure:


        ```json

        {
            "id": "string",
            "title": "string",
            "path": "string",
            "path_preview": "string",
            "parent_path": "string",
            "data_source": "string",
            "data_source_sub": "string",
            "data_source_sub_sub": "string",
            "file_type": "string",
            "document_type": "string",
            "last_modified": "string",
            "file_size": "integer",
            "author": "string",
            "highlights": "array",
            "summary": "string",
            "suffix": "string",
            "similar_docs": "array",
            "duplicates": "array",
            "same_thread_docs": "array",
            "text": "string"  // Only included if provide_text_attribute is true
        }

        ```


        ## Raises


        - **HTTPException**: If the document is not found or if the user is not
        authenticated
      operationId: Get Document Metadata
      parameters:
        - name: document_id
          in: query
          required: true
          schema:
            type: string
            minLength: 1
            description: >-
              The unique identifier of the document, 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, 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`).
        - name: provide_text_attribute
          in: query
          required: false
          schema:
            type: boolean
            description: Whether to include the document's text content in the response
            examples:
              - false
            default: false
            title: Provide Text Attribute
          description: Whether to include the document's text content in the response
      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.