Access Netlify API from build plugin

I want to write a build plugin that accesses the Netlify API during onInit. At the moment I am relying on the user providing a NETLIFY_AUTH_TOKEN environment variable to get API access.

Then I read Do not expose API token · Issue #86 · netlify/js-client · GitHub

For example, Build plugins perform logic on behalf of the user. They receive an instance of the API client with the user’s access token.

Is this true? Do I already have some way to get an API client in my plugin? I didn’t see it documented anywhere.

Never mind, I found Hide API client feature · Issue #585 · netlify/build · GitHub and understand that this feature is on hold.

1 Like

Hi @william,

Yes it is! This issue is tracking our progress: How to name Netlify API client instances? · Issue #557 · netlify/build · GitHub
Stay tuned!

Has anything changed in the last year on this topic?

Hey there, @william . Thanks for checking in! The original issue linked above my @ehmicky has been closed and two new issues have been opened that touch on this. There is currently no resolution, unfortunately.