# Fetch Email PDF Attachments

> Perform Fetch Email PDF Attachments through GMail.

Source: [https://genhealth.ai/docs/workflows/integrations/gmail/gmail_fetch_pdf_attachments](https://genhealth.ai/docs/workflows/integrations/gmail/gmail_fetch_pdf_attachments)

Integration: [GMail](https://genhealth.ai/docs/workflows/integrations/gmail.md)

- Handler: `gmail_fetch_pdf_attachments`

## Inputs

- `message_id` — Message Id (expression, required)
  Required literal value or workflow expression.
- `document_type` — Document Type (select)
  Optional selected identifier or value.
  Default: `"Other"`
  Options: Prescription ("Prescription"), Demographics ("Demographics"), Insurance ("Insurance"), Qualifying Test ("Qualifying Test"), Physician Notes ("Physician Notes"), Other ("Other")
- `source` — Source (text)
  Optional text value.
  Default: `"gmail_inbox"`
- `show_documents_in_inbox` — Show Documents In Inbox (boolean)
  Optional true-or-false value.
  Default: `false`
- `deduplicate_by_content` — Deduplicate By Content (boolean)
  Optional true-or-false value.
  Default: `false`
- `content_hash_mode` — Content Hash Mode (select)
  Optional selected identifier or value.
  Default: `"raw_bytes"`
  Options: Raw Bytes (SHA-256) ("raw_bytes"), Content (re-encoding robust) ("content")
- `preserve_existing_stored_pdf` — Preserve Existing Stored Pdf (boolean)
  Optional true-or-false value.
  Default: `false`
- `document_status` — Document Status (select)
  Optional selected identifier or value.
  Default: `"complete"`
  Options: Complete ("complete"), Processing ("processing"), Review ("review")
- `workflow_id_override` — Workflow Id Override (text)
  Optional text value.
- `reuse_existing_document` — Reuse Existing Document (boolean)
  Optional true-or-false value.
  Default: `false`
- `body_field_label` — Body Field Label (text)
  Optional text value.
- `body_field_labels` — Body Field Labels (json)
  Optional JSON value.

## Outputs

- `success` — Success
- `message_id` — Message Id
- `document_ids` — Document Ids
- `new_document_ids` — New Document Ids
- `existing_document_ids` — Existing Document Ids
- `duplicate_count` — Duplicate Count
- `all_attachments_existing` — All Attachments Existing
- `attachments` — Attachments
- `attachment_results` — Attachment Results
- `attachment_count` — Attachment Count
- `failed_count` — Failed Count
- `email_body_field` — Email Body Field
- `email_body_fields` — Email Body Fields
- `count` — Count
- `skipped` — Skipped
- `skip_reason` — Skip Reason
- `error` — Error
- `error_message` — Error Message
- `error_code` — Error Code

Output schema completeness: `best_effort_declared`

## Safety

- External effect: `write`
- Confirmation recommended: no
- Retry safe: no
- Dry run supported: no

## Schemas

These schemas are first-pass authoring guidance. Runtime validation remains authoritative.

### Input schema

```json
{
  "type": "object",
  "required": [
    "message_id"
  ],
  "properties": {
    "source": {
      "type": "string",
      "default": "gmail_inbox",
      "description": "Optional text value.",
      "x-workflow-field-type": "text"
    },
    "message_id": {
      "description": "Required literal value or workflow expression.",
      "x-workflow-field-type": "expression"
    },
    "document_type": {
      "enum": [
        "Prescription",
        "Demographics",
        "Insurance",
        "Qualifying Test",
        "Physician Notes",
        "Other"
      ],
      "type": "string",
      "default": "Other",
      "description": "Optional selected identifier or value.",
      "x-workflow-field-type": "select"
    },
    "document_status": {
      "enum": [
        "complete",
        "processing",
        "review"
      ],
      "type": "string",
      "default": "complete",
      "description": "Optional selected identifier or value.",
      "x-workflow-field-type": "select"
    },
    "body_field_label": {
      "type": "string",
      "description": "Optional text value.",
      "x-workflow-field-type": "text"
    },
    "body_field_labels": {
      "description": "Optional JSON value.",
      "x-workflow-field-type": "json"
    },
    "content_hash_mode": {
      "enum": [
        "raw_bytes",
        "content"
      ],
      "type": "string",
      "default": "raw_bytes",
      "description": "Optional selected identifier or value.",
      "x-workflow-field-type": "select"
    },
    "workflow_id_override": {
      "type": "string",
      "description": "Optional text value.",
      "x-workflow-field-type": "text"
    },
    "deduplicate_by_content": {
      "type": "boolean",
      "default": false,
      "description": "Optional true-or-false value.",
      "x-workflow-field-type": "boolean"
    },
    "reuse_existing_document": {
      "type": "boolean",
      "default": false,
      "description": "Optional true-or-false value.",
      "x-workflow-field-type": "boolean"
    },
    "show_documents_in_inbox": {
      "type": "boolean",
      "default": false,
      "description": "Optional true-or-false value.",
      "x-workflow-field-type": "boolean"
    },
    "preserve_existing_stored_pdf": {
      "type": "boolean",
      "default": false,
      "description": "Optional true-or-false value.",
      "x-workflow-field-type": "boolean"
    }
  },
  "additionalProperties": false
}
```

### Output schema

```json
{
  "type": "object",
  "properties": {
    "count": {},
    "error": {},
    "skipped": {},
    "success": {},
    "error_code": {},
    "message_id": {},
    "attachments": {},
    "skip_reason": {},
    "document_ids": {},
    "failed_count": {},
    "error_message": {},
    "duplicate_count": {},
    "attachment_count": {},
    "email_body_field": {},
    "new_document_ids": {},
    "email_body_fields": {},
    "attachment_results": {},
    "existing_document_ids": {},
    "all_attachments_existing": {}
  },
  "additionalProperties": true
}
```
