Create function
Endpoint
posthttps://<REGION>.cloud.appwrite.io/v1/functions
Description
Create a new function. You can pass a list of permissions to allow different project users or team with access to execute the function using the client API.
Required scopes
Authentication
setProject() and a server API key (setKey()). For direct REST calls, send X-Appwrite-Project and X-Appwrite-Key.Parameters
Function ID. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
Function name. Max length: 128 chars.
Execution runtime.
An array of role strings with execution permissions. By default no user is granted with any execute permissions. learn more about roles. Maximum of 100 roles are allowed, each 64 characters long.
Events list. Maximum of 100 events are allowed.
Schedule CRON syntax.
Function maximum execution time in seconds.
Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
When disabled, executions will exclude logs and errors, and will be slightly faster.
Entrypoint File. This path is relative to the "providerRootDirectory".
Build Commands.
List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.
Appwrite Installation ID for VCS (Version Control System) deployment.
Repository ID of the repo linked to the function.
Production branch for the repo linked to the function.
Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
Path to function code in the linked repo.
List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches.
List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes.
Build specification for the function deployments.
Runtime specification for the function executions.
Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.
Function
Function ID.
Function creation date in ISO 8601 format.
Function update date in ISO 8601 format.
Execution permissions.
Function name.
Function enabled.
Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration.
When disabled, executions will exclude logs and errors, and will be slightly faster.
Function execution and build runtime.
How many days to keep the non-active deployments before they will be automatically deleted.
Function's active deployment ID.
Active deployment creation date in ISO 8601 format.
Function's latest deployment ID.
Latest deployment creation date in ISO 8601 format.
Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed".
Allowed permission scopes.
Function variables.
Object type
Function trigger events.
Function execution schedule in CRON format.
Function execution timeout in seconds.
The entrypoint file used to execute the deployment.
The build command used to build the deployment.
Version of Open Runtimes used for the function.
Function VCS (Version Control System) installation id.
VCS (Version Control System) Repository ID
VCS (Version Control System) branch name
Path to function in VCS (Version Control System) repository
Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests
List of branch name patterns that trigger automatic deployments. Supports glob wildcards. Empty list deploys on all branches.
List of file path patterns that trigger automatic deployments. Supports glob wildcards. Empty list deploys on all file changes.
Machine specification for deployment builds.
Machine specification for executions.
const sdk = require('node-appwrite');
const client = new sdk.Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key
const functions = new sdk.Functions(client);
const result = await functions.create({ functionId: '<FUNCTION_ID>', name: '<NAME>', runtime: sdk.Runtime.Node145, execute: ["any"], // optional events: [], // optional schedule: '', // optional timeout: 1, // optional enabled: false, // optional logging: false, // optional entrypoint: '<ENTRYPOINT>', // optional commands: '<COMMANDS>', // optional scopes: [sdk.ProjectKeyScopes.ProjectRead], // optional installationId: '<INSTALLATION_ID>', // optional providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional providerBranch: '<PROVIDER_BRANCH>', // optional providerSilentMode: false, // optional providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional providerBranches: [], // optional providerPaths: [], // optional buildSpecification: '', // optional runtimeSpecification: '', // optional deploymentRetention: 0 // optional});Functions
functions
runtimes
deployments
executions
variables
Create function
Endpoint
posthttps://<REGION>.cloud.appwrite.io/v1/functions
Description
Create a new function. You can pass a list of permissions to allow different project users or team with access to execute the function using the client API.
Required scopes
Authentication
setProject() and a server API key (setKey()). For direct REST calls, send X-Appwrite-Project and X-Appwrite-Key.Parameters
Function ID. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
Function name. Max length: 128 chars.
Execution runtime.
An array of role strings with execution permissions. By default no user is granted with any execute permissions. learn more about roles. Maximum of 100 roles are allowed, each 64 characters long.
Events list. Maximum of 100 events are allowed.
Schedule CRON syntax.
Function maximum execution time in seconds.
Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
When disabled, executions will exclude logs and errors, and will be slightly faster.
Entrypoint File. This path is relative to the "providerRootDirectory".
Build Commands.
List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.
Appwrite Installation ID for VCS (Version Control System) deployment.
Repository ID of the repo linked to the function.
Production branch for the repo linked to the function.
Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
Path to function code in the linked repo.
List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches.
List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes.
Build specification for the function deployments.
Runtime specification for the function executions.
Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept.
Function
Function ID.
Function creation date in ISO 8601 format.
Function update date in ISO 8601 format.
Execution permissions.
Function name.
Function enabled.
Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration.
When disabled, executions will exclude logs and errors, and will be slightly faster.
Function execution and build runtime.
How many days to keep the non-active deployments before they will be automatically deleted.
Function's active deployment ID.
Active deployment creation date in ISO 8601 format.
Function's latest deployment ID.
Latest deployment creation date in ISO 8601 format.
Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed".
Allowed permission scopes.
Function variables.
Object type
Function trigger events.
Function execution schedule in CRON format.
Function execution timeout in seconds.
The entrypoint file used to execute the deployment.
The build command used to build the deployment.
Version of Open Runtimes used for the function.
Function VCS (Version Control System) installation id.
VCS (Version Control System) Repository ID
VCS (Version Control System) branch name
Path to function in VCS (Version Control System) repository
Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests
List of branch name patterns that trigger automatic deployments. Supports glob wildcards. Empty list deploys on all branches.
List of file path patterns that trigger automatic deployments. Supports glob wildcards. Empty list deploys on all file changes.
Machine specification for deployment builds.
Machine specification for executions.
const sdk = require('node-appwrite');
const client = new sdk.Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secret API key
const functions = new sdk.Functions(client);
const result = await functions.create({ functionId: '<FUNCTION_ID>', name: '<NAME>', runtime: sdk.Runtime.Node145, execute: ["any"], // optional events: [], // optional schedule: '', // optional timeout: 1, // optional enabled: false, // optional logging: false, // optional entrypoint: '<ENTRYPOINT>', // optional commands: '<COMMANDS>', // optional scopes: [sdk.ProjectKeyScopes.ProjectRead], // optional installationId: '<INSTALLATION_ID>', // optional providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional providerBranch: '<PROVIDER_BRANCH>', // optional providerSilentMode: false, // optional providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional providerBranches: [], // optional providerPaths: [], // optional buildSpecification: '', // optional runtimeSpecification: '', // optional deploymentRetention: 0 // optional});