---
title: "content.ingest()"
description: "Run the parse pipeline on a file you built yourself, then store it."
canonical_url: "https://content.comark.dev/reference/content/ingest"
---
# content.ingest()

> Run the parse pipeline on a file you built yourself, then store it.

## `content.ingest(file)`

Runs the [`file:parsed`](https://content.comark.dev/reference/content/hooks#fileparsed) hook on a file you built yourself, then stores the result exactly as [`update()`](https://content.comark.dev/reference/content/update) would, emitting `file:upsert`.

**Parameters:**

- `file`: a [`ContentFile`](https://content.comark.dev/reference/types/content#contentfiletdata-tmeta) that has not been through the parse pipeline.

**Returns:** `Promise<void>`. Rejects when a `file:parsed` hook rejects the file (`ctx.file = null`); nothing is stored then.

## When to use it

`update()` trusts its input as already parsed. That is right for HMR events, webhook patches and hub siblings, and wrong for a file you assembled from a form, an API response or a test fixture — nothing has transformed or validated it yet.

```ts [cms-webhook.ts]
// Frontmatter shaped by hand from a CMS payload: markdown fields are still
// strings, and nothing has checked them against the schema.
await content.ingest({
  path: '/posts/hello',
  data: { title: payload.title, body: payload.markdown },
  meta: { key: 'default/posts/hello.md', source: 'default', stem: 'posts/hello', extension: '.md', kind: 'document', type: 'text/markdown', partial: false },
  nodes: [],
})
```

With `ingest()`, [`markdownFields`](https://content.comark.dev/plugins/built-in/markdown-fields) parses `body`, [`schemaValidation`](https://content.comark.dev/plugins/built-in/schema-validation) checks the document, and any other `file:parsed` plugin runs — once.

## Which one

| You hold                                                                           | Call                                                              |
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| A file another instance parsed (HMR, snapshot, webhook forwarding a `ContentFile`) | [`update()`](https://content.comark.dev/reference/content/update) |
| A file you assembled yourself                                                      | `ingest()`                                                        |

Calling `ingest()` on an already-parsed file transforms it twice. Calling `update()` on a hand-built file skips validation. Neither is checked for you; the caller is the only one who knows.


## Sitemap

See the full [sitemap](https://content.comark.dev/sitemap.md) for all pages.
