Direct Messages
Send direct messages (DMs) and retrieve conversations on connected social media accounts.
Send a Direct Message
Send a DM directly to a user using their platform-specific User ID.
Endpoint
POST /api/uploadposts/dms/send
Headers
| Name | Value | Description |
|---|---|---|
| Authorization | Apikey your-api-key-here | Your API key for authentication |
Body Parameters (JSON)
| Name | Type | Required | Description |
|---|---|---|---|
| platform | String | Yes | The platform to send the DM on (e.g., "instagram"). |
| user | String | Yes | Profile username (as configured in Upload-Post). |
| recipient_id | String | Yes | The platform-specific User ID of the recipient. |
| message | String | Yes | The text message to send. |
Example Request
curl -X POST https://api.upload-post.com/api/uploadposts/dms/send \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{
"platform": "instagram",
"user": "my-profile",
"recipient_id": "17841400123456789",
"message": "Hello! Thanks for reaching out."
}'
Responses
- 200 OK (DM sent successfully)
{
"success": true,
"recipient_id": "17841400123456789",
"message_id": "aWdGM...",
"message": "DM sent successfully"
}
- 400 Bad Request (missing fields, invalid account)
{
"success": false,
"error": "Missing required fields: platform, user, recipient_id, message"
}
- 429 Too Many Requests (daily DM limit exceeded)
{
"success": false,
"error": "Daily DM limit exceeded."
}
- 500 Internal Server Error
{
"success": false,
"error": "An internal server error occurred."
}
Get Conversations
Retrieve the list of DM conversations for an account, including participants and recent messages.
Endpoint
GET /api/uploadposts/dms/conversations
Headers
| Name | Value | Description |
|---|---|---|
| Authorization | Apikey your-api-key-here | Your API key for authentication |
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| platform | String | Yes | The platform to retrieve conversations from (e.g., "instagram"). |
| user | String | Yes | Profile username (as configured in Upload-Post). |
Example Request
curl 'https://api.upload-post.com/api/uploadposts/dms/conversations?platform=instagram&user=my-profile' \
-H 'Authorization: Apikey your-api-key-here'
Responses
- 200 OK
{
"success": true,
"conversations": [
{
"id": "t_123456789",
"participants": {
"data": [
{ "id": "17841400123456789", "username": "user_one" },
{ "id": "17841400987654321", "username": "user_two" }
]
},
"messages": {
"data": [
{
"id": "aWdGM...",
"created_time": "2025-01-15T10:30:00+0000",
"from": { "id": "17841400123456789", "username": "user_one" },
"to": { "data": [{ "id": "17841400987654321", "username": "user_two" }] },
"message": "Hey, thanks for the info!"
}
]
}
}
]
}
- 400 Bad Request
{
"success": false,
"error": "Missing required query parameters: platform, user"
}
- 500 Internal Server Error
{
"success": false,
"error": "An internal server error occurred."
}
Important Notes
-
Messaging policies vary by platform: Each platform has its own messaging rules. For example, Instagram requires the recipient to have messaged your account first (24-hour window).
-
Daily DM limits: Upload-Post enforces a configurable daily DM limit per user to prevent accidental overuse. When the limit is reached, the API returns a
429status code.
Where to find the recipient ID
The recipient's User ID can be obtained from:
- The Get Conversations endpoint above (each participant has an
idfield). - The Get Post Comments endpoint (
GET /api/uploadposts/comments) where each comment includes the commenter'suser.id.
Difference from Comment Replies
| Feature | Comment Reply (/comments/reply) | Direct Message (/dms/send) |
|---|---|---|
| Recipient | comment_id — replies to a specific comment | recipient_id — sends to a user by ID |
| Use case | Auto-reply to post engagement | Customer support, follow-up conversations |