API Key in URL Path

Hi,

Is there a recommended method for storing an API credential that must be provided to the API in the request’s URL path (not in the query string/headers/etc.)

I don’t know if any of the credential types can do this, and prefer not to put the key in the workflow or a variable.

For example, what’s the recommended way to store this key “eff5c860193ff2c6802a3cf667fb4b76” and send a request like:

https://api.example.com/api/eff5c860193ff2c6802a3cf667fb4b76/apiQuery?recordType=data&test=value

Thanks!

Hey @jzrts,

Welcome to the community :raised_hands:

That is a bit unusual, Unless you are making a custom node the best I can think of would be to just inlcude it in the URL in your workflow. You could use something like the variable feature if it is available to you but you are still only storing the key in plain text. Out of interest what is the service that you are connecting to?

Got it, that makes sense, thanks for the info.

It’s a service called IPQualityScore. It provides risk assessments of contacts like email addresses, phone numbers, etc. Phone Number Validation API Documentation | IPQualityScore

1 Like

The HTTP Request node supports the Generic Auth Type “Query Auth” where you can easily set a single query parameter.

To be complete. If you or anybody else ever has to set multiple or a combination of query, header, body, … you can also use “Custom Auth”, which gives you full flexibility.

Ah sorry, I just realized that it is not the query parameter but really the actual path. Implementing something like that should be punishable by death, as it is super strange and messed up.
Anyway, the only way I can think of right now, to do that properly would probably be by using the Variables feature (which is also not great as it does still not get saved encrypted in the database) or setting it as an environment variable on the n8n instance and then referencing that value via $env.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.