Direct Messages

GET /api/direct_messages.json

Returns the 20 most recent direct messages sent to the authenticating user. You can request up to 200 direct messages per call, and only the most recent 200 DMs will be available using this endpoint.

Query Parameters:
 
  • since_id (int) – returns direct messages with an ID greater than (that is, more recent than) the specified ID
  • max_id (int) – returns direct messages with an ID less than (that is, older than) or equal to the specified ID
  • count (int) – number of direct messages to try and retrieve

Example response: Direct message object

GET /api/direct_messages/sent.json

Returns the 20 most recent direct messages sent by the authenticating user. You can request up to 200 direct messages per call, and only the most recent 200 DMs will be available using this endpoint.

Query Parameters:
 
  • since_id (int) – returns direct messages with an ID greater than (that is, more recent than) the specified ID
  • max_id (int) – returns direct messages with an ID less than (that is, older than) or equal to the specified ID
  • count (int) – number of direct messages to try and retrieve

Example response: Direct message object

POST /api/direct_messages/new.json

Sends a new direct message to the specified user from the authenticating user.

Form Parameters:
 
  • text – text of your message
  • user_id – the ID of the recipient
  • screen_name – the handle of the recipient
Request Headers:
 
  • Authorization – username and password or OAuth token to authenticate

Example response: Direct message object