Updated on 2025-12-02 GMT+08:00

Web search

Function

Web search

URI

POST /v1/{project_id}/applications/{application_id}/uni-search/web/search

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Constraints:

N/A

Value range:

The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter.

Default value:

N/A

application_id

Yes

String

Definition:

Application ID. For details about how to obtain the application ID, see Obtaining an Application ID.

Constraints:

Character string

Value range:

The value can contain 1 to 64 characters. Only digits, letters, hyphens (-), and underscores (_) are allowed. The value must start with a letter.

Default value:

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Token

No

String

Definition:

After a user logs in, a token is created for authentication based on the user login information.

The user validity is verified through authentication.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

X-Auth-Token

Yes

String

Definition:

Token used for API authentication. For details about how to obtain the token, see Obtaining an IAM User Token.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

repo_id

No

String

Definition:

Knowledge base ID.

Constraints:

N/A

Value range:

The value can contain 1 to 64 characters. It can only contain letters, digits, underscores (_), and hyphens (-).

Default value:

N/A

chat_id

No

String

Definition:

Chat ID.

Constraints:

N/A

Value range:

The value can contain 1 to 64 characters. It can only contain letters, digits, underscores (_), and hyphens (-).

Default value:

N/A

query

Yes

String

Definition:

User question.

Constraints:

N/A

Value range:

The value cannot be empty. It can contain a maximum of 20,480 characters.

Default value:

N/A

history

No

Array of strings

Definition:

Chat history.

Implementation logic:

  1. Refer to the most recent 10 rounds of dialogs.

  2. Consider only 300 to 500 characters in each round of dialog.

Constraints:

  1. The number of elements must be an even number, for example, [Question1, Answer1, Question2, Answer2].

  2. The chats are ordered from old to new.

  3. Question is mandatory.

  4. Answer can be an empty string but must be placed.

Value range:

The list length cannot exceed 40 characters.

Default value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

query

String

Definition:

User question.

N/A

Value range:

N/A

documents

Array of Document objects

Definition:

Web search result.

N/A

Value range:

N/A

Table 5 Document

Parameter

Type

Description

title

String

Definition:

Title. Use this name and URL to create a hyperlink. Clicking the hyperlink will take the user to the web page.

Value range:

N/A

content

String

Definition:

Content.

Value range:

N/A

url

String

Definition:

Hyperlink.

Value range:

N/A

timestamp

String

Definition:

Update time (time when the web page is captured last time). The date format is YYYY-MM-DDTHH:MM:SS.

Value range:

N/A

site_name

String

Definition:

Site name

Value range:

N/A

site_icon

String

Definition:

Site icon address.

Value range:

N/A

type

String

Definition:

Search type.

Value range:

N/A

id

String

Definition:

ID.

Value range:

N/A

size

Long

Definition:

Size.

Value range:

N/A

has_html

Boolean

Definition:

Whether HTML is used.

Value range:

  • true: The result is in HTML.

  • false: The result is not in HTML.

source

String

Definition:

Source

Value range:

N/A

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error Code.

Value range:

N/A

error_msg

String

Definition:

Error message.

Value range:

N/A

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error Code.

Value range:

N/A

error_msg

String

Definition:

Error message.

Value range:

N/A

Example Requests

None

Example Responses

None

Status Codes

Status Code

Description

200

Search response.

400

Client error.

500

Server error.

Error Codes

See Error Codes.