Upload local files before creation

Upload local files before creating the knowledge base. If the upload is successful, only the file ID to be bound will be returned. Must be bound as local_file source when creating knowledge base and adding data ](create-knowledge-base-with-sources.md).

HTTP
POST $CLOUDSIGMA_API_BASE/semantic-models/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. Prepare a personal access token and workspace ID that has the target workspace’s knowledge base permissions.

Request parameters

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

Use multipart/form-data to upload the file, and the form field name is file.

Field

Type

Required

Description

file

file

Yes

The local file to upload. Pass it in using the multipart/form-data form field.

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

Upload results.

data.file_id

string

ID of the file to be bound. When creating the knowledge base, pass in sources[] together with the file name.

Last updated on