Profile / DM / Media: XCROP API Documentation
Profile / DM / Media
Edit the connected profile, send a direct message and upload media for a tweet. Same requirements as the other write endpoints (write permission, a paid plan, a connected X account), and each call consumes 100 flat credits
POST
/v2/account/profileUpdate the connected account's profile text. Only the fields you send change| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | optional | — | Display name, up to 50 characters |
| description | string | optional | — | Bio, up to 160 characters |
| location | string | optional | — | Location, up to 30 characters |
| url | string | optional | — | Website, up to 100 characters |
BASH
curl -X POST https://xcrop.io/api/v2/account/profile \ -H "Authorization: Bearer $XCROP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "description": "Building on X data", "location": "Hanoi" }'
ResponseJSON
{ "success": true, "data": { "updated": ["description", "location"] }, "meta": { "latency_ms": 640 } }
POST
/v2/dm/sendSend a 1:1 direct message from the connected account| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| username | string | optional | — | Recipient username or id:<digits>. Send this or user_id |
| user_id | string | optional | — | Recipient numeric user id. Send this or username |
| text | string | required | — | Message text, up to 10,000 characters |
BASH
curl -X POST https://xcrop.io/api/v2/dm/send \ -H "Authorization: Bearer $XCROP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "username": "VitalikButerin", "text": "Hello from XCROP" }'
ResponseJSON
{ "success": true, "data": { "recipient_id": "295218901", "username": "VitalikButerin", "message_id": "1893051122334455667", "conversation_id": "295218901-1450000000000000001" }, "meta": { "latency_ms": 702 } }
⚠
403 DM_NOT_ALLOWED: the recipient's DM settings refuse this account (for example DMs closed to accounts they do not follow). It is not a session problem, so reconnecting does not help
POST
/v2/media/uploadUpload an image, GIF or short video, then attach it to a tweet| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| base64 | string | required | — | The file as base64. A data:...;base64, prefix is accepted and stripped. Max 5 MB decoded |
| mime_type | string | optional | image/jpeg | One of image/jpeg, image/png, image/webp, image/gif, video/mp4 |
ResponseJSON
{ "success": true, "data": { "media_id": "1893052000111222333" }, "meta": { "latency_ms": 1180 } }
Attach it to a tweetBASH
curl -X POST https://xcrop.io/api/v2/tweets/create \ -H "Authorization: Bearer $XCROP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "text": "New chart", "media_ids": ["1893052000111222333"] }'
Errors on these routes: 400 BAD_REQUEST, BAD_JSON, BAD_TWEET_ID or BAD_USERNAME (not billed), 401 SESSION_EXPIRED, 403 NO_X_ACCOUNT, PERMISSION_DENIED, PLAN_UPGRADE_REQUIRED or DM_NOT_ALLOWED, and 400 X_REFUSED when X refuses the write itself (for example blocking a suspended account), 404 NOT_FOUND when the post or user does not exist, 404 USER_SUSPENDED when the account is suspended on X