Browse Platform API
Platform API

Error codes

Copy

OpenIM REST APIs use a common error response envelope. A request may return HTTP 200 OK and still fail at the business layer, so always check errCode; errCode === 0 means the operation succeeded.

Response structure

{
  "errCode": 1001,
  "errMsg": "ArgsError",
  "errDlt": "request body or header is invalid"
}
FieldTypeDescription
errCodeintOpenIM business error code. 0 means success.
errMsgstringShort error message for logs and diagnostics.
errDltstringDetailed error text for parameter, permission, or server-state troubleshooting.
dataobjectSuccessful responses may include endpoint-specific data.

Error code ranges

RangeSourceDescription
0Common success codeThe business operation succeeded.
1-9999OpenIM server errorsMain REST API and server-side error range.
10000-20000OpenIM client errorsSDK or client runtime errors, not expanded as server Platform API codes.
20001-29999Business webhook errorsCustom backend errors returned by webhook or business logic.

Handling flow

  1. Check the HTTP status first for network, gateway, or infrastructure failures.
  2. Parse the JSON response and use errCode as the business success flag.
  3. When errCode !== 0, log operationID, endpoint path, request summary, errCode, errMsg, and errDlt.
  4. Fix authentication, permission, and parameter errors before retrying.
  5. Convert internal error details into product-safe messages before showing them to end users.

Server error codes

CodeCategoryMeaningRecommended action
0SuccessSuccessContinue reading endpoint-specific data.
500ServerInternal server errorCheck OpenIM services, dependencies, and internal networking.
1001RequestInvalid argumentsCheck headers, JSON types, required fields, and enum values.
1002RequestPermission deniedConfirm that token is a valid administrator token and the operation is authorized.
1003RequestDuplicate primary keyCheck whether the user, group, or business ID was already submitted.
1004RequestRecord not foundConfirm that the target user, group, message, or relationship exists.
1101UserUser ID does not existRegister or import the user before calling dependent APIs.
1102UserUser already registeredTreat repeated registration as idempotent success or a business conflict.
1201GroupGroup does not existConfirm that groupID exists and has not been dismissed.
1202GroupGroup already existsUse another groupID or check whether creation already succeeded.
1203GroupUser is not in the groupConfirm membership before member-level operations.
1204GroupGroup dismissedStop group operations and sync business-side group state.
1205GroupUnsupported group typeCheck that groupType is supported by the deployment.
1206GroupGroup application already processedMake join-request handling idempotent.
1301RelationshipCannot add yourself as a friendReject self-targeted friend operations before calling OpenIM.
1302RelationshipBlocked by the other userResolve blacklist state before continuing friend workflows.
1303RelationshipThe target user is not a friendEstablish the relationship before friend-dependent operations.
1304RelationshipAlready friendsTreat the existing relationship as success.
1401MessageRead status is disabledAvoid workflows that depend on read status when the feature is off.
1402MessageMember is mutedCheck the member mute end time or unmute before sending.
1403MessageGroup is mutedUnmute the group before sending.
1404MessageMessage already revokedSync message state in the business system.
1405MessageAuthorization expiredRefresh the related credential and retry.
1501TokenToken expiredRefresh or issue a new token.
1502TokenToken invalidReissue the token and check signing keys, user ID, and platform.
1503TokenToken format errorCheck whether the token string was truncated or encoded incorrectly.
1504TokenToken not active yetCheck server time and token effective time.
1505TokenUnknown token errorLog full details and reissue the token.
1506TokenToken was kickedAsk the client to log in again.
1507TokenToken missingConfirm that the request header or login payload includes a token.
1601ConnectionToo many gateway connectionsCheck gateway limits and scale or clear abnormal connections.
1602ConnectionInvalid connection handshakeCheck platform ID, user ID, token, and client version.
1701FileUpload expiredInitialize upload again and use fresh credentials.

Troubleshooting

ScenarioRecommendation
Error cannot be reproducedUse the same operationID across business logs, OpenIM API logs, and gateway logs.
Many 1001 errorsCheck JSON field types, required fields, pagination, and headers.
Many 1002 or 1501-1507 errorsReview administrator token issuing, refresh, and storage logic.
Group or member errorsConfirm groupID, member role, group state, and operator permission before retrying.
File upload errorsInitialize upload again and verify object name, signature, and expiration time.