Genetrated Oauth token and still giving Internal server error on api calls

curl --location --request POST 'https://api.infusionsoft.com/crm/rest/v2/contacts?fields=email_addresses' \
--header 'Authorization: Bearer ***' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Cookie: __cf_bm=vdQaf3PBIUqKMNIwzV_FUxAhHvejBE51EO2DhDMjTHM-1649403943-0-AT0kfId5uGmujtDlv2BiBK3ZU4CjC/obXBe/rveA7Zzu4hn/yOP8YsSg/RQ4YYNh4FrmS5Ixehp6Z2orKQvc7JI=; GCLB=CPC0gc7igNDqFg; JSESSIONID=7C6BF44C65371D39C6BA86B0E0AA7ED4' \
--data-urlencode '{
   "email_addresses":[
      {
         "email":"test@example.com",
         "field":"EMAIL1",
         "opt_in_reason":"Opt-in reason"
      }
   ]
}='

If that is your request verbatim, you have an extraneous “=” at the end of your JSON payload.

@TomScott got your point.
Also I am trying to integrate keap in my application. Could you help me please provide any sample cURL for reftesh_token request

The OAuth2 Authorization Code Grant and the OAuth2 Refresh Token Grant are a sequence of calls that need to be made to allow end-users to authorize access to their Keap data, and then to maintain that authorization with a rotating token which expires after 45 days (refresh token) and 24 hours (access token). You can find full details on the calls below:

https://developer.keap.com/getting-started-oauth-keys/