Added pin_name argument to api_pin() function