PayPal REST API - RATE LIMIT REACHED error

I'm running into a rate limit reached error (429). I'm parsing a TSV file and iterating over each row, performing requests. As an example:

(function () {
  'use strict';

  var
    csv = require('csv'),
    fs = require('fs'),
    paypal = require('paypal-rest-sdk'),
    parser = csv.parse({ columns: true, delimiter: '\t' }, function (error, data) {
      if (error) {
        console.log(error.response);
        throw error;
      }

      data.forEach(function (invoice) {
        paypal.invoice.send(invoice.id, function (error, response) {
          if (error) {
            console.log(error.response);
            throw error;
          }

          console.log('---- Invoice Send Response ----');
          console.log(response);
        });
      });
    });

  require('./configure');

  fs.createReadStream('./temp.tsv').pipe(parser);
}());

Has anyone done anything like this with the PayPal REST API? Any suggestions?

PayPal rest API has got rate limit policy, if a certain number of hits from same IP in certain period(say 100 hits in 1 min), rate limit rule will be triggered, then subsequent calls will be blocked for several mins (cooling period). As you mentioned you parsed a TSV file and iterate over each row, it's very possible that the rule got triggered thus you got the error.