Skip to content

Values and methods for endpoints

Endpoints are passed a context object that lets your extension interact with the Netlify API and the Extension API. The context object extends the Netlify Serverless Functions context with additional methods and properties specific to extension.

context.client

One of the arguments passed to the handler function is a client object within the context object. This client provides interfaces that allow you to do the following:

  • interact with the Netlify API or the Extension API
  • read and modify extension state relating to the current site or team

For information about available methods, review the NetlifyExtensionClient API reference.

context.auth

netlifyToken - undefined | string providerToken - undefined | string

If your extension allows users to authenticate with an OAuth identity provider, the providerAuth value is available after the user configures your extension and authenticates through the OAuth card element in your extension UI.

Use this token to authenticate calls to a third-party API and make requests on the user’s behalf.

context.siteId

siteId - undefined | string

The siteId is the unique identifier for the site that is using the extension. If the extension is used on a team level, siteId will be undefined. You need this ID to interact with the Netlify API or the Extension API for things that are site-scoped.

context.teamId

teamId - string

The teamId is the unique identifier for the team that is using the extension. You need this ID to interact with the Netlify API or the Extension API for things that are team-scoped.

Got it!

Your feedback helps us improve our docs.