I want to add a custom field use for activities (meeting)?
I did that using administrator -> customize data and screen -> custom fields
How can I achieve it by API 3.
Following API call should do it.
$result = civicrm_api3('CustomField', 'create', [
'custom_group_id' => "GROUP_NAME",
'label' => "CUSTOM_FIELD_LABEL",
Replace label and group name accordingly.
You can use the API CustomGroup create to create a custom group and the CustomField API to create a custom field. I'd recommend playing with the API explorer to get exactly what you need.