Manage files
The File API allows you to manage files in your account. You can upload, download, 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 application.
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
.
Upload a file
Endpoint: POST /v1/files
Request body
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. |
Response format
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. |
List all files
Endpoint: GET /v1/files
Request body
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. |
Response format
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. |
Get a file
Endpoint: GET /v1/files/{fileId}
Path parameters
Parameter | Description |
---|---|
fileId | The ID of the file to get. |
Response format
Delete a file
Endpoint: DELETE /v1/files/{fileId}
Path parameters
Parameter | Description |
---|---|
fileId | The ID of the file to delete. |
Response format
The response has the following structure:
Was this page helpful?