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

# Using SoMark in FastGPT

> Add SoMark Document Parser to workflows via a FastGPT tool node

## Use the SoMark Document Parser tool in a workflow

**1. Add the SoMark Document Parser node**

In the FastGPT application workflow, add the **SoMark Document Parser** node.

![Add the SoMark plugin in FastGPT](https://mintcdn.com/soulcode-9c5983db/pPYAhay76UZd1ySN/images/fastgpt-%E6%B7%BB%E5%8A%A0%E6%8F%92%E4%BB%B6.webp?fit=max\&auto=format\&n=pPYAhay76UZd1ySN\&q=85\&s=c1189c913e36b9869f5600a03fa2bf42)

**2. Activate the SoMark Document Parser tool**

Click **Activate** and fill in the secret configuration:

* **Base URL**: For SoMark API, use `https://somark.ai/api/v1`; for self-hosted deployment, enter the Base URL of your local deployment.
* **API Key**: Required for SoMark API; not required for self-hosted deployment.

> [!NOTE]
>
> No API key yet? [Go to the SoMark API Studio to get your API key](https://somark.ai/Studio/apikey).

> [!WARNING]
>
> For **SoMark Self-host**, the plugin automatically appends the corresponding service path to **Base URL**. Enter the API prefix that reaches your self-hosted service, and do not append a specific service path yourself.

![Activate the SoMark plugin in FastGPT](https://mintcdn.com/soulcode-9c5983db/pPYAhay76UZd1ySN/images/fastgpt-%E6%BF%80%E6%B4%BB%E6%8F%92%E4%BB%B6.webp?fit=max\&auto=format\&n=pPYAhay76UZd1ySN\&q=85\&s=f9f251e6a61afd340de9fb991b512663)

**3. Build a minimal demo**

Connect a file input node to the **File** parameter of **SoMark Document Parser**, then pass the parsed results to a downstream node. The plugin can parse multiple files at a time and works for uploaded PDFs, images, Word, PPT, or Excel files.

![Build a FastGPT workflow with SoMark](https://mintcdn.com/soulcode-9c5983db/pPYAhay76UZd1ySN/images/fastgpt-%E6%9E%84%E5%BB%BA%E5%B7%A5%E4%BD%9C%E6%B5%81.webp?fit=max\&auto=format\&n=pPYAhay76UZd1ySN\&q=85\&s=f0ff6885eaa4e78c38764db8dbc542e3)

Upload files in debug or preview mode and run the workflow. The node returns one result for each input file in input order. Each item includes `markdown`, `json`, and `error` fields, and downstream nodes can reference them as needed.

![Run a FastGPT preview with SoMark](https://mintcdn.com/soulcode-9c5983db/pPYAhay76UZd1ySN/images/fastgpt-%E8%BF%90%E8%A1%8C%E9%A2%84%E8%A7%88.webp?fit=max\&auto=format\&n=pPYAhay76UZd1ySN\&q=85\&s=131efca4dfa0620c515a9f8212161449)

***

## Parameters and outputs

### Input parameters

| Parameter | Type | Required | Default | Description |
| - | - | - | - | - |
| File | File selector | ✅ | None | Files to parse. You can select multiple files at a time. Supports PDFs, images, Word, PPT, and Excel files. |
| Output formats | Multi-select | - | `JSON`, `Markdown` | Return `JSON`, `Markdown`, or both. |
| Image format | Single select | - | `URL` | Image element format. Supports `URL`, `Base64`, and `None`. |
| Formula format | Single select | - | `LaTeX` | Formula element format. Supports `LaTeX`, `MathML`, and `ASCII`. |
| Table format | Single select | - | `HTML` | Table element format. Supports `HTML`, `Markdown`, and `Image`. |
| Chemical structure format | Single select | - | `Image` | Chemical structure element format. Currently only supports `Image`. |
| Text cross-page merging | Switch | - | `Off` | Merge text blocks that span pages into continuous paragraphs. |
| Table cross-page merging | Switch | - | `Off` | Merge tables that span pages into complete tables. |
| Title level recognition | Switch | - | `Off` | Recognize heading levels such as H1, H2, and H3. |
| Inline image restoration | Switch | - | `Off` | Return images embedded in text paragraphs. |
| Image restoration in tables | Switch | - | `On` | Return images embedded in table cells. |
| Image understanding | Switch | - | `On` | Generate semantic and structured descriptions for images in the document. |
| Keep headers and footers | Switch | - | `Off` | Keep page headers and footers when enabled. |

### Output variables

| Variable | Type | Description |
| - | - | - |
| Parsed results | array | Each input file maps to one result and results are returned in input order. Each item includes `markdown`, `json`, and `error` fields. |

#### Result fields

| Field | Type | Description |
| - | - | - |
| `markdown` | string | Full parsed content in Markdown format. Empty string if `Markdown` output is not selected or parsing fails. |
| `json` | object | Parsed result in JSON format. Empty object if `JSON` output is not selected or parsing fails. |
| `error` | string | Error message for the current file. Empty string when parsing succeeds. |

## Notes

* FastGPT passes selected files as download URLs. The plugin downloads the file first, then sends it to the SoMark parsing service.
* If the file URL contains a `filename` query parameter, the plugin uses it first to avoid losing suffixes such as `.pdf` and `.docx` from temporary download URLs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.