Skip to content

createNetlifyClient

createNetlifyClient(opts): object

Defined in: index.ts:20

Creates a Netlify client with sites, deploys, env and user groups sharing one REST client.

NetlifyClientOptions

object

deploys: object

get: (deployId) => Promise<NetlifyDeploy>

string

Promise<NetlifyDeploy>

create(siteId, input?): Promise<NetlifyDeploy>

The digest-based deploy flow: send a manifest of file/function hashes, then upload only the content Netlify doesn’t already have cached (required/required_functions in the response — in practice, for a fresh deploy that’s everything). This is the only flow that deploys real, invokable functions — the single-request whole-zip method (POST .../deploys with Content-Type: application/zip) only deploys static assets; a function file placed in that zip is served as an inert static file, never wired up as a Lambda (confirmed live).

string

NetlifyCreateDeployInput = {}

Promise<NetlifyDeploy>

env: object

list: (accountId, siteId) => Promise<NetlifyEnvVar[]>

string

string

Promise<NetlifyEnvVar[]>

set(accountId, siteId, key, context, value): Promise<void>

Upsert one value for one context on one key. Netlify’s env API has no single “upsert a value” endpoint — PUT /env/{key} replaces the entire values array, and there’s no documented “get one key” endpoint either (only list + PUT/DELETE by key) — so a genuine upsert needs the key’s current full value list first.

string

string

string

NetlifyEnvContext

string

Promise<void>

sites: object

create: (accountSlug, input) => Promise<NetlifySite>

Scoped to /{account_slug}/sites — Netlify has no account-id-based create path.

string

NetlifyCreateSiteInput

Promise<NetlifySite>

get: (siteId) => Promise<NetlifySite>

string

Promise<NetlifySite>

list: () => Promise<NetlifySite[]>

Promise<NetlifySite[]>

triggerBuild: (siteId) => Promise<{ deploy_id?: string; }>

Triggers a new build from the latest commit on a git-linked site’s default branch.

string

Promise<{ deploy_id?: string; }>

update: (siteId, input) => Promise<NetlifySite>

string

NetlifyUpdateSiteInput

Promise<NetlifySite>

user: object

get: () => Promise<NetlifyUser>

Promise<NetlifyUser>