botruntime
API ReferenceFiles API

Upsert File

Creates or updates a file using the `key` parameter as unique identifier. Updating a file will erase the existing content of the file. Upload the file content by sending it in a PUT request to the `uploadUrl` returned in the response.

PUT
/v1/files

Request Body

application/json

Properties of the file to create or update.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X PUT "https://example.com/v1/files" \  -H "Content-Type: application/json" \  -d '{    "key": "string",    "size": 0  }'
{  "file": {    "id": "string",    "botId": "string",    "key": "string",    "url": "string",    "size": 0,    "contentType": "string",    "tags": {      "property1": "string",      "property2": "string"    },    "metadata": {      "property1": null,      "property2": null    },    "createdAt": "string",    "updatedAt": "string",    "accessPolicies": [      "integrations"    ],    "index": true,    "status": "upload_pending",    "failedStatusReason": "string",    "expiresAt": "string",    "owner": {      "type": "bot",      "id": "string",      "name": "string",      "alias": "string"    },    "indexingStack": "v1",    "uploadUrl": "string"  }}
{  "file": {    "id": "string",    "botId": "string",    "key": "string",    "url": "string",    "size": 0,    "contentType": "string",    "tags": {      "property1": "string",      "property2": "string"    },    "metadata": {      "property1": null,      "property2": null    },    "createdAt": "string",    "updatedAt": "string",    "accessPolicies": [      "integrations"    ],    "index": true,    "status": "upload_pending",    "failedStatusReason": "string",    "expiresAt": "string",    "owner": {      "type": "bot",      "id": "string",      "name": "string",      "alias": "string"    },    "indexingStack": "v1",    "uploadUrl": "string"  }}