Open API
Management Interfaces
OpenAPI Integration
Prerequisites
Construct Signature to Get Token
When integrating with the duix-openapi-v2 platform, you need to integrate code to generate tokens in your own platform. The method for generating tokens can be referenced in the following code:
Management Interfaces
Management-type HTTP requests have a common convention that requires passing a token in the request header.
Interaction Process
Get APP Real-time Concurrent Number
Interface Address:
/duix-openapi-v2/sdk/v2/getconcurrentNumber
Request Method: GET
Interface Description:
Query the concurrent number under a specific APP
Parameter Description
Parameter Name | Type | Pass Method | Parameter Description |
---|---|---|---|
appId | String | Query | APPID created from the platform |
Response Parameters:
Parameter Name | Type |
---|---|
code | String |
data | ConcurrentStatus |
cropId | String |
totalConcurrentNumber | integer(int32) |
userConcurrentNumber | integer(int32) |
message | String |
success | boolean |
Response Example:
Get APP Real-time Sessions
Interface Address:
/duix-openapi-v2/sdk/v2/getconcurrentList
Request Method: GET
Interface Description:
Query the list of “in call” sessions under a specific APP.
Parameter Description
Parameter Name | Type | Pass Method | Parameter Description |
---|---|---|---|
appId | String | Query | APPID created from the platform |
Close All Sessions of an APP
Interface Address:
/duix-openapi-v2/sdk/v2/distroyCallSessionsByAppId
Request Method: GET
Interface Description:
Close all sessions under a specific APP
Parameter Description
Parameter Name | Type | Pass Method | Parameter Description |
---|---|---|---|
appId | String | Query | APPID created from the platform |
Response Example:
Close Specified Session
Interface Address:
/duix-openapi-v2/sdk/v2/sessionStop
Request Method: GET
Parameter Description
Parameter Name | Type | Pass Method | Parameter Description |
---|---|---|---|
uuid | String | Query | sessionId field returned by the start-complete event |
Third-party Dialog Integration (Non-streaming)
Other Session Integration: Other session platforms can be provided for digital humans to use in the following way. The DUIX platform can, through your digital human, use the POST method to request a remote URL you define to get answers to questions.
Session Platform Integration Example: You can refer to this example of session platform integration. This open-source application implements a dialogue platform integration, which implements casual conversation functionality.
Request Specification: The DUIX platform will send question requests (questions customers ask your digital human) in the following format via POST to your remote URL.
Parameter Description
Field | Type | Description | Required |
---|---|---|---|
sid | String | Your user ID, generated when creating a user. Can be viewed in account information. | Y |
dh-code | String | Digital human code, generated when each digital human is created, can be viewed in the digital human overview. | Y |
dh-question | String | The content of the question you need to ask the digital human | Y |
dh-conversation-id | String | Conversation ID, a unique identifier for the conversation | Y |
dh-context | String | Context information generated during the conversation, this information is a stringified JSON format data. | N |
Request Example:
Response Specification: When you receive a question request, you need to respond in the following format.
Field | Type | Required | Remarks |
---|---|---|---|
code | String | Y | Status code returned |
msg | String | N | Success/error description message |
data | object | N | Specific content returned |
success | Boolean | Y | Whether successful |
Valid Response Types:
Code | Status | Response |
---|---|---|
200 | OK | Response body according to the specification below |
400 | Bad Request | Request body/headers are invalid |
401 | Unauthorized | Authentication information is invalid |
403 | Forbidden | Authentication failed |
500 | Server Error | Service exception |
Response Body Specification:
Field | Type | Description | Required |
---|---|---|---|
conversationId | String | Conversation ID, a unique identifier for the conversation, same as the dh-conversation-id in the request parameter body. | Y |
question | String | The question asked by the user. | N |
answer | String | The answer to the question the user asked the digital human, this is a stringified JSON object. | Y |
intent | String | The intent matched by the question on the platform | N |
errorMsg | String | Description of the exception or error | N |
extra | String | Additional information, JSON string | N |
Expected Response Time: The interaction with digital humans is sensitive to latency due to their real-time nature. Therefore, response time is an important factor to consider when processing requests from the DUIX platform. These services should respond within 95% of the time within 20 seconds. If the response time exceeds 20s, the request will report a timeout error, but the digital human will continue to respond.
Third-party Dialog Integration (Streaming)
Other Session Integration: Other session platforms can be provided for digital humans to use in the following way. The DUIX platform can, through your digital human, use the POST method to request a remote URL you define to get answers to questions.
Session Platform Integration Example: You can refer to this example of session platform integration. This open-source application implements a dialogue platform integration, which implements casual conversation functionality.
Request Specification: The DUIX platform will send question requests (questions customers ask your digital human) in the following format via POST to your remote URL.
Parameter Description
Field | Type | Description | Required |
---|---|---|---|
sid | String | Your user ID, generated when creating a user. Can be viewed in account information. | Y |
dh-code | String | Digital human code, generated when each digital human is created, can be viewed in the digital human overview. | Y |
dh-question | String | The content of the question you need to ask the digital human | Y |
dh-conversation-id | String | Conversation ID, a unique identifier for the conversation | Y |
dh-context | String | Context information generated during the conversation, this information is a stringified JSON format data. | N |
Request Example:
Response Body Specification:
Field | Type | Description | Required |
---|---|---|---|
answer | String | Return answer | Y |
isEnd | boolean | Whether to end | Y |
Expected Response Time: The interaction with digital humans is sensitive to latency due to their real-time nature. Therefore, response time is an important factor to consider when processing requests from the DUIX platform. These services should respond within 95% of the time within 20 seconds. If the response time exceeds 20s, the request will report a timeout error, but the digital human will continue to respond.
Get Conversation Details
Interface Address:
/duix-openapi-v2/sdk/getConversationById?conversationId=[duix platform conversation id]
Request Method: GET
Interface Description:
Query conversation details based on the conversation id created by the duix platform
Parameter Description
Parameter Name | Type | Pass Method | Parameter Description |
---|---|---|---|
conversationId | String | Query | conversationId created by the platform |
Response Parameters:
Parameter Name | Type | Description |
---|---|---|
code | String | Return code |
data | JSON | Return data |
detailDto | JSON | Conversation resource details (including model, background, tts) |
detailDto.backgroundDto | JSON | Conversation resource details (background) |
detailDto.modelId | String | Model ID |
detailDto.modelName | String | Model Name |
detailDto.modelIdType | String | Model Type (0: Cloud Digital Human, 1: Local Digital Human) |
detailDto.localModelInfo | JSON | Local Digital Human Information |
detailDto.backgroundDto | JSON | Conversation resource details (background) |
detailDto.backgroundDto.backgroundUrl | String | Background Address |
scriptDtoList | JSON | Frontend Dialog Details |
scriptDtoList.scriptType | String | 0 Wake-up Word, 1 Opening Line, 2 Waiting Phrase, 3 Unknown Question, 4 Farewell Phrase, 5 Interruption Phrase, 6 Interruption Sentence, 7 Guiding Phrase) |
scriptDtoList.scriptContent | String | Frontend Dialog Text |
scriptDtoList.ttsContent | String | Frontend Dialog Audio |
message | String | Text Prompt |
success | boolean | Success Flag |
Response Example: