I have an error with this cURL command:

curl https://myInstance.my.salesforce.com/services/data/v44.0/ -H "Authorization: Bearer 00D1l0000008e75!AQMAQJiLSTqCI5o..O5u3MJ9cDVg8hJJdIUe63mXGN.X..." -H "X-PrettyPrint:1"

It seems to be the "!" character in the Access_Token key who generates this error.

-bash: !AQMAQJiLSTqCI5o..O5u3MJ9cDVg8hJJdIUe63mXGN.X...": event not found

How can I fix it?

2 Answers 2


You need to wrap your authentication header in single quotes, rather than double quotes, to stop Bash from attempting to interpret its content:

curl https://myInstance.my.salesforce.com/services/data/v44.0/ -H 'Authorization: Bearer 00D1l0000008e75!AQMAQJiLSTqCI5o..O5u3MJ9cDVg8hJJdIUe63mXGN.X...' -H "X-PrettyPrint:1"

This would also apply if you had, for example, a $ in your parameter.

From TLDP:

Single quotes (' ') operate similarly to double quotes, but do not permit referencing variables, since the special meaning of $ is turned off. Within single quotes, every special character except ' gets interpreted literally.

Encapsulating "!" within double quotes gives an error when used from the command line. This is interpreted as a history command. Within a script, though, this problem does not occur, since the Bash history mechanism is disabled then.

  • what bad luck to get a ! or $ in my token Apr 21, 2022 at 2:18

This is a great answer from TLDP. My session token also had an ! mark. Thanks for answering the "!" issue also.

So my Curl is now: % curl https://myinstance.trailblaze.my.salesforce.com/services/apexrest/Cases/5007R00003SS40jQAD -H 'Authorization: Bearer 00D7R00000482qz!ARIAQJpch8k5DO.D0Ny_93qx2RMU.d1ktGveqQTQulqE_iwpCf1f5au1QQ_dIGFDJscT6Q6k96AM.G53HuriQgZ8v9.B0UIV' -H "X-PrettyPrint:1"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .