zabbix 6.x+

zabbix < 6.x

On zabbix version < 6.0, you can use cURL to get api token.

You must replace zabbix urlusernamepassword to yours.

curl --location --request POST 'https://demo.zabbix.com/api_jsonrpc.php' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
        "method": "user.login",
            "params": {
        "user": "username",
            "password": "passwd"
    },
    "id": 1,
        "auth": null
}'

The response will like this, the result is API token.

{"jsonrpc":"2.0","result":"4d4a759710e3532040df7620a1626155","id":1}