Smart Map - Sorting for closest location in PHP
You're very close!
$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;myFieldHandle = array(
    'target' =&gt; 90210,
    'range' =&gt; 100
);
$criteria-&gt;order = 'distance';

$results = $criteria-&gt;find();

I've never actually tested it with the Element API plugin, but in theory it should work just fine.
In response to this question, I've added instructions for PHP to the docs.