The File API allows you to manage files in your account. You can upload, download, list, and delete files.
After you upload a file, you can use it to perform actions such as attaching it to a Knowledge Graph or using it as an input in a no-code agent.
This guide shows you how to perform the following actions:
You need an API key to access the Writer API. Get an API key by following the steps in the API quickstart.
We recommend setting the API key as an environment variable in a .env
file with the name WRITER_API_KEY
.
Endpoint: POST /v1/files
Parameter | Type | Description |
---|---|---|
content | string | The content of the file. See the Python SDK and the JavaScript SDK for more details about how to pass the file contents. |
content_disposition | string | The content disposition of the file. |
content_type | string | The MIME type of the file. The file upload supports txt , doc , docx , ppt , pptx , jpg , png , eml , html , pdf , srt , csv , xls , and xlsx file extensions. |
Field | Type | Description |
---|---|---|
id | string | The ID of the file. |
created_at | string | The date and time the file was created in ISO 8601 format. |
name | string | The name of the file. |
graph_ids | array[string] | The IDs of the Knowledge Graphs the file is attached to. |
status | string | The processing status of the file. |
Endpoint: GET /v1/files
In addition to the pagination parameters, this endpoint supports the following query parameters:
Parameter | Type | Description |
---|---|---|
graph_id | string | Filter files by the graph they are attached to. |
status | string | Filter files by status. |
file_types | string | Filter files by extension type. Separate multiple values by commas. For example, txt,pdf,docx . |
The file_types
parameter is not yet available in the Python and Node SDKs. It will be available in version 2.3.0.
The response has the following structure:
Field | Type | Description |
---|---|---|
data | array[object] | An array of file objects. |
data[].id | string | The ID of the file. |
data[].created_at | string | The date and time the file was created in ISO 8601 format. |
data[].name | string | The name of the file. |
data[].graph_ids | array[string] | The IDs of the Knowledge Graphs the file is attached to. |
data[].status | string | The status of the file. |
has_more | boolean | Whether there are more files to fetch. |
first_id | string | The ID of the first file in the response. |
last_id | string | The ID of the last file in the response. |
Endpoint: GET /v1/files/{fileId}
Parameter | Description |
---|---|
fileId | The ID of the file to get. |
Endpoint: DELETE /v1/files/{fileId}
Parameter | Description |
---|---|
fileId | The ID of the file to delete. |
The response has the following structure: