This page provides a full reference of the Netlify Functions API.
Context object exposes the following properties:
account: an object containing Netlify team account information with the following property:
id: unique ID of the team that the site and function belong to.
cookies: a simplified interface for reading and storing cookies:
cookies.get(name): reads a cookie with a given name from the incoming request.
cookies.set(options): sets a cookie on the outgoing response, using the same format as the
optionsvalue in the
cookies.delete(options): adds an instruction to the outgoing response for the client to delete a cookie. Following the
CookieStore.deleteweb standard, accepts a string representing the name of the cookie, or an options object.
deploy: an object containing Netlify deploy information with the following property:
id: unique ID of the deploy that the function belongs to.
geo: an object containing geolocation data for the client with the following properties:
city: name of the city.
code: ISO 3166 code for the country.
name: name of the country.
latitude: latitude of the location.
longitude: longitude of the location.
code: ISO 3166 code for the country subdivision.
name: name of the country subdivision.
timezone: timezone of the location.
ip: a string containing the client IP address.
requestId: a string containing the Netlify request ID; for example,
server: an object containing server metadata with the following property:
region: the region code where the deployment is running; for example,
site: an object containing Netlify site metadata with the following properties:
id: unique ID for the site; for example,
name: name of the site, its Netlify subdomain; for example,
url: URL representing the main address to your site. It can be either a Netlify subdomain or your own custom domain if you set one; for example,
Netlify global object
Netlify global object exposes the following properties:
env: an object providing access to environment variables with the following properties:
delete(name): in the context of the invocation, deletes an environment variable with a given name.
get(name): returns the string value of an environment variable with a given name; if the environment variable is not defined,
has(name): returns a boolean value containing
trueif an environment variable with a given name exists, and
set(name, value): in the context of the invocation, sets an environment variable with a given name and value.
toObject(): returns a plain object containing all the environment variables and their values.
Did you find this doc useful?
Your feedback helps us improve our docs.