Skip to content
A Javascript wrapper for the TwitPic API to make it easy to interact with all read-only API methods. Supports NodeJS.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


The TwitPic object provides read-only access in the browser, and full access (including photo uploads) in NodeJS, to the TwitPic API.

This library is no longer dependent on jQuery, and is now written in Coffeescript.


The NodeJS version has support for write-enabled API methods using OAuth Echo (requires node-oauth library).

Install with npm

npm install twitpic

Example Usage

In-Browser Usage

Simply include lib/twitpic.min.js (or the full version) in a script tag on your webpage to load the TwitPic API library.

There are two separate ways you can query the API:

Object Instantiation

var tp = new TwitPic();{id: '3'}, function (image) {
  document.getElementById('image').innerHTML = this.thumb(image, 'mini');

Factory Method

TwitPic.query('media/show', {id: '3'}, function (image) {
  document.getElementById('image').innerHTML = this.thumb(image, 'mini');

NodeJS Usage

Object Instantiation

var TwitPic = require('twitpic').TwitPic;

var tp = new TwitPic();{username: 'meltingice'}, function (user) {

Factory Method

var TwitPic = require('twitpic').TwitPic;

TwitPic.query('users/show', {username: 'meltingice'}, function (user) {

Write-Enabled API Query

Note that this assumes you already have all of the required credentials before making this call.

var TwitPic = require('twitpic').TwitPic;

// Must create a TwitPic object for write-enabled methods
var tp = new TwitPic();

// Configure the TwitPic object with our credentials
tp.config(function (config) {
  config.apiKey = "your TwitPic API key";
  config.consumerKey = "Your apps consumer key";
  config.consumerSecret = "Your apps consumer secret";
  config.oauthToken = "The users oauth token";
  config.oauthSecret = "The users oauth secret";

// Post a comment on
tp.comments.create({media_id: "abc123", message: "BOOM!"}, function (data) {

// Upload a photo and post a tweet
tp.uploadAndPost({path: "./test.jpg", message: "Uploading from Node :)"}, function (data) {

Supported API Endpoints

See the official TwitPic API docs for more information. Otherwise, here's a quick list of all the available API endpoints:

Read-Only Endpoints

  • media/show
  • users/show
  • comments/show
  • place/show
  • places/show
  • events/show
  • event/show
  • tags/show
  • thumb api

Write-Enabled Endpoints

  • upload
  • uploadAndPost
  • comments/create
  • comments/delete
  • faces/create
  • faces/edit
  • faces/delete
  • event/create
  • event/delete
  • event/add
  • event/remove
  • tags/create
  • tags/delete
Something went wrong with that request. Please try again.