How to add custom field using API?
Following API call should do it.

$result = civicrm_api3('CustomField', 'create', [
  'custom_group_id' =&gt; "GROUP_NAME",
  'label' =&gt; "CUSTOM_FIELD_LABEL",
]);

Replace label and group name accordingly.