Docs
Skip to content
post

Create function

Endpoint

posthttps://<REGION>.cloud.appwrite.io/v1/functions

Description

Required scopes

functions.write

Authentication

Initialize the Appwrite client with setProject() and a server API key (setKey()). For direct REST calls, send X-Appwrite-Project and X-Appwrite-Key.

Parameters

string
Required
string
Required
enum
Required
array
array
string
integer
boolean
boolean
string
string
enum
string
string
string
boolean
string
array
array
string
string
integer
Status
Content type
201
application/json

Function

Name
Type
Description
string
string
string
arrayof string
string
boolean
boolean
boolean
string
integer
string
string
string
string
string
arrayof string
arrayof Variable

Object type

arrayof string
string
integer
string
string
string
string
string
string
string
boolean
arrayof string
arrayof string
string
string
Dart
import 'package:dart_appwrite/dart_appwrite.dart';
import 'package:dart_appwrite/enums.dart' as enums;
Client client = 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
Functions functions = Functions(client);
Func result = await functions.create(
functionId: '<FUNCTION_ID>',
name: '<NAME>',
runtime: enums.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: [enums.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)
);