Skip to main content
DashScope API

Workflow Application API Reference

Input and output parameters when invoking Alibaba Cloud Bailian workflow applications via the DashScope API

This document describes the input and output parameters for invoking Alibaba Cloud Bailian workflow applications through the DashScope API.

Prerequisites

Before you begin, ensure you have completed the following steps:
  1. Create an application: Go to Application Management to create a Bailian workflow application and obtain your app_id.
  2. Obtain an API Key: Retrieve your API Key from API Key Management and configure it as an environment variable.
  3. Install the SDK (optional): If using an SDK, install the corresponding DashScope SDK for your programming language.

Invocation Methods

  • HTTP API Call Endpoint: POST https://dashscope.aliyuncs.com/api/v1/apps/{APP_ID}/completion
    Replace {APP_ID} with your actual application ID.
  • SDK Call The Python and Java SDKs are preconfigured with the correct endpoint.

Request Body

ParameterTypeRequiredDescription
app_idstringYesApplication identifier. Found on the application card in Application Management.
promptstringYesUser’s input instruction. For HTTP calls, include this inside the input object.
session_idstringNoSession identifier for conversation history. When provided, the request automatically includes previously stored conversation history from the cloud.
workspacestringNoBusiness workspace identifier. Required only when invoking applications deployed under a sub-workspace.
streambooleanNoWhether to return responses in streaming mode. Default: false.
incremental_outputbooleanNoWhether to enable incremental output in streaming mode. Default: false.
biz_paramsobjectNoCustom parameters passed to the workflow application.

Code Examples

import os
from http import HTTPStatus
from dashscope import Application

response = Application.call(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    app_id='APP_ID',  # Replace with your actual app ID
    prompt='Hello')

if response.status_code != HTTPStatus.OK:
    print(f'request_id={response.request_id}')
    print(f'code={response.status_code}')
    print(f'message={response.message}')
else:
    print(response.output.text)

Response Object

ParameterTypeDescription
status_codeintegerHTTP status code. 200 indicates success.
request_idstringUnique identifier for this API call.
codestringError code; empty on success.
messagestringDetailed error message; ignored on success.
outputobjectResult of the invocation.
usageobjectToken usage and model information for this request.

output Properties

ParameterTypeDescription
textstringModel-generated response content.
finish_reasonstringReason for completion. stop indicates natural termination.
session_idstringUnique identifier for the current conversation session.

usage Properties

ParameterTypeDescription
modelsarrayInformation about models used in this request.
models[].model_idstringModel ID.
models[].input_tokensintegerNumber of input tokens consumed.
models[].output_tokensintegerNumber of output tokens generated.

QPM Limits

The default QPM (queries per minute) limit per application is 15,000.

Error Codes

If the API call fails and returns an error, refer to the Error Code Documentation for troubleshooting.
Overview
Managed Agent API
Sandbox API
Memory API
Flow Agent API
RAG API
Connector API
Framework Integration
Assistant API (Deprecating)
  • Overview
Workflow Application API Reference - 阿里云百炼 Agent Studio