Passing credentials as query parameter

Hi everybody!

I am creating a node which makes a GET petition to an API and one of the requisites is to pass the credentials as a query parameter. I have no clue about how to do it. Before I was able to pass those credentials to the header succesfuly for another kind of petition, but I need help to pass it as ‘query parameters’

Thank you very much, I hope I have explained myself good enough.

You can supply it as qs on the option-object you supply the request function. n8n uses the request library under the hood. You can find the documentation here:

That worked perfectly, thank you very much @jan
But now I have another issue. What if I wanaa pass only the ‘value’ of the cedentials?
‘credentials’ : ‘value’
Can be done?

Thank you very much again

Sorry, I do not understand what you want to do. Can you please elaborate. Thanks!

in this case the credentials are stored as key value as the following example =
‘apikey’ : ‘xxxxxxxxxxxxxxxxxxxxxxxxxx’.
But I need to pass only the value ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’ as a query string without the key, otherwise I get an error in the query.
The problem is that I don’t know how to extract just the value from a credential.


Hey @adricampi!

Here’s the code for your reference:

const options: OptionsWithUri = {
				headers: {
				method: 'HTTP_METHOD',
				body: {
				uri: `${credentials.apiKey}`,

I’ve modified the code from the docs that I shared earlier.

You can always refer to the code from other nodes and learn how the auth is handled for them :wink:

I got it already,
credentials.apikey extracts the pasword of the credentials given to the node.
where credentials is this.getCredentials(‘argument’) as IDataObject;

1 Like