Skip to content
OpenClaw 不踩坑恶意 Skills ,企业需 Skills Registry:Nacos 3.2 发布Know more

Client API

For how to obtain and configure access credentials when using the default auth plugin, see Configure Access Credentials.

0. Client API Notes

0.1. Scope

Client APIs are intended for application runtime access and custom clients. Callers usually already know the namespaceId, groupName, dataId, serviceName, or instance information they need to access.

Good FitNot a Good Fit
Querying a single known configuration.Publishing, deleting, importing, or exporting configurations.
Registering, deregistering, querying, and discovering known services or instances.Querying full configuration lists, full service lists, subscriber lists, or other range-based data.
Using HTTP for a small amount of runtime access when no suitable SDK is available.Building release platforms, operations platforms, gateway control planes, or audit tools.

Business applications should prefer SDKs. For range-based management capabilities, use Admin API or Maintainer SDK.

0.2. Unified Path Format

Nacos client APIs use a unified path format: [/$nacos.server.contextPath]/v3/client/[module]/[subPath]....

  • $nacos.server.contextPath: Root path of the client APIs. The default value is /nacos, and it can be changed with the nacos.server.contextPath configuration item.
  • module: Client API module name, such as server, cs, ns, or core.
  • subPath: Client API subpath, such as state, namespace, or config. It may contain multiple path levels.

The client APIs listed below use the default $nacos.server.contextPath. If the deployment changes $nacos.server.contextPath, update the request URL accordingly when calling the API.

The examples below also use the default Nacos Web Server port. If the deployment changes $nacos.server.main.port, update the request URL accordingly when calling the API.

0.3. Swagger Documentation

Nacos 3.X client OpenAPI also provides Swagger-style documentation. You can view it at Nacos Swagger HTTP Client API.

1. Configuration Management

1.1. Get Configuration

Description

Get the specified configuration.

Since

3.0.0

Request Method

GET

Request URL

/nacos/v3/client/cs/config

Request Headers

NameTypeRequiredDescription
User-AgentstringNoUser agent. It is empty by default and is usually Nacos-${program-language}-Client:v${version}.
Client-VersionstringNoClient version. It is empty by default and is usually Nacos-${program-language}-Client:v${version}.

Request Parameters

NameTypeRequiredDescription
namespaceIdstringNoNamespace. Defaults to public, which is equivalent to ''.
groupNamestringYesConfiguration group name.
dataIdstringYesConfiguration name.

Response Data

The response body follows the Nacos OpenAPI common response format. The following table describes only the fields in data.

NameTypeDescription
contentstringConfiguration content.
encryptedDataKeystringEncryption/decryption key of the configuration. This value exists only when a configuration encryption plugin is used.
contentTypestringConfiguration type, such as TEXT or JSON.
md5stringMD5 value of the configuration.
lastModifiedintegerLast modification time of the configuration.
betabooleanWhether the configuration has a beta configuration.

Other fields are reserved and currently unused. You can ignore them.

Examples

  • Request example
Terminal window
curl -X GET '127.0.0.1:8848/nacos/v3/client/cs/config?dataId=test&groupName=test'
  • Response example
{
"code": 0,
"message": "success",
"data": {
"resultCode": 200,
"errorCode": 0,
"message": null,
"requestId": null,
"content": "test",
"encryptedDataKey": null,
"contentType": "text",
"md5": "098f6bcd4621d373cade4e832627b4f6",
"lastModified": 1743151634823,
"tag": null,
"beta": false,
"success": true
}
}

2. Service Discovery

2.1. Register/Renew Instance

Description

Register or renew an instance.

Since

3.0.0

Request Method

POST

Request URL

/nacos/v3/client/ns/instance

Request Headers

NameTypeRequiredDescription
User-AgentstringNoUser agent. It is empty by default and is usually Nacos-${program-language}-Client:v${version}.
Client-VersionstringNoClient version. It is empty by default and is usually Nacos-${program-language}-Client:v${version}.

Request Parameters

NameTypeRequiredDescription
namespaceIdstringNoNamespace ID. Defaults to public.
groupNamestringNoGroup name. Defaults to DEFAULT_GROUP.
serviceNamestringYesService name.
ipstringYesIP address.
portintegerYesPort.
clusterNamestringNoCluster name. Defaults to DEFAULT.
healthybooleanNoWhether the instance is healthy. Defaults to true.
weightnumberNoInstance weight. Defaults to 1.0.
enabledbooleanNoWhether the instance is enabled. Defaults to true.
metadatastringNoInstance metadata as a JSON object string.
heartBeatbooleanNoWhether this is a renewal request. Defaults to false.

Response Data

The response body follows the Nacos OpenAPI common response format. The following table describes only the fields in data.

NameTypeDescription
datastringWhether registration or renewal succeeded. Returns ok on success, or the failure reason on failure.

Examples

  • Request example
Terminal window
# Register instance
curl -X POST "127.0.0.1:8848/nacos/v3/client/ns/instance" -d "serviceName=test1&ip=127.0.0.1&port=3306"
# Renew instance
curl -X POST "127.0.0.1:8848/nacos/v3/client/ns/instance" -d "serviceName=test1&ip=127.0.0.1&port=3306&heartBeat=true"
  • Response example
{
"code": 0,
"message": "success",
"data": "ok"
}

2.2. Deregister Instance

Description

Deregister the specified instance.

Since

3.0.0

Request Method

DELETE

Request URL

/nacos/v3/client/ns/instance

Request Headers

NameTypeRequiredDescription
User-AgentstringNoUser agent. It is empty by default and is usually Nacos-${program-language}-Client:v${version}.
Client-VersionstringNoClient version. It is empty by default and is usually Nacos-${program-language}-Client:v${version}.

Request Parameters

NameTypeRequiredDescription
namespaceIdstringNoNamespace ID. Defaults to public.
groupNamestringNoGroup name. Defaults to DEFAULT_GROUP.
serviceNamestringYesService name.
ipstringYesIP address.
portintegerYesPort.
clusterNamestringNoCluster name. Defaults to DEFAULT.

Response Data

The response body follows the Nacos OpenAPI common response format. The following table describes only the fields in data.

NameTypeDescription
datastringWhether deregistration succeeded. Returns ok on success, or the failure reason on failure.

Examples

  • Request example
Terminal window
curl -X DELETE "127.0.0.1:8848/nacos/v3/client/ns/instance?serviceName=test1&ip=127.0.0.1&port=3306"
  • Response example
{
"code": 0,
"message": "success",
"data": "ok"
}

2.3. List Instances of a Service

Description

Query the detailed instance list under the specified service.

Since

3.0.0

Request Method

GET

Request URL

/nacos/v3/client/ns/instance/list

Request Headers

NameTypeRequiredDescription
User-AgentstringNoUser agent. It is empty by default and is usually Nacos-${program-language}-Client:v${version}.
Client-VersionstringNoClient version. It is empty by default and is usually Nacos-${program-language}-Client:v${version}.

Request Parameters

NameTypeRequiredDescription
namespaceIdstringNoNamespace ID. Defaults to public.
groupNamestringNoGroup name. Defaults to DEFAULT_GROUP.
serviceNamestringYesService name.
clusterNamestringNoCluster name. If not provided, instances of all clusters will be returned.

Response Data

The response body follows the Nacos OpenAPI common response format. The following table describes only the fields in data.

NameTypeDescription
dataarrayInstance list.
data.[i].ipstringInstance IP.
data.[i].portintegerInstance port.
data.[i].weightnumberInstance weight.
data.[i].healthybooleanWhether the instance is healthy.
data.[i].enabledbooleanWhether the instance is enabled.
data.[i].ephemeralbooleanWhether the instance is ephemeral.
data.[i].clusterNamestringCluster name of the instance.
data.[i].serviceNamestringService name.
data.[i].metadatamap<string, string>Instance metadata.
data.[i].instanceHeartBeatTimeOutintegerInstance heartbeat timeout.
data.[i].ipDeleteTimeoutintegerInstance deletion timeout.
data.[i].instanceHeartBeatIntervalintegerInstance heartbeat interval.

Examples

  • Request example
Terminal window
curl -X GET '127.0.0.1:8848/nacos/v3/client/ns/instance/list?serviceName=test1'
  • Response example
{
"code": 0,
"message": "success",
"data": [
{
"ip": "127.0.0.1",
"port": 3306,
"weight": 1.0,
"healthy": true,
"enabled": true,
"ephemeral": true,
"clusterName": "DEFAULT",
"serviceName": "DEFAULT_GROUP@@test1",
"metadata": {},
"ipDeleteTimeout": 30000,
"instanceIdGenerator": "simple",
"instanceHeartBeatInterval": 5000,
"instanceHeartBeatTimeOut": 15000
}
]
}

3. AI

3.1. Query Prompt

Description

Query Prompt by version, label, or latest (priority: version > label > latest); supports md5 for 304 conditional response.

Since

3.2.0

Request Method

GET

Request URL

/nacos/v3/client/ai/prompt

Request Parameters

NameTypeRequiredDescription
namespaceIdstringNoNamespace ID. Defaults to public.
promptKeystringYesPrompt key
versionstringNoVersion (one of version, label, latest)
labelstringNoLabel (one of version, label, latest)
md5stringNoIf matches server, response is 304

Response Data

The response body follows the Nacos OpenAPI common response format. The following table describes only the fields in data.

NameTypeDescription
promptKeystringPrompt key
versionstringVersion
templatestringPrompt template content
md5stringContent md5 for 304
variablesarrayPrompt variable list

Examples

  • Request example
Terminal window
curl -X GET '127.0.0.1:8848/nacos/v3/client/ai/prompt?promptKey=myPrompt'
  • Response example
{
"code": 0,
"message": "success",
"data": {
"promptKey": "myPrompt",
"version": "1.0",
"template": "You are a helpful assistant.",
"md5": "..."
}
}

3.2. Get AgentSpec

Description

This interface allows getting an AgentSpec detail by namespace, name, version, or label.

Since

3.2.0

Request Method

GET

Request URL

/nacos/v3/client/ai/agentspecs

Request Parameters

NameTypeRequiredDescription
namespaceIdstringNoNamespace ID, default is public
namestringYesAgentSpec name
versionstringNoAgentSpec version
labelstringNoAgentSpec label
md5stringNoAgentSpec content MD5 for exact version matching

Response Data

Return body follows Nacos open API common response format; this table describes fields in data.

NameTypeDescription
namespaceIdstringNamespace of the AgentSpec
namestringAgentSpec name
descriptionstringAgentSpec description
bizTagsstringAgentSpec business tags
contentstringAgentSpec content
resourceobjectAgentSpec resource info

Examples

  • Request example
Terminal window
curl -X GET '127.0.0.1:8848/nacos/v3/client/ai/agentspecs?name=my-agent'
  • Response example
{
"code": 0,
"message": "success",
"data": {}
}

3.3. Search AgentSpecs

Description

This interface allows paginated searching of AgentSpecs by namespace and keyword.

Since

3.2.0

Request Method

GET

Request URL

/nacos/v3/client/ai/agentspecs/search

Request Parameters

NameTypeRequiredDescription
namespaceIdstringNoNamespace ID, default is public
keywordstringNoSearch keyword
pageNointegerYesPage number, typically starts from 1
pageSizeintegerYesNumber of records per page

Response Data

Return body follows Nacos open API common response format; this table describes fields in data.

NameTypeDescription
datastringAgentSpec search result (paginated object, actual fields depend on runtime response)

Examples

  • Request example
Terminal window
curl -X GET '127.0.0.1:8848/nacos/v3/client/ai/agentspecs/search?keyword=agent&pageNo=1&pageSize=10'
  • Response example
{
"code": 0,
"message": "success",
"data": {}
}

3.4. Download Skill

Description

This interface allows downloading a Skill ZIP file by namespace, name, version, or label.

Since

3.2.0

Request Method

GET

Request URL

/nacos/v3/client/ai/skills

Request Parameters

NameTypeRequiredDescription
namespaceIdstringNoNamespace ID, default is public
namestringYesSkill name
versionstringNoSkill version
labelstringNoSkill label
md5stringNoSkill content MD5 for exact version matching

Examples

  • Request example
Terminal window
curl -X GET '127.0.0.1:8848/nacos/v3/client/ai/skills?name=my-skill'
  • Response example
{
"code": 0,
"message": "success",
"data": {}
}