How to create a case activity using the API?
The param you are looking for is case_id which can be used like:

civicrm_api3('Activity', 'create', array(
  'subject' =&gt; 'Hello',
  'case_id' =&gt; 123,
  ...
));