Appwrite Functions can be executed in several ways. Executions can be invoked through the Appwrite SDK and visiting its REST endpoint. Functions can also be triggered by events and scheduled executions. Here are all the different ways to consume your Appwrite Functions.
Domains
In the Appwrite Console's sidebar, click Functions.
Under the Domains tab, you'll find the generated domain from Appwrite and your custom domains.
https://64d4d22db370ae41a32e.appwrite.global
Learn about adding a custom domain.
REST API
When requests are made to this domain, whether through a browser or through an HTTP requests, the request information like request URL, request headers, and request body will be passed to the function. This unlocks ability for Appwrite Function to become a full-blown API server on its own. It also allows accepting incoming webhooks for handling online payments, hosting social platform bots, and much more.
curl -X POST https://64d4d22db370ae41a32e.appwrite.global \
-H "X-Custom-Header: 123" \
-H "Content-Type: application/json" \
-d '{"data":"this is json data"}'
SDK
You can invoke your Appwrite Functions directly from the Appwrite SDKs.
Learn more about using the Appwrite SDKs
import { Client, Functions } from 'appwrite';
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');
const functions = new Functions(client)
try {
const execution = await functions.createExecution(
'[FUNCTION_ID]',
JSON.stringify({ 'foo': 'bar' }),
false,
'/',
'GET',
{ 'X-Custom-Header': '123' }
)
console.log(execution)
} catch (err) {
console.error(err.message)
}
import { Client, Functions } from 'node-appwrite';
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>')
.setKey('[API_KEY]');
const functions = new Functions(client);
try {
const execution = await functions.createExecution(
'[FUNCTION_ID]',
JSON.stringify({ 'foo': 'bar' }),
false,
'/',
'GET',
{ 'X-Custom-Header': '123' }
)
console.log(execution)
} catch (error) {
console.error(error.message)
}
Console
Another easy way to test a function is directly in the Appwrite Console. You test a function by hitting the Execute now button, which will display with modal below.
You'll be able to mock executions by configuring the path, method, headers, and body.


Events
Changes in Appwrite emit events. You can configure Functions to be executed in response to these events.
In Appwrite Console, navigate to Functions.
Click to open a function you wish to configure.
Under the Settings tab, navigate to Events.
Add one or multiple events as triggers for the function.
Be careful to avoid selecting events that can be caused by the function itself. This can cause the function to trigger its own execution, resulting in infinite recursions.
Schedule
Appwrite supports scheduled function executions. You can schedule executions using cron expressions in the settings of your function. Cron supports recurring executions as frequently as every minute.
Here are some cron expressions for common intervals:
Cron Expression | Schedule |
*/15 * * * * | Every 15 minutes |
0 * * * * | Every Hour |
0 0 * * * | Every day at 00:00 |
0 0 * * 1 | Every Monday at 00:00 |
Permissions
Appwrite Functions can be executed using Client or Server SDKs. Client SDKs must be authenticated with an account that has been granted execution permissions on the function's settings page. Server SDKs require an API key with the correct scopes.
If your function has a generated or custom domain, executions are not authenticated. Anyone visiting the configured domains will be considered a guest, so make sure to give Any execute permission in order for domain executions to work. If you need to enforce permissions for functions with a domain, use authentication methods like JWT.
Logs and results
You can view the logs of your function executions in the Appwrite Console. Navigate to Functions and click on a function to view its executions.
For security reasons, Appwrite does not store the response of function executions. If you need to debug, we recommend logging the response in your function code.