REST API New Direct Message limit not working as it is expected



Hi ,
I am using Twitter REST API and I’m trying comply strictly to the documentation.
I want to know what is the exact limit of characters in Direct Messages/New endpoint and I’ve found that another endpoint which is: should tell me the truth.
However the configuration endpoint says that new direct message can be up to 10’000 characters long which is wrong.
What I’ve encountered is that it accepts only 6867 characters. Is this feature still under development or what am I doing wrong? Please update the information returned by configuration endpoint to 6876 or just make a note that this is still under development.


The limit on characters is 10,000 and the configuration endpoint is correct.

What method are you using to post? There’s probably a limit on an HTTP request body, so depending on whether you’re sending the text as HTTP POST data or as URL parameters, I can imagine you may find there’s a limitation on what gets accepted.


I am sending a text message as the url parameter because I’ve found it in a documentation as the suggested way.


Well - the API does support 10k characters, I tested it myself when we made the change last year :slight_smile: so one suggestion would be to use HTTP POST data. Using curl or twurl, you can do this using the -d option, for instance. If you continue to hit this issue, please share a reproducible example.


If you say it supports 10k chars it surely is. As a reproducible example just use a string containing 10k “a” letters and see what is the result. In my opinion it just doesn’t support passing the 10k chars long text with url parameter and this is not mentioned in docs.


Thanks, I’ll see if I can verify, and look at improving the docs. Apologies if this caused you any confusion.


I’ll switch to the http post data as you suggested. The only problem I had by now was to convince the guys from requirements topics that I will have to use the API in a way which is not let’s say ‘officially’ supported :slight_smile:


I’m confused about the “officially supported” statement - this is absolutely supported and the expected way you’d call the endpoint if you wanted to send 10,000 characters.


Should the parameters ‘user_id’ and ‘text’ be sent as a post body with x-www-form-urlencoded content-type?




Thank you.
I’ve managed to post what I wanted using a post body, but now I’am struggling with something different.
I am trying to post a text containing * and surprisingly I am getting an error:
"code": 32, "message": "Could not authenticate you."

My question is now regarding authentication:

  1. During the calculation of oauth signature should I take into account also a body parameters?
  2. If yes - should I encode an asterisk into %2A?
  3. Should I encode a body entity so that it sends a %2A to Twitter? Or send it with * not a %2A?

I tried to use a Postman client to send a message containing * and open brackets ( ) and I am also getting this error.
Other characters like #@ and óę do not cause any problems.


Since you seem to have started a new thread to discuss this different issue, I’ll close this one out.