---
title: "Ingest Pre Parsed Document"
method: POST
path: "/longevity/documents/ingest"
tags: ["Clients"]
---

# Ingest Pre Parsed Document

`POST /longevity/documents/ingest`

## Request

- Base URL: `https://api.puppeteerai.com`
- URL: `https://api.puppeteerai.com/longevity/documents/ingest`
- Auth: none declared. Required headers: `Authorization`

Attach a pre-parsed document to a thread and fire the post-document workflow.

Mirrors the Healthie webhook path minus the download-and-parse step: the caller has
already produced the plain-text content and bounds-flagged results, so we store the
payload in thread.json_data["documents"] and trigger ReceivedHealthieWebhookTrigger.
HealthieProcessWebhookDocument short-circuits on PreParsedDocument; every other action
in the Longevity trigger step list runs unchanged.

Upsert semantics on healthie_document_id: a re-send for the same document replaces
the stored entry in place and re-fires the trigger, so downstream state stays in sync
with whatever the Longevity dashboard produced most recently.

## Headers

- `Authorization` string, required

## Request body

- IngestDocumentRequest
  - `thread_id` string, required
  - `project_id` string, required
  - `healthie_user_id` string, required
  - `document` IngestDocumentPayload, required
    - `document_type` string, required: Free-form document classification tag; passed through to the agent as context.
    - `healthie_document_id` string, required: Healthie's document id. Used as the upsert key: re-sends replace the stored entry in place.
    - `filename` string, required
    - `created_at` string, required: ISO-8601 UTC timestamp from Healthie's document.created_at.
    - `content` string, required: Plain UTF-8 text of the parsed document; what the agent reads.
    - `flags` DocumentFlag[]: Structured bounds-annotated results extracted by the Longevity dashboard.
      - `test_name` string, required
      - `value` union, required
        - number
        - string
      - `unit` string, nullable
      - `reference_range` ReferenceRange, required
        - `display` string, required: Human-readable range, shown to clinicians (e.g. '<100', '40-60').
        - `min` number, nullable: Lower numeric bound, or null for one-sided ranges.
        - `max` number, nullable: Upper numeric bound, or null for one-sided ranges.
      - `status` 'in_bounds' | 'out_of_bounds' | 'not_applicable', required
      - `severity` string, nullable

## Response `200`

Successful Response

- IngestDocumentResponse
  - `status` 'ok' | 'updated', required
  - `thread_id` string, required
  - `healthie_document_id` string, required: Echoes the Healthie document id used as the upsert key — identifies the ingested document.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/getpuppeteer/apis/puppeteer-core-api.md) - [All operations](https://skmtc.dev/getpuppeteer/apis/puppeteer-core-api/llms.txt) - [OpenAPI document](https://skmtc.dev/getpuppeteer/apis/puppeteer-core-api/revisions/94b4e928b42f?raw)
