add_action( 'wpcf7_before_send_mail', 'wpcf7_to_api' );
function wpcf7_to_api($contact_form){
}
add_action( 'wpcf7_before_send_mail',
function( $contact_form, &$abort, $submission ) {
// Getting user input through the your-email field
$your_email = $submission->get_posted_data( 'your-email' );
// Getting user input through the your-message field
$your_message = $submission->get_posted_data( 'your-message' );
// Do some productive things here
},
10, 3
);