Things Every Developer Should Know

Tweet IDs are enormous and break Javascript

Use the id_str field instead of id whenever present to stay safe. Your web browser/Javascript interpreter/JSON consumer may munge our large integer-based ids which is why it’s recommended to use the string representation. See Twitter IDs, JSON and Snowflake.

There are several APIs

The public Twitter API consists of a REST API and a Streaming API. Most application developers mix and match the APIs to produce their application. The Streaming API provides low-latency high-volume access to Tweets. Additionally, there are some families of APIs (such as the Ads API) which require your application to be whitelisted in order to make use of them.

There are limits to how many calls and changes you can make in a day

API usage is rate limited with additional account-based fair use limits on write/create/delete endpoints, to protect Twitter from abuse.

The API is HTTP-based (over SSL)

Methods to retrieve data from the Twitter API require a GET request. Methods that submit, change, or destroy data require a POST. A DELETE request is also accepted for methods that destroy data. API methods that require a particular HTTP method will return an error if you do not make your request with the correct one. HTTP Response Codes are meaningful.

The API aims to be a RESTful resource

With the exception of the Streaming API, the Twitter API attempts to conform to the design principles of Representational State Transfer (REST). Twitter APIs use the JSON data format for responses.

Parameters have certain expectations

Some API methods take optional or requisite parameters. Keep in mind when making requests with parameters:

  • Parameter values should be converted to UTF-8 and URL encoded.
  • The page parameter begins at 1, not 0.

Where noted, some API methods will return different results based on HTTP headers sent by the client. Where the same behavior can be controlled by both a parameter and an HTTP header, the parameter will take precedence.

There are pagination limits


Clients may access a theoretical maximum of 3,200 statuses via the page and count parameters for the user_timeline REST API methods. Other timeline methods have a theoretical maximum of 800 statuses. Requests for more than the limit will result in a reply with a status code of 200 and an empty result in the format requested. Twitter still maintains a database of all the Tweets sent by a user. However, to ensure performance, this limit is in place on the API calls.

There are Twitter API libraries for almost any language

The community has created numerous Twitter API libraries. If you know of others we haven’t listed, let us know via the developer forums.