> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# POST (/users/xuid({xuid})/outbox)

> POST (/users/xuid({xuid})/outbox)

# POST (/users/xuid({xuid})/outbox)

将指定消息发送给收件人列表。
这些 URI 的域为 `msg.xboxlive.com`。

* [备注](#ID4EV)
* [URI 参数](#ID4EAB)
* [授权](#ID4ENB)
* [隐私设置对资源的影响](#ID4EYB)
* [请求正文](#ID4E3F)
* [HTTP 状态代码](#ID4ETCAC)
* [响应正文](#ID4E1EAC)

## 备注

此 API 支持的唯一内容类型是 “application/json”,每次调用的 HTTP 标头中都需要此内容类型。

## URI 参数

| 参数 | 类型 | 说明 |
| - | - | - |
| xuid | 64 位无符号整数 | 发出请求的玩家的 XBOX User ID (XUID)。 |

## 授权

必须具有自己的用户声明和有效的黄金订阅才能发送用户消息。

## 隐私设置对资源的影响

无论玩家是否为好友,向其成功发送用户消息都会返回结果代码 200。但是,如果向已阻止你的人发送消息,收件人将不会收到该消息,并且你也不会收到任何指示消息未成功的通知。

每天可发送的消息数以及可发送给好友和非好友的数量也有限制,如下所示。

* 每条消息 20 名陌生人
* 每 24 小时 200 名陌生人
* 每 24 小时共 250 条消息
* 每 24 小时共 2500 个收件人

\| 请求用户 | 目标用户的隐私设置 | 行为 |
\| --- | --- | --- | --- | --- | --- |
\| me | - | 如所述。 |
\| friend | everyone | 200 OK |
\| friend | friends only | 200 OK |
\| friend | blocked | 200 OK |
\| non-friend user | everyone | 200 OK |
\| non-friend user | friends only | 200 OK |
\| non-friend user | blocked | 200 OK |
\| third-party site | everyone | 200 OK |
\| third-party site | friends only | 200 OK |
\| third-party site | blocked | 200 OK |

## 请求正文

| 属性 | 类型 | 最大长度 | 使用方 | 备注 |
| - | - | - | - | - |
| header | Header | | 所有 | 用户消息标头 |
| messageText | string | 250 | 除 Windows 8 之外的所有平台 | 用户消息文本 (UTF-8) |

#### Header

| 属性 | 类型 | 最大长度 | 使用方 | 备注 |
| - | - | - | - | - |
| recipients | User\[] | 20 | 所有 | 消息收件人列表 |

#### User

| 属性 | 类型 | 最大长度 | 使用方 | 备注 |
| - | - | - | - | - |
| xuid | ulong | | 所有 | 收件人的 XUID。如果发送了 gamertag,则不使用。 |
| gamertag | string | 15 | 所有 | 收件人的游戏玩家代号。如果发送了 XUID,则不使用。 |

#### 请求正文示例

```cpp theme={null}
{
          "header":
          {
            "recipients":
            [{"gamertag":"GoTeamEmily"},
            {"gamertag":"Longstreet360"}]
          },
          "messageText":"random user text"
        }

```

## HTTP 状态代码

服务针对使用此方法对此资源发出的请求,返回本节中的某个状态代码。有关与 XBOX Live 服务一同使用的标准 HTTP 状态代码的完整列表,请参见 [标准 HTTP 状态代码](https://devdocs.xbox.com/zh-CN/reference/live/rest/additional/httpstatuscodes)。

\| 代码 | 说明 |
\| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
\| 200 | 成功。 |
\| 400 | 收件人列表为空或超过最大长度;或同时指定了 gamertag 和 XUID;或 messageText 过长。 |
\| 403 | 无法转换 XUID。 |
\| 404 | Gamertag 无效或找不到用户。 |
\| 409 | 用户已达到系统规定的每日限制。 |
\| 500 | 常规服务器端错误。 |

## 响应正文

响应正文中不发送任何对象。

## 另请参阅

##### 父主题

[/users/xuid({xuid})/outbox](https://devdocs.xbox.com/zh-CN/reference/live/rest/uri/users/uri-usersxuidoutbox)

##### 参考资料  [标准 HTTP 状态代码](https://devdocs.xbox.com/zh-CN/reference/live/rest/additional/httpstatuscodes)


## Related topics

- [XblSocialSubmitReputationFeedbackAsync](https://devdocs.xbox.com/fr-CA/reference/live/xsapi-c/social_c/functions/xblsocialsubmitreputationfeedbackasync.md)
- [XblAchievementsManagerUpdateAchievement](https://devdocs.xbox.com/es/reference/live/xsapi-c/achievements_manager_c/functions/xblachievementsmanagerupdateachievement.md)
