From http://docs.cartodb.com/cartodb-platform/sql-api.html
$.getJSON('http://'+your_account_name+'.cartodb.com/api/v2/sql/?q='+sql_statement, function(data) { $.each(data.rows, function(key, val) { // do something! }); });