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

Nacos Open API Overview

Nacos Open APIs are divided into Client Open API, Admin Open API, and Console Open API according to caller type and usage scenario. This page helps you choose the right API type and understand common conventions such as response formats and error codes.

If you already know which API type to use, read the “0. Notes” section in the corresponding API page. It explains the path prefix, port, authentication behavior, and Swagger entry for that API type.

1. Choose the API Type First

API TypeCallerBest ForDocument
Client Open APIRegular applications, microservice applications, AI Agent applications, and custom clients.Reading known configurations and registering, deregistering, querying, or discovering known services. It targets specific resources and may be called frequently at runtime.Client API
Admin Open APIOperations platforms, release platforms, audit tools, automation scripts, and administrators.Publishing and managing configurations, services, namespaces, plugins, server state, and AI resources. It is a management-plane API and supports range queries and batch management.Admin API
Console Open APIThe Nacos console and custom console UI.Supporting console page data and interactions. It overlaps with Admin API in some areas but follows console display and interaction flows.Console API

Business applications should prefer Client SDKs. Use Client Open API directly only when a language runtime does not have a suitable SDK, or when you only need a small number of HTTP calls.

Do not use Console Open API as a general operations interface. Custom console UI can use Console Open API. Operations automation, release platforms, and audit tools should prefer Admin Open API or Maintainer SDK.

2. Nacos Open API Access Protocols

Nacos 3.0 mainly supports two access protocols: gRPC and HTTP 1.1. Different API types use different protocols according to their runtime characteristics.

  • Client Open API mainly uses gRPC. gRPC is built on HTTP/2 and uses protobuf for multi-language communication, which better matches the high-throughput and low-latency requirements of runtime clients. Some Client Open APIs also provide HTTP 1.1 endpoints for languages or environments that do not have stable gRPC support.
  • Admin Open API and Console Open API use HTTP 1.1, which is easier to call from operations tools, automation scripts, and browser-based UI.

3. Nacos Open API Conventions

3.1. gRPC API Response Format

In Nacos 3.0 gRPC Open API, responses are carried by Payload in the proto file. The response contains the following fields:

NameTypeDescription
resultCodeintAPI result code. 200 means success, and 500 means failure.
errorCodeintAPI error code. It is present when the status is 500. For details, see API Error Codes.
messagestringAPI message. When the status is 500, it describes the error detail.
requestIdstringAPI request ID.

3.2. HTTP API Response Format

In Nacos 3.0 HTTP Open API, all responses use JSON and share the same response structure:

{
"code": 0,
"message": "success",
"data": {}
}

The response fields are described below:

NameTypeDescription
code intError code. 0 means success, and non-zero values indicate failure.
messageStringError message. It is "success" when the request succeeds.
dataAnyResponse data. When the request fails, it contains detailed error information.

Because successful responses share the same code and message values, later API sections only describe the data field.

3.3. API Error Codes

The following table summarizes common error codes and messages:

Error CodeMessageMeaning
0successThe operation succeeded.
10000parameter missingA required parameter is missing.
10001access deniedAccess is denied.
10002data access errorA data access error occurred.
20001'tenant' parameter errorThe tenant parameter is invalid.
20002parameter validate errorParameter validation failed.
20003MediaType ErrorThe request MediaType is invalid.
20004resource not foundThe resource was not found.
20005resource conflictA resource conflict occurred.
20006config listener is nullThe configuration listener is empty.
20007config listener errorA configuration listener error occurred.
20008invalid dataIdThe dataId is invalid, often due to auth failure.
20009parameter mismatchRequest parameters do not match.
21000service name errorThe serviceName parameter is invalid.
21001weight errorThe weight parameter is invalid.
21002instance metadata errorInstance metadata is invalid.
21003instance not foundThe instance does not exist.
21004instance errorInstance information is invalid.
21005service metadata errorService metadata is invalid.
21006selector errorThe access policy selector is invalid.
21007service already existThe service already exists.
21008service not existThe service does not exist.
21009service delete failureService deletion failed because instances still exist.
21010healthy param missThe healthy parameter is missing.
21011health check still runningThe health check is still running.
22000illegal namespaceThe namespace is invalid.
22001namespace not existThe namespace does not exist.
22002namespace already existThe namespace already exists.
23000illegal stateThe state is invalid.
23001node info errorNode information is invalid.
23002node down failureThe node offline operation failed.
30000server errorOther internal server errors.