Skip to content

Values and methods for API Handlers

API handlers are passed a context object that lets your integration interact with the Netlify API and the Integration API. The context object extends the Netlify Serverless Functions context with additional methods and properties specific to integrations.

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 Integration API
  • read and modify integration state relating to the current site or team

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

context.providerOAuthToken

providerOAuthToken - undefined | string

If your integration allows users to authenticate with an OAuth identity provider, the providerOAuthToken value is available after the user configures your integration and authenticates through the OAuth card element in your integration 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 integration. If the integration is used on a team level, siteId will be undefined. You need this ID to interact with the Netlify API or the Integration API for things that are site-scoped.

context.teamId

teamId - string

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