Platform API
Add a notification account
Use Add a notification account to create an OpenIM account for system or business notifications. A notification account is still a user account, but its appMangerLevel must satisfy the server's notification-account requirement.
HTTP request
POST {API_ADDRESS}/user/add_notification_accountRequest example
curl --request POST "${API_ADDRESS}/user/add_notification_account" \
--header "Content-Type: application/json; charset=utf-8" \
--header "operationID: ${OPERATION_ID}" \
--header "token: ${ADMIN_TOKEN}" \
--data-raw '{
"userID": "notice_001",
"nickName": "Alice",
"faceURL": "https://cdn.example.com/avatar/notice.png",
"appMangerLevel": 60
}'Keep administrator tokens on trusted backend services only. Client applications should use user tokens issued by your backend.
Request body
{
"userID": "notice_001",
"nickName": "Alice",
"faceURL": "https://cdn.example.com/avatar/notice.png",
"appMangerLevel": 60
}| Parameter | Required | Type | Description |
|---|---|---|---|
| userID | No | string | Notification account ID. If omitted, the server attempts to generate one. |
| nickName | Yes | string | Notification account display name. |
| faceURL | No | string | Notification account avatar URL. |
| appMangerLevel | Yes | int | Application management level; it must meet the server requirement for notification accounts. |
Response
OpenIM usually returns 200 OK when the request reaches the service. Use errCode in the JSON response to determine business success; errCode === 0 means the operation succeeded.
{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {
"userID": "notice_001",
"faceURL": "https://cdn.example.com/avatar/notice.png",
"nickName": "Alice",
"appMangerLevel": 60
}
}Response fields
| Field | Type | Description |
|---|---|---|
| errCode | int | Business error code. 0 means success. |
| errMsg | string | Short error message. |
| errDlt | string | Detailed error information for troubleshooting. |
| data | object | Endpoint-specific response data. |
| userID | string | OpenIM user ID. |
| faceURL | string | Avatar or icon URL. |
| nickName | string | User nickname. |
| appMangerLevel | int | Application manager level returned by OpenIM. |
Error response
When a request fails, OpenIM returns the same error envelope. See Error codes for the full handling model.
{
"errCode": 1004,
"errMsg": "RecordNotFoundError",
"errDlt": ": [1004]RecordNotFoundError"
}| Scenario | Possible cause | Recommended action |
|---|---|---|
| Authentication failed | token is missing, expired, or not an administrator token. | Issue a new administrator token and keep it on the backend. |
| Traceability is weak | operationID is missing or reused across many requests. | Generate a unique operationID for every request and log it with the response. |
| Validation failed | The request body has an invalid type, missing field, or unsupported enum value. | Compare the payload with the request table and retry after correcting the fields. |
Permissions and limits
- Create and manage notification accounts only from trusted backend services.
- A supplied
userIDmust not conflict with an existing user. - Do not expose notification-account creation as a self-service client operation.
Related pages
Was this page helpful?