How can I save an API response as a credential?

Hi @clarence_bernacer, welcome to the community!

Not sure if there is a generic approach using which this can work tbh. This might be one for our resident node building specialist @marcus.

Or are your credentials OAuth2 credentials by any chance? In this case you could simply extend n8n’s existing logic on storing the tokens and refresh them as needed, similar to what other nodes using OAuth2 are doing (Raindrop for example).