Upload local files

Upload local files for use in creating or appending knowledge base sources. A successful upload only means that the file has been saved, but does not mean that the content is retrievable.

HTTP
POST $CLOUDSIGMA_API_BASE/semantic-models/{model_id}/local-files/upload

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First query the knowledge base list to obtain the target knowledge base ID. Prepare a personal access token and target workspace ID that can access the target workspace.

Request parameters

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/semantic-models/$MODEL_ID/local-files/upload" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -F "file=@./product-guide.pdf"

Submit the file using multipart/form-data. curl -F in the example will set the request header, do not add Content-Type: application/json.

Path parameters

Field

Type

Required

Description

model_id

integer

Yes

Target knowledge base ID.

form fields

Field

Type

Required

Description

file

file

Yes

The local file to upload.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "file_id": "file_01"
  }
}

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data

object

The return data of this operation.

data.file_id

string

The ID of the uploaded file. Use this value when adding local file sources.

Error response

JSON
{
  "code": "ErrParamInvalid",
  "msg": "file is required",
  "data": null
}

Field

Type

Description

code

string

error code.

msg

string

Error description.

data

null

null on error.

Last updated on