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

# Download Canonical Markdown

Use this API to return the canonical markdown extracted from a knowledge source. It returns `null` with a `200` when the `sourceId` is unknown, belongs to another workspace, is still processing, or has no canonical markdown. An unknown `sourceId` is not an error, so you cannot tell "wrong id" from "still processing" by this response alone; call [Get Ingest Status](https://velt.dev/docs/api-reference/rest-apis/v2/memory/knowledge/ingest-status.md) to tell them apart. For a de-duplicated source (`dedupOf` set), the markdown is the winning source's, returned only once that source is `completed`; until then the endpoint returns `null` rather than a partially written document.

# Endpoint

`POST https://api.velt.dev/v2/memory/knowledge/download`

# Headers

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body

#### Params

**data** `object` *required*

**properties**

**sourceId** `string` *required*

The knowledge source id returned by Ingest Knowledge.

## **Example Requests**

#### Download a source's markdown

```JSON theme={null}
{
  "data": {
    "sourceId": "src_9a8..."
  }
}
```

# Response

The result is the canonical markdown string, or `null` when it is not available for the reasons listed above.

#### Success Response

```JSON theme={null}
{
  "result": "# Brand Guidelines\n\n- Always cite medical claims...\n"
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

```js theme={null}
{
  "result": "# Brand Guidelines\n\n- Always cite medical claims...\n"
}
```


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