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

# Signature Detection

> Detect signatures in documents

Document Ingestion API can be used to detect signatures and return their bounding boxes.

Signature detection incurs additional costs, so please refer to the [pricing page](https://tensorlake.ai/pricing) for more details.

## Detecting Signatures

Bounding boxes of signatures can be detected by setting `signature_detection` to `true` in the `parse_options` JSON object when calling the `parse` API.

<CodeGroup>
  ```python Python SDK theme={null}
  from tensorlake.documentai import (
      DocumentAI,
      ParsingOptions,
  )

  doc_ai = DocumentAI(api_key="YOUR_API_KEY")

  parsing_options = ParsingOptions(
      signature_detection=True,
  )

  parse_id = doc_ai.read(
      file_id="file_XXX",  # Replace with your file ID or URL
      parsing_options=parsing_options,
  )
  ```

  ```bash curl theme={null}
  curl --request POST \
    --url https://api.tensorlake.ai/documents/v2/parse \
    --header 'Authorization: Bearer ${TENSORLAKE_API_KEY}' \
    --header 'Content-Type: application/json' \
    --data '{
      "file_id": "file_XXX",  # Replace with your file ID or URL
      "parsing_options": {
          "signature_detection": true
      }
    }'

  ```
</CodeGroup>

## Response

The bounding boxes of signatures are present in the Document object returned by the `parse` API.

<CodeGroup>
  ```python Python SDK theme={null}
  parsed_result = doc_ai.wait_for_completion(parse_id=parse_id)
  # There is a signature on page 10 of this document
  signature_fragment result.outputs.document.pages[10].page_fragments[0]
  # PageFragment(fragment_type=<PageFragmentType.SIGNATURE: 'signature'>, content=Text(content='Signature detected'), reading_order=-1, page_number=None, bbox={'x1': 79.0, 'x2': 200.0, 'y1': 812.0, 'y2': 855.0})
  ```

  ```bash curl theme={null}
  curl --request GET \
    --url https://api.tensorlake.ai/documents/v2/parse/parse_XXX \
    --header 'Authorization: Bearer ${TENSORLAKE_API_KEY}' \
    --header 'Content-Type: application/json'

  # Response will contain the Document object with page fragments
  # that include the signature bounding boxes.
  {
    "page_fragments": [
      {
        "bbox": {
          "x1": 97,
          "x2": 212,
          "y1": 621,
          "y2": 661
        },
        "content": {
          "content": "Signature detected"
        },
        "fragment_type": "signature",
        "reading_order": -1,
      }
    ]
  }

  ```
</CodeGroup>
