Skip to content

Update/replace a file inside knowledge base

PUT
/knowledge/{id}/files/{fileId}
curl --request PUT \
--url https://api.amitysolutions.com/api/v1/knowledge/1/files/1 \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <x-api-key>' \
--form file=@file
id
required
number

Knowledge Base ID

fileId
required
number

Knowledge File ID

Media typemultipart/form-data
object
file

File/Document to upload.

Supports the following file types: text/csv, text/xml, text/html, application/pdf, application/rtf, application/xml, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Max file size: 100 MB

Max file name length: 255 characters

string format: binary

Updated file

Media typeapplication/json
object
id

Numeric ID of the file

number
name

Generated unique name of the file in storage

string
status

Current status of the file, either active or deleting. When the status is deleting, the contents of the file will not be passed to LLM.

string
Allowed values: active deleting
path

File path in storage container

string
combined

File path in storage container

string
storageContainerName

The storage container that the file is stored

string
meta

File metadata

object
mimetype
string
originalName
string
size
number
kmVersion

The version of parent knowledge base

string
knowledge
object
id

Numeric ID of the knowledge

number
name

The name of the knowledge

string
source

Type of knowledge base. internal will search the content from uploaded files and external will send a request to target endpoint for search.

string
Allowed values: internal external
supportedLanguages

List of supported languages for the knowledge. Files uploaded to this knowledge will have a copy of the document with each supported language translated.

Array<string>
Allowed values: en th
target

Search endpoint for external knowledge bases

string
enableSemanticSearch

If set to true, search will use semantic search on top of full-text search.

boolean
createdAt

Timestamp of creation for knowledge

string format: ISOString
updatedAt

Last updated timestamp for knowledge

string format: ISOString
createdAt

Timestamp of creation for knowledge

string format: ISOString
updatedAt

Last updated timestamp for knowledge

string format: ISOString
Example
{
"status": "active",
"knowledge": {
"source": "internal",
"supportedLanguages": [
"en"
],
"createdAt": "2023-11-09T00:00:00.000Z",
"updatedAt": "2023-11-09T00:00:00.000Z"
},
"createdAt": "2023-11-09T00:00:00.000Z",
"updatedAt": "2023-11-09T00:00:00.000Z"
}

Bad request error. Could be one of UnsupportedKnowledgeFileTypeError or UnsupportCsvKnowledgeFileFormatError

Media typeapplication/json
One of:
object
name

Name of the error

string
code

ASAP platform specific error code

number
status

HTTP status code

number
message

Error message details

string
errors
Array<object>
object
Example
{
"name": "BadRequestException",
"code": 400002,
"status": 400,
"message": "Unsupported knowledge file type.",
"errors": []
}

Unauthorized Error. ASAP will return this error when there is either no api key, invalid api key or the client`s IP address is not whitelisted.

Media typeapplication/json
object
name
string
code
number
status
number
message
string
errors
Array<object>
object
Example
{
"name": "UnauthorizedException",
"code": 401001,
"status": 401,
"message": "Unauthorized",
"errors": []
}

Not found error. Could be one of KnowledgeNotFoundError or KnowledgeFileNotFoundError

Media typeapplication/json
One of:
object
name

Name of the error

string
code

ASAP platform specific error code

number
status

HTTP status code

number
message

Error message details

string
errors
Array<object>
object
Example
{
"name": "NotFoundException",
"code": 404001,
"status": 404,
"message": "Knowledge base with specified ID not found.",
"errors": []
}

Request Entity Too Large

Validation Error

Media typeapplication/json
object
name

Name of the error

string
code

ASAP platform specific error code

number
status

HTTP status code

number
message

Error message details

string
errors
Array<object>
object
type
required

Type of error

string
field
required

Name of the field having the error

string
value

Input value

string
message
required

Error message

string
Example
{
"name": "UnprocessableEntityException",
"code": 422001,
"status": 422,
"message": "request payload validation failed",
"errors": [
{
"type": "isNotEmpty",
"field": "name",
"message": "name must not be empty"
},
{
"type": "min",
"field": "limit",
"value": -1,
"message": "limit must not be less than 1"
}
]
}

Too Many Requests

Media typeapplication/json
object
name

Name of the error

string
code

ASAP platform specific error code

number
status

HTTP status code

number
message

Error message details

string
errors
Array<object>
object
Example
{
"name": "RateLimitExceededException",
"code": 429001,
"status": 429,
"message": "Rate limit exceeded",
"errors": []
}