Netlify’s domain centers on Accounts, Sites, and Deploys. Accounts own Sites and DNS zones; Sites contain Builds, Deploys, Functions, Assets, Forms/submissions, Snippets, Split Tests, Dev Servers, and Service (addon) instances. Many operations require one of the canonical IDs — account_id or account_slug, site_id, deploy_id, build_id, or zone_id — and knowing where each ID appears is the fastest way to reach the right resource.
Key entities and how they relate
- Accounts: represent teams/owners. Responses include both
account_idandaccount_slugin different places. Memberships, billing/payment methods, and account-scoped environment variables live at account level. - Sites: belong to an Account. Most site-scoped operations (deploys, builds, assets, functions, forms, snippets, split tests, dev servers) require
site_id. - Deploys and Builds: Deploys are atomic site snapshots; Builds are Netlify build jobs that produce deploys. A deploy is addressed by
deploy_id; a build bybuild_id. - DNS Zones and Records: DNS zones are tracked separately (
zone_id) and can be associated to sites via site DNS configuration operations. DNS records are nested under a zone and usedns_record_id. - Environment variables: keyed by
keyand scoped to anaccount_idand optionally asite_id. Keys are case-sensitive and site-level operations are distinct from account-level ones (no automatic merging when you specifysite_id). - Assets, Files, Functions: Uploads target a specific
site_idordeploy_id. Asset and file operations return anasset_idor file path which you will use for subsequent queries. - Hooks, Snippets, Split Tests, Dev Servers: Site-scoped configuration objects managed by their own CRUD endpoints using
site_idand object-specific IDs. - Agent Runners: tied to a
site_idand optionally adeploy_id/branch; they produce sessions identified byagent_runner_session_id.
Understanding which ID each operation expects is the most important pattern: account-level calls use account_id or account_slug (they are not interchangeable), site-level calls use site_id, DNS calls use zone_id, and deploy/build calls use deploy_id / build_id.
Entry points — what to call first
- Get the accounts you can act on with
listAccountsForUserto obtainaccount_idandaccount_slug. Many account-scoped operations referenceaccount_slug(members, listing sites for an account) while some requireaccount_id(env var endpoints, account build status). - To discover sites, use
listSites(global) orlistSitesForAccount(scoped byaccount_slug) to getsite_idfor the site you will manage. - To inspect the current site state, call
getSite(bysite_id). After you have asite_id, other site-scoped resources are reachable:listSiteBuilds,listSiteDeploys,listSiteAssets,listSiteForms,listSiteSnippets,listSiteDevServers. - To manage DNS, list zones with
getDnsZonesor create withcreateDnsZone; usecreateDnsRecord/getDnsRecordswithzone_idonce you have the zone.
If a user’s request targets a member, billing, or team action, start with listAccountsForUser and listMembersForAccount (requires account_slug) to find the member IDs to update or remove.
Core workflows you will perform often
Deploy a site (two main flavors):
- Create a deploy directly with
createSiteDeploy(supplysite_idand optional query flags such asproduction,branch,deploy-previews). The returnedDeploygives youdeploy_id. For file-level uploads, push files usinguploadDeployFile(needsdeploy_idand the filepath) or publish functions withuploadDeployFunction(needsdeploy_idand functionname). - Trigger a build with
createSiteBuild(usesite_id, optionalbranch,clear_cache,image,template_id,title). Builds produceBuildobjects and typically result in deploys when finished. UsegetSiteBuildto inspect a build (build_id).
Common deploy lifecycle actions:
- Lock/unlock a deploy using
lockDeploy/unlockDeploy(passdeploy_id). - Restore or rollback a deploy with
restoreSiteDeployorrollbackSiteDeploy(site-level operations usingsite_idanddeploy_idwhere required). - Cancel or delete a deploy with
cancelSiteDeployordeleteDeploy(usedeploy_id).
Upload and manage functions and assets:
- Use
uploadDeployFunctionfor serverless function binaries (supplydeploy_idandname). Runtime and invocation options are query params. - Manage site assets with
createSiteAsset(site-scoped),listSiteAssets,getSiteAssetInfo,updateSiteAsset, anddeleteSiteAsset.createSiteAssettakes metadata such asname,size,content_type, and optionalvisibility.
Manage environment variables:
- Account-scoped env vars use
createEnvVars,getEnvVars,getEnvVar,updateEnvVar,setEnvVarValue, anddeleteEnvVarwithaccount_id. If you provide asite_idquery param to these endpoints, you operate on site-scoped values — the API does not perform automatic merging whensite_idis used, so specify the scope you intend. - Keys are case-sensitive. When modifying a specific value entry, use
deleteEnvVarValuewith the env valueid.
DNS and TLS:
- If you need to configure DNS for a site,
configureDNSForSite(bysite_id) will provision zone association(s); retrieve zone details withgetDNSForSiteorgetDnsZones. - Create records with
createDnsRecordusingzone_id. Transfer a zone withtransferDnsZone(requireszone_idplustransfer_account_idortransfer_user_id). - Provision or update TLS with
provisionSiteTLSCertificateand read withshowSiteTLSCertificate(site-scoped).
Hooks, build hooks, dev server hooks, and snippets:
- List site hooks with
listHooksBySiteId(querysite_id), create withcreateHookBySiteId, enable withenableHook, update withupdateHook, or remove withdeleteHook(passhook_id). - Manage build hooks with
listSiteBuildHooks,createSiteBuildHook,getSiteBuildHook,updateSiteBuildHook,deleteSiteBuildHookusingsite_idand hookid. - Dev server hooks and dev servers follow the same per-site pattern (
createSiteDevServer,listSiteDevServers,createSiteDevServerHook, etc.). - Site snippets live under
site_id(create/list/get/update/delete via the snippet endpoints).
Teams, members, and services:
- Add and manage account members with
addMemberToAccount(requiresaccount_slug) andupdateAccountMember/removeAccountMember(usemember_id). - Service/addon instances are created per-site (
createServiceInstance), listed withlistServiceInstancesForSite, inspected withshowServiceInstance, updated withupdateServiceInstance, and deleted withdeleteServiceInstance. Service manifests are discoverable throughshowService/showServiceManifest.
Forms and submissions:
- List site forms with
listSiteForms(bysite_id), list a form’s submissions withlistFormSubmissions(form_id), get individual submissions withlistFormSubmission(bysubmission_id) and remove withdeleteSubmission.
Agent Runners and AI sessions:
- Start agent runners with
createAgentRunner(query requiressite_id, optionaldeploy_id,branch,agent,model,file_keys), create sessions withcreateAgentRunnerSession, then track sessions withlistAgentRunnerSessions/getAgentRunnerSession.
Non-obvious patterns and gotchas
- account_slug vs account_id: different endpoints require one or the other.
listAccountsForUserreturns both; choose the identifier the target endpoint expects (memberships and site listing often useaccount_slug, env var and account-status endpoints useaccount_id). - Env var scoping and case sensitivity: Operations that accept
site_idbehave as site-scoped actions (no merge with account-level vars). Env varkeynames are case-sensitive—use the exact casing when updating or deleting. - createSiteBuild branch logic: if you omit
branchthe build is treated as a production build. If you specify a branch equal to the site’s main branch it is also production; otherwise it is a branch deploy. - Many create/update endpoints in the spec return a type named
Error— that reflects the OpenAPI model rather than runtime failure. Always inspect the returned JSON for the fields you need (IDs, nested objects) rather than assuming a particular wrapper shape. - Upload endpoints use
deploy_id(files/functions) vssite_id(assets).uploadDeployFileexpects apathparameter that is the file path inside the deploy;uploadDeployFunctionusesnamefor the function filename. - Hook and build-hook IDs are sometimes labeled generically as
idin the path — be careful to use the hook’s returnedidwhen calling get/update/delete operations. - DNS transfer requires explicit target identifiers:
transfer_account_idand/ortransfer_user_id. A transfer is not implicit and must be authorized by the target account/user. - Agent runner creation takes many options as query params (including
agent,model,file_keys,parent_agent_runner_id). Provide the relevant options rather than relying on defaults when the user has specific needs.
Practical shortcuts for common requests
- To perform a deploy from uploaded files: create a deploy (
createSiteDeploy) ➜ upload files (uploadDeployFile) for each path ➜ check the deploy withgetDeploy. - To trigger CI-style build runs: call
createSiteBuildwith optionalbranchandclear_cache; inspectgetSiteBuilduntil the build completes and yields a deploy. - To add or update a site environment variable for a single site: call
createEnvVarsorsetEnvVarValuewithaccount_idandsite_id(explicit site scope prevents account-level changes). - To add a team member: use
addMemberToAccountwithaccount_slugthen verify membership withlistMembersForAccount.
When a response looks unexpected
If a response uses the Error-typed wrapper or fields are missing where you expected them, inspect the returned JSON for ID fields (site_id, deploy_id, id, asset_id, etc.). Many endpoints return the data you need even if the OpenAPI name for that response type is non-intuitive. Use the actual JSON fields present in the response to drive follow-up calls (for example, extract site_id from a created Site object to call site-scoped endpoints).
Keep these entity relationships and entry points in mind: accounts → sites → builds/deploys/assets/functions/forms; DNS and TLS are separate resources tied to zones; env vars are account-scoped with optional site override. That map covers the majority of user requests you will encounter and lets you pick the right operation and ID to call next.