Hi,
To connect an API in kafka, you can use kafka confluent platform for this job. Go through the below given link to install confluent in your system.
https://www.edureka.co/community/65955/how-to-installed-confluent-kafka-in-our-system?show=65955#q65955
Hope this helps!
To know more about Kafka, I would recommend you to enroll with Kafka training online today.
Thanks.