> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usefini.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Persist knowledge folders
> Upload a tree file and persist it into the workspace knowledge graph.
Use this route to import a tree file that you generated with [Initialize knowledge folders](/en/api-reference/initialize-knowledge-folders) or edited before upload.
<Info>
Send the file as `multipart/form-data` with the form field name `file`.
</Info>
## Headers
<ParamField header="Authorization" type="string" required>
Bearer token containing your Fini workspace API key. Format: `Bearer fini_...` The key needs `write` scope.
</ParamField>
<ParamField header="Content-Type" type="string" required>
`multipart/form-data`
</ParamField>
## Body parameters
<ParamField body="file" type="file" required>
Tree file generated from the initialize route or edited by your team before import.
</ParamField>
## Response
<ResponseField name="status" type="string">
Import status string.
</ResponseField>
<ResponseField name="message" type="string">
Human-readable import message.
</ResponseField>
<RequestExample>
~~~bash cURL theme={null}
curl --request POST \
--url 'https://api-prod.usefini.com/v2/knowledge/public/tree/persist' \
--header 'Authorization: Bearer fini_your_api_key' \
--form 'file=@fini-tree-template.csv'
~~~
~~~javascript Node.js theme={null}
const response = await fetch('https://api-prod.usefini.com/v2/knowledge/public/tree/persist', {
method: 'POST',
headers: {
Authorization: 'Bearer fini_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'file': 'knowledge-tree.csv'
}
)
});
const data = await response.json();
~~~
~~~python Python theme={null}
import requests
response = requests.post(
"https://api-prod.usefini.com/v2/knowledge/public/tree/persist",
headers={"Authorization": "Bearer fini_your_api_key", "Content-Type": "application/json"},
json={
"file": "knowledge-tree.csv"
},
)
data = response.json()
~~~
</RequestExample>
<ResponseExample>
~~~json 200 OK theme={null}
{
"folders": [
{
"id": "0f4da4fe-b2ae-4787-8c3b-854f36d9eb1b",
"title": "Billing",
"description": "Refunds, invoices, and subscription changes.",
"parentFolderId": null,
"active": true,
"botIds": [
"2a1cf0f0-f35d-46ad-8e61-a15c86b2b312"
],
"createdAt": "2026-07-28T08:55:32.000Z",
"updatedAt": "2026-07-28T09:10:18.000Z"
}
],
"articles": [
{
"id": "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3",
"title": "Refund policy",
"mainKnowledge": "Customers can request a refund within 30 days of purchase.",
"agentInstruction": "Use this article for refund eligibility questions.",
"questions": [
"Can I get a refund?"
],
"keywords": [
"refund",
"billing"
],
"escalation": false,
"parentFolderId": "0f4da4fe-b2ae-4787-8c3b-854f36d9eb1b",
"isDraft": false,
"origin": "API_CREATED",
"createdAt": "2026-07-28T08:55:32.000Z",
"updatedAt": "2026-07-28T09:10:18.000Z"
}
]
}
~~~
</ResponseExample>
## Errors
<AccordionGroup>
<Accordion title="400 Bad Request" icon="circle-exclamation">
The request is malformed or the `file` field is missing from the multipart payload.
</Accordion>
<Accordion title="401 Unauthorized" icon="lock">
The API key is missing, malformed, revoked, or invalid.
</Accordion>
<Accordion title="403 Forbidden" icon="shield-halved">
The API key does not include the `write` scope.
</Accordion>
<Accordion title="500 Internal Server Error" icon="triangle-exclamation">
Fini failed while persisting the uploaded tree file. Retry once, then validate the file format before trying again.
</Accordion>
</AccordionGroup>
## Related topics
- [Initialize knowledge folders](/en/api-reference/initialize-knowledge-folders.md)
- [Overview](/en/api-reference/knowledge.md)
- [Move knowledge folder](/en/api-reference/move-knowledge-folder.md)
This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.
Knowledge generation

