X (Twitter) DM API for AI agents
Connect your X account and your AI agent can read and answer your DMs with text, photos and files, start a DM with someone who expects to hear from you, and schedule messages.
What your agent can do on X
- Answer DMs, with photos and files
- Start a DM with someone who expects to hear from you
- Schedule messages and run automations
Three steps
- Start a trial and connect X. You sign in to X through a secure link and approve the connection.
- Add Spaces to your AI agent with one URL,
https://api.spacesos.com/mcp/x, or use the REST API athttps://api.spacesos.com/v1. Steps for each AI client. - Your agent reads and answers. Spaces paces every message inside the limits that keep the account safe.
Or paste this into your agent and let it set things up with you:
Set up Spaces for me by following https://www.spacesos.com/agentsThe core tools
| What it does | MCP tool | REST |
|---|---|---|
| Your conversations, newest first. Filter to unread. | list_messaging_chats | GET …/chats |
| The messages in one conversation. | list_messaging_messages | GET …/chats/{chat_id}/messages |
| An image, file, voice note or video from a message. | get_messaging_attachment | GET …/chats/{chat_id}/messages/{message_id}/attachments/{attachment_id} |
| Reply in a conversation, with text or attachments. | reply_in_chat | POST …/chats/{chat_id}/messages |
| Start a new conversation with someone who expects to hear from you. | start_chat | POST …/chats |
| Send a message at a set local time, inside working hours you choose. | schedule_message | POST /v1/messaging/schedules |
Every X tool · X MCP guide · Full reference
Limits that keep the account safe
Up to 100 messages a day per account, at least 20 seconds apart, with 20 new chats a day at most and a four-week warm-up for new accounts. X limits in full · How accounts are kept safe.
FAQ
Do I need an X developer account or a paid API tier?
No. You sign in to X through a secure link and approve the connection. Spaces is priced per connected account.
Can my agent send DMs on X?
Yes, inside conservative daily limits: up to 100 messages a day, with fewer new conversations while a new account warms up.
How much does the X API cost?
Plans from $19 a month for one connected account, with a trial. You pay per connected account, not per message or per contact.