1
votes

Using the API "https://api.twitter.com/1.1/application/rate_limit_status.json" doesn't retrieve any info about posting direct message API (https://api.twitter.com/1.1/direct_messages/events/new.json) rate limit, even when using this (https://api.twitter.com/1.1/direct_messages/events/new.json) none of the twitter rate limit headers exists (x-rate-limit-limit, x-rate-limit-remaining, x-rate-limit-reset) So how we can retrieve this API rate limit????

1

1 Answers

1
votes

Those headers only apply to read-only endpoints, not for HTTP POST calls. This is not an API rate limit, it is an account limit. Twitter accounts have a maximum number of Direct Messages they can send each day.

The current technical limits for accounts are:

Direct Messages (daily): The limit is 1,000 messages sent per day.

Additionally, there are adaptive limits to enable conversations to occur more easily that do not count to these limits, but are on a per-message basis:

Accounts may send up to 5 messages via the API in reply to a message they have received within 24 hours. Each message received resets this threshold.

So, this is not something that you can get from the API, you have to keep track of these yourself in your code.