Skip to main content

API definition

Every development mode defines an API through three parts: basic information, request parameters and response parameters. The development mode determines how the API executes; these three parts determine what the API looks like, how it is called and what structure it returns.

Basic information​

Click "Basic information" on the right side of the workbench to open the configuration drawer.

FieldDescriptionConstraint
API IDGenerated by the platform after savingRead-only
API nameDisplay name, up to 100 charactersRequired
API pathThe platform's external path, prefixed with the project's unified prefixRequired; letters, digits, /, - and _ only; must not contain //
Request methodGET / POST / PUT / PATCH / DELETEGET only for table mode, Elasticsearch and Hive
Operation typeQuery / Insert / Update / DeleteQuery only for table mode; Hive does not support insert
Visibility levelPublic (visible to everyone) / Private (visible only to yourself)Private APIs do not appear in other users' selectable lists
Authentication methodNone / Simple (AppKey) / Signature (AppKey + AppSecret)See the notes below
Release protocolREST is always checked; MCP is optionalMCP is selectable only with simple authentication
API groupThe group tree on the left determines where the API is filedRequired
API categoryBusiness category used for list filteringOptional
Enable transactionCommits or rolls back as a whole when a write operation has multiple statementsNot shown in proxy and orchestration modes
VersionPositive integerRequired
TimeoutAPI execution timeout in msIn proxy mode, set separately in the route configuration
DescriptionAPI purpose and caveatsOptional

Authentication methods​

TypeCaller needsUse case
NoneNo credentialIntranet or public data only; not recommended for production
Simple authenticationX-AppKeyInternal systems and MCP calls
Signature authenticationX-AppKey + signature headersOpen platforms and public internet calls; tamper-proof and replay-proof

For the signature algorithm, request headers and verification flow, see Signature authentication. An API's authentication method only specifies the allowed authentication types; to actually call the API, an application credential must also be authorized for it.

Release protocols​

  • REST: Always enabled; this is the default way to call the API.
  • MCP: When checked, the API is exposed to agents as an MCP tool. It can be checked only when the authentication method is "Simple authentication".

Request parameters​

The "Request parameters" panel on the right defines what callers can pass.

FieldDescription
Parameter nameThe externally exposed parameter name, referenced in SQL as #{parameterName}
Target parameter nameProxy mode only: the parameter name mapped to the third party; if left empty, the same name is used
Parameter typeString / Int / Float / Array / Object / Boolean
Parameter locationQuery / Body / Header; path parameters are detected automatically from #{name}
RequiredYes / No
Example valueDefault example for documentation and the test panel
Default valueUsed when the caller does not pass a value
DescriptionParameter meaning
Child parametersClick + to add nested structures for Object / Array

Script mode supports Parse: it extracts #{} placeholders from the SQL automatically to generate parameters, reducing manual entry. If you rename a parameter, references in the SQL are not renamed automatically and must be updated accordingly.

Pagination parameters​

Query-type SQL APIs can enable pagination:

  • When enabled, two parameters, pageNum and pageSize, are added automatically.
  • pageSize has an upper limit of 1000; non-positive or missing values fall back to the default.
  • Proxy, orchestration and Hive data sources do not offer this switch.
  • In table mode, after you check pagination, the page generates the corresponding parameters.

Response parameters​

The "Response parameters" panel on the right defines response fields and structure.

FieldDescription
Parameter nameThe external response field name
Source fieldSQL column name / script field / third-party field (depending on the mode)
Parameter typeString / Int / Float / Array / Object / Boolean
LocationIn proxy mode, indicates whether the field sits in code, data, msg, timestamp, traceId or another location
Example valueDocumentation example
Default valueFallback value when the field is empty
DescriptionField meaning
Child parametersNested object/array structure
  • Script mode can parse response parameters automatically from the SQL result.
  • Proxy mode can import a response structure by pasting a third-party JSON response.
  • Undeclared fields do not appear in the response examples of the API documentation, but whether the actual response is trimmed depends on the data plugin configuration.

Unified response structure​

APIs return the platform's unified structure by default:

{
"code": 0,
"msg": "success",
"data": {},
"traceId": "..."
}
  • code=0 means success; any non-zero value means a business failure.
  • For the mapping between error codes and HTTP status codes, see Error codes.
  • Proxy mode keeps the third party's original response by default; it is converted into a platform business error only after error mapping is configured.
  • Streaming or raw response support depends on the API type and the release protocol.

Save, release and versions​

ActionResult
SaveWrites a draft that does not serve traffic; an online API must be taken offline before saving
ReleaseGenerates a release snapshot that takes effect in the current environment and sets the API status to online
Version upgradeCopies the current definition with the version number + 1 and saves it as a new version
Take offlineStops serving traffic while keeping the definition and history

The version number is the business version of the API definition and is not the same as a release batch. For comparing, rolling back and migrating releases, see Environments and releases and Versions and migration.

Validation and common errors​

MessageCauseResolution
Please enter an API nameThe name is emptyEnter a name
Invalid API path formatContains Chinese characters, spaces or illegal charactersKeep only letters, digits, /, - and _
Consecutive slashes are not allowedThe path contains //Fix the path
Please select a groupNo API group is selectedSelect or create one in the group tree on the left
Take the API offline before savingThe API is onlineTake it offline first, then save
Save before releasingThere are unsaved changesSave first
MCP cannot be checkedThe authentication method is not simple authenticationSwitch to simple authentication