Browse Platform API
Platform API

Overview

Copy

The relationship module manages friend relationships, friend requests, relationship metadata, and blacklists from trusted backend services. A blacklist has governance implications, but its data ownership remains within user relationships rather than content moderation.

Capability scope

CapabilityDescription
Friend requestsSend requests, list received or sent requests, and accept or reject them.
Friend queriesPage through a friend list or retrieve selected friend profiles in batches.
Friend managementDelete or import relationships and update remarks, pinned state, and extension data in batches.
BlacklistsAdd users to a blacklist, remove them, and page through blacklist records.
Request record governance EnterpriseDelete friend request records sent or received by a user.

Common APIs

Resource representations

Relationship resources describe state between users, including friendships, friend requests, and blacklists.

FriendInfo

FriendInfo represents the relationship between an owner and a friend.

FieldTypeDescription
ownerUserIDstringUser ID that owns the friend record.
remarkstringOwner-defined friend remark.
createTimeint64Relationship creation time, normally a Unix timestamp in milliseconds.
friendUserobjectFriend profile represented by UserInfo.
addSourceintHow the relationship was established. See AddSource.
operatorUserIDstringUser that created or updated the relationship.
exstringRelationship extension data.
isPinnedbooleanWhether the friend record is pinned.

FriendRequestInfo

FriendRequestInfo represents a friend request record.

FieldTypeDescription
fromUserIDstringRequesting user ID.
fromNicknamestringRequesting user's nickname.
fromFaceURLstringRequesting user's avatar URL.
toUserIDstringRecipient user ID.
toNicknamestringRecipient's nickname.
toFaceURLstringRecipient's avatar URL.
handleResultintRequest result. See FriendRequestResult.
reqMsgstringRequest message.
createTimeint64Request creation time.
handlerUserIDstringUser that handled the request.
handleMsgstringHandling message.
handleTimeint64Time when the request was handled.
exstringFriend request extension data.

BlackInfo

BlackInfo represents a user blacklist relationship.

FieldTypeDescription
ownerUserIDstringUser ID that owns the blacklist record.
createTimeint64Time when the user was added to the blacklist.
blackUserInfoobjectPublic profile of the blocked user, represented by PublicUserInfo.
addSourceintHow the blacklist record was created. See AddSource.
operatorUserIDstringUser that performed the operation.
exstringBlacklist extension data.

Enums

AddSource

AddSource describes how a friendship or blacklist relationship was established.

ValueNameDescription
1BecomeFriendByImportImported by an administrator or backend service.
2BecomeFriendByApplyEstablished through a friend request.

FriendRequestResult

ValueNameDescription
-1RefuseRejected.
0NotHandlePending.
1AgreeAccepted.

Integration advice

Your backend should decide whether a relationship may be created, deleted, or imported. Confirm both users exist in your business system and record the operator, source, and reason before calling OpenIM. Combine these APIs with Webhooks or a business approval workflow when risk controls are required.

Treat blacklists as relationship data. A product may link to blacklist operations from a moderation surface, but the API remains in this module so that users do not mistake it for channel or message moderation.