# Send peer-to-peer message (/en/api-reference/api-ref/signaling/peer-to-peer-message)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

Sends a peer-to-peer Signaling message from the server.

- OpenAPI: /openapi/rtm/signaling-rest.en.yaml
- Operation ID: send-peer-message
- Method: POST
- Path: /{appid}/rtm/users/{user_id}/peer_messages

## Servers

- https://api.agora.io/dev/v2/project

## Parameters

- `appid` (path, required) - The App ID of your Agora project.
- `user_id` (path, required) - Signaling user ID to send a peer-to-peer message. It must not exceed 64 characters in length or be an empty string. Since `user_id` is a URL parameter, the first and last characters must not be a space.
- `wait_for_ack` (query, optional) - Whether the API returns the HTTP response after Signaling receives the acknowledgement from the receiver.

- `true`: The API waits for the receiver to acknowledge receipt of
  the message before returning the HTTP response.

- `false`: The API returns the HTTP response immediately after the
  Agora RTM server receives the message, without waiting for
  receiver acknowledgement.

## Request body

- `destination` (string, required) - Signaling user ID to receive a peer-to-peer message. It must not exceed 64 characters in length or be an empty string.
No schema.
- `enable_offline_messaging` (boolean) - Whether to enable offline messages.
- `true`: Enable offline messages. If the receiver is offline when you send a peer-to-peer message, Signaling saves the message (maximum 200 per receiver) and delivers it when the receiver is online.
- `false`: Disable offline messages.
No schema.
- `enable_historical_messaging` (boolean) - Whether to save as a historical message.

- `true`: Save as a historical message.
- `false`: Do not save as a historical message.
No schema.
- `payload` (string, required) - Content of the peer-to-peer message. It must not be an empty string or exceed 32 KB in length.
No schema.

## Responses

### 200

The request was successful. The response body contains the result of the request.

- `result` (string) - Request result. `success` if the request succeeds, `failed` if it fails.

Request result.

 - success: The request succeeds.
 - failed: The request fails.
No schema.
- `request_id` (string) - Unique ID to identify this request.
No schema.
- `code` (string) - Message status: `message_sent`, `message_delivered`, or `message_offline`.

Message status.

 - message_sent: The message is sent.
 - message_delivered: The message is received.
 - message_offline: The receiver is offline.
No schema.
### default

The request failed. The response body includes the error code and description.

No schema.
