You can get the whole ABI via Etherscan API and then via for loop filter out only the event related part.
Here is a snippet from a Python code on how to do it:
# contract ABI extraction via Etherscan API
events = []
etherscan_url = f'https://api-goerli.etherscan.io/api?module=contract&action=getabi&address={contract_address}&apikey={etherscan_api}'
etherscan_response = requests.get(etherscan_url)
etherscan_content = etherscan_response.json()
contract_abi = etherscan_content.get("result")
contract_abi_dict = json.loads(contract_abi)
print(f"ABI: {contract_abi}")
# Event name extraction
for i, j in enumerate(contract_abi_dict):
if contract_abi_dict[i]['type'] == "event":
events.append(contract_abi_dict[i]['name'])
print(contract_abi_dict[i]['name'])
keccak
the stringtransferFrom(address,address,uint256)
and you will get the "abi code" which is just a hash. this is how it is done by Geth: github.com/ethereum/go-ethereum/blob/…