Tens of millions of links are tweeted on Twitter each day. Wrapping these shared links helps Twitter protect users from malicious content while offering useful insights on engagement. All links submitted within Tweets and direct messages, regardless of length, will eventually be wrapped with t.co.
Will t.co-wrapped links always be the same length?
The maximum length of t.co URLs will change over time. Issue a request daily to GET help/configuration and examine the fields
short_url_length_https to determine the current maximum length of wrapped URLs. We do not expect these values to change often.
It is important to note that you won’t necessarily know the length of a t.co URL before posting. Consider the
short_url_length field a maximum possible length for a t.co-wrapped link. When designing a Tweet entry box, it’s best to consider all URLs as equalling the maximum possible
My application or users already use URL shorteners. Will this break URL shortening and can my users opt-out?
URL shorteners will continue working with Twitter as they always have. While users won’t be able to opt-out of using t.co, developer use of Tweet Entities insures that users always see links with more meaningful semantics.
How do I render links so that my users don’t have to see t.co everywhere?
Use Tweet Entities, which are included by default on API responses, to detect the character position of URLs relative to Tweet text, unwrapped URLs, and a suggested shortened display (like that used on Twitter.com). See this example from tmhOAuth for an example of consuming Tweet Entities in PHP.
Will my application break if I do nothing?
No. If you have not implemented entities support, your users may see only t.co links instead of more descriptive indications. Taking advantage of the opt-in features today insures protection against future changes.
Will there be a URL shortening or resolution API?
There is no resolution API at this time. URLs are wrapped automatically at time of Tweet or direct message submission. Resolved URLs are only available in the context of Tweet or direct message content as part of the entities response accompanying the content.
How long are t.co links?
At the time of writing, HTTP-based t.co links are 22 chars long. This will increase with time. Be sure to check the GET help/configuration endpoint to get the current max t.co link length.
How are HTTPS links handled with t.co?
When a HTTPS-based URL is passed while link wrapping is enabled using POST statuses/update or POST direct_messages/new, a HTTPS-based t.co link will be produced. HTTPS-based t.co links are one character longer than standard t.co links to account for the protocol change. GET
help/configuration will indicate the current length of both HTTPS and non-HTTPS t.co URLs.
Why did help/configuration begin returning 23 character lengths but t.co still wraps at 22?
The lengths reported by GET help / configuration are the current maximums. It’s possible you can get a t.co link that has fewer characters than the maximum.