We're having lots of fun on Discord! Come and join us! 💬
Docs

Functions API


Server integration with  

The Functions service allows you to create custom behaviour that can be triggered by any supported Appwrite system events or by a predefined schedule.

Appwrite Cloud Functions lets you automatically run backend code in response to events triggered by Appwrite or by setting it to be executed in a predefined schedule. Your code is stored in a secure way on your Appwrite instance and is executed in an isolated environment.

You can learn more by following our Cloud Functions tutorial.

Create Function

POST/v1/functions

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.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.write" scope.

HTTP Request

Name Type Description
functionId required string

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.

name required string

Function name. Max length: 128 chars.

execute required array

An array of strings with execution roles. By default no user is granted with any execute permissions. learn more about permissions. Maximum of 100 roles are allowed, each 64 characters long.

runtime required string

Execution runtime.

events optional array

Events list. Maximum of 100 events are allowed.

schedule optional string

Schedule CRON syntax.

timeout optional integer

Function maximum execution time in seconds.

enabled optional boolean

Is function enabled?

HTTP Response

Status Code Content Type Payload
201  Created application/json Function Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.create('[FUNCTION_ID]', '[NAME]', ["any"], 'node-14.5');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.create('[FUNCTION_ID]', '[NAME]', ["any"], 'node-14.5');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->create('[FUNCTION_ID]', '[NAME]', ["any"], 'node-14.5');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.create('[FUNCTION_ID]', '[NAME]', ["any"], 'node-14.5')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.create(function_id: '[FUNCTION_ID]', name: '[NAME]', execute: ["any"], runtime: 'node-14.5')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.create(
        functionId: '[FUNCTION_ID]',
        name: '[NAME]',
        execute: ["any"],
        runtime: 'node-14.5',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.create(
        functionId = "[FUNCTION_ID]",
        name = "[NAME]",
        execute = listOf("any"),
        runtime = "node-14.5",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.create(
        "[FUNCTION_ID]",
        "[NAME]",
        listOf("any"),
        "node-14.5",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let function = try await functions.create(
        functionId: "[FUNCTION_ID]",
        name: "[NAME]",
        execute: ["any"],
        runtime: "node-14.5"
    )
    
    
  • mutation {
        functionsCreate(
            functionId: "[FUNCTION_ID]",
            name: "[NAME]",
            execute: ["any"],
            runtime: "node-14.5"
        ) {
            _id
            _createdAt
            _updatedAt
            execute
            name
            enabled
            runtime
            deployment
            vars {
                _id
                _createdAt
                _updatedAt
                key
                value
                functionId
            }
            events
            schedule
            scheduleNext
            schedulePrevious
            timeout
        }
    }
    
  • POST /v1/functions HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    {
      "functionId": "[FUNCTION_ID]",
      "name": "[NAME]",
      "execute": ["any"],
      "runtime": "node-14.5",
      "events": [],
      "schedule": ,
      "timeout": 1,
      "enabled": false
    }
    

List Functions

GET/v1/functions

Get a list of all the project's functions. You can use the query params to filter your results.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.read" scope.

HTTP Request

Name Type Description
queries optional array

Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout

search optional string

Search term to filter your list results. Max length: 256 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json Functions List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.list();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.list();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->list();
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.list()
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.list()
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.list(
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.list(
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.list(
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let functionList = try await functions.list()
    
    
  • query {
        functionsList {
            total
            functions {
                _id
                _createdAt
                _updatedAt
                execute
                name
                enabled
                runtime
                deployment
                vars {
                    _id
                    _createdAt
                    _updatedAt
                    key
                    value
                    functionId
                }
                events
                schedule
                scheduleNext
                schedulePrevious
                timeout
            }
        }
    }
    
  • GET /v1/functions HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

List runtimes

GET/v1/functions/runtimes

Get a list of all runtimes that are currently active on your instance.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.read" scope.

HTTP Response

Status Code Content Type Payload
200  OK application/json Runtimes List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.listRuntimes();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.listRuntimes();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->listRuntimes();
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.list_runtimes()
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.list_runtimes()
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.listRuntimes();
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.listRuntimes()
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.listRuntimes(new CoroutineCallback<>((result, error) -> {
        if (error != null) {
            error.printStackTrace();
            return;
        }
    
        System.out.println(result);
    }));
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let runtimeList = try await functions.listRuntimes()
    
    
  • query {
        functionsListRuntimes {
            total
            runtimes {
                _id
                name
                version
                base
                image
                logo
                supports
            }
        }
    }
    
  • GET /v1/functions/runtimes HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Get Function

GET/v1/functions/{functionId}

Get a function by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.read" scope.

HTTP Request

Name Type Description
functionId required string

Function ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json Function Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.get('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.get('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->get('[FUNCTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.get('[FUNCTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.get(function_id: '[FUNCTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.get(
        functionId: '[FUNCTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.get(
        functionId = "[FUNCTION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.get(
        "[FUNCTION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let function = try await functions.get(
        functionId: "[FUNCTION_ID]"
    )
    
    
  • query {
        functionsGet(
            functionId: "[FUNCTION_ID]"
        ) {
            _id
            _createdAt
            _updatedAt
            execute
            name
            enabled
            runtime
            deployment
            vars {
                _id
                _createdAt
                _updatedAt
                key
                value
                functionId
            }
            events
            schedule
            scheduleNext
            schedulePrevious
            timeout
        }
    }
    
  • GET /v1/functions/{functionId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Update Function

PUT/v1/functions/{functionId}

Update function by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.write" scope.

HTTP Request

Name Type Description
functionId required string

Function ID.

name required string

Function name. Max length: 128 chars.

execute required array

An array of strings with execution roles. By default no user is granted with any execute permissions. learn more about permissions. Maximum of 100 roles are allowed, each 64 characters long.

events optional array

Events list. Maximum of 100 events are allowed.

schedule optional string

Schedule CRON syntax.

timeout optional integer

Maximum execution time in seconds.

enabled optional boolean

Is function enabled?

HTTP Response

Status Code Content Type Payload
200  OK application/json Function Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.update('[FUNCTION_ID]', '[NAME]', ["any"]);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.update('[FUNCTION_ID]', '[NAME]', ["any"]);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->update('[FUNCTION_ID]', '[NAME]', ["any"]);
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.update('[FUNCTION_ID]', '[NAME]', ["any"])
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.update(function_id: '[FUNCTION_ID]', name: '[NAME]', execute: ["any"])
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.update(
        functionId: '[FUNCTION_ID]',
        name: '[NAME]',
        execute: ["any"],
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.update(
        functionId = "[FUNCTION_ID]",
        name = "[NAME]",
        execute = listOf("any"),
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.update(
        "[FUNCTION_ID]",
        "[NAME]",
        listOf("any"),
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let function = try await functions.update(
        functionId: "[FUNCTION_ID]",
        name: "[NAME]",
        execute: ["any"]
    )
    
    
  • mutation {
        functionsUpdate(
            functionId: "[FUNCTION_ID]",
            name: "[NAME]",
            execute: ["any"]
        ) {
            _id
            _createdAt
            _updatedAt
            execute
            name
            enabled
            runtime
            deployment
            vars {
                _id
                _createdAt
                _updatedAt
                key
                value
                functionId
            }
            events
            schedule
            scheduleNext
            schedulePrevious
            timeout
        }
    }
    
  • PUT /v1/functions/{functionId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    {
      "name": "[NAME]",
      "execute": ["any"],
      "events": [],
      "schedule": ,
      "timeout": 1,
      "enabled": false
    }
    

Update Function Deployment

PATCH/v1/functions/{functionId}/deployments/{deploymentId}

Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.write" scope.

HTTP Request

Name Type Description
functionId required string

Function ID.

deploymentId required string

Deployment ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json Function Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.updateDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.updateDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->updateDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.update_deployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.update_deployment(function_id: '[FUNCTION_ID]', deployment_id: '[DEPLOYMENT_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.updateDeployment(
        functionId: '[FUNCTION_ID]',
        deploymentId: '[DEPLOYMENT_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.updateDeployment(
        functionId = "[FUNCTION_ID]",
        deploymentId = "[DEPLOYMENT_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.updateDeployment(
        "[FUNCTION_ID]",
        "[DEPLOYMENT_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let function = try await functions.updateDeployment(
        functionId: "[FUNCTION_ID]",
        deploymentId: "[DEPLOYMENT_ID]"
    )
    
    
  • mutation {
        functionsUpdateDeployment(
            functionId: "[FUNCTION_ID]",
            deploymentId: "[DEPLOYMENT_ID]"
        ) {
            _id
            _createdAt
            _updatedAt
            execute
            name
            enabled
            runtime
            deployment
            vars {
                _id
                _createdAt
                _updatedAt
                key
                value
                functionId
            }
            events
            schedule
            scheduleNext
            schedulePrevious
            timeout
        }
    }
    
  • PATCH /v1/functions/{functionId}/deployments/{deploymentId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Delete Function

DELETE/v1/functions/{functionId}

Delete a function by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.write" scope.

HTTP Request

Name Type Description
functionId required string

Function ID.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.delete('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.delete('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->delete('[FUNCTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.delete('[FUNCTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.delete(function_id: '[FUNCTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.delete(
        functionId: '[FUNCTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.delete(
        functionId = "[FUNCTION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.delete(
        "[FUNCTION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let result = try await functions.delete(
        functionId: "[FUNCTION_ID]"
    )
    
    
  • mutation {
        functionsDelete(
            functionId: "[FUNCTION_ID]"
        ) {
            status
        }
    }
    
  • DELETE /v1/functions/{functionId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Create Deployment

POST/v1/functions/{functionId}/deployments

Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID.

This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the Appwrite Cloud Functions tutorial.

Use the "command" param to set the entry point used to execute your code.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.write" scope.

HTTP Request

Name Type Description
functionId required string

Function ID.

entrypoint required string

Entrypoint File.

code required file

Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.

activate required boolean

Automatically activate the deployment when it is finished building.

HTTP Response

Status Code Content Type Payload
202   application/json Deployment Object
Example Request
  • const sdk = require('node-appwrite');
    const fs = require('fs');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', InputFile.fromPath('/path/to/file.png', 'file.png'), false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', InputFile.fromPath('/path/to/file.png', 'file.png'), false);
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\InputFile;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->createDeployment('[FUNCTION_ID]', '[ENTRYPOINT]', InputFile::withPath('file.png'), false);
  • from appwrite.client import Client
    from appwrite.input_file import InputFile
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.create_deployment('[FUNCTION_ID]', '[ENTRYPOINT]', InputFile.from_path('file.png'), False)
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.create_deployment(function_id: '[FUNCTION_ID]', entrypoint: '[ENTRYPOINT]', code: InputFile.from_path('dir/file.png'), activate: false)
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.createDeployment(
        functionId: '[FUNCTION_ID]',
        entrypoint: '[ENTRYPOINT]',
        code: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'),
        activate: false,
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.models.InputFile
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.createDeployment(
        functionId = "[FUNCTION_ID]",
        entrypoint = "[ENTRYPOINT]",
        code = InputFile.fromPath("file.png"),
        activate = false
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.models.InputFile;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.createDeployment(
        "[FUNCTION_ID]",
        "[ENTRYPOINT]",
        InputFile.fromPath("file.png"),
        false
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let deployment = try await functions.createDeployment(
        functionId: "[FUNCTION_ID]",
        entrypoint: "[ENTRYPOINT]",
        code: InputFile.fromPath("file.png"),
        activate: xfalse
    )
    
    
  • POST /v1/functions/{functionId}/deployments HTTP/1.1
    Host: HOSTNAME
    Content-Type: multipart/form-data; boundary="cec8e8123c05ba25"
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    Content-Length: *Length of your entity body in bytes*
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="operations"
    
    { "query": "mutation { functionsCreateDeployment(functionId: $functionId, entrypoint: $entrypoint, code: $code, activate: $activate) { id }" }, "variables": { "functionId": "[FUNCTION_ID]", "entrypoint": "[ENTRYPOINT]", "code": null, "activate": false } }
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="map"
    
    { "0": ["variables.code"],  }
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="0"; filename="code.ext"
    
    File contents
    
    --cec8e8123c05ba25--
    
  • POST /v1/functions/{functionId}/deployments HTTP/1.1
    Host: HOSTNAME
    Content-Type: multipart/form-data; boundary="cec8e8123c05ba25"
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    Content-Length: *Length of your entity body in bytes*
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="entrypoint"
    
    "[ENTRYPOINT]"
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="code"
    
    cf 94 84 24 8d c4 91 10 0f dc 54 26 6c 8e 4b bc 
    e8 ee 55 94 29 e7 94 89 19 26 28 01 26 29 3f 16...
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="activate"
    
    false
    
    --cec8e8123c05ba25--
    

List Deployments

GET/v1/functions/{functionId}/deployments

Get a list of all the project's code deployments. You can use the query params to filter your results.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.read" scope.

HTTP Request

Name Type Description
functionId required string

Function ID.

queries optional array

Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: entrypoint, size, buildId, activate

search optional string

Search term to filter your list results. Max length: 256 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json Deployments List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.listDeployments('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.listDeployments('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->listDeployments('[FUNCTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.list_deployments('[FUNCTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.list_deployments(function_id: '[FUNCTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.listDeployments(
        functionId: '[FUNCTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.listDeployments(
        functionId = "[FUNCTION_ID]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.listDeployments(
        "[FUNCTION_ID]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let deploymentList = try await functions.listDeployments(
        functionId: "[FUNCTION_ID]"
    )
    
    
  • query {
        functionsListDeployments(
            functionId: "[FUNCTION_ID]"
        ) {
            total
            deployments {
                _id
                _createdAt
                _updatedAt
                resourceId
                resourceType
                entrypoint
                size
                buildId
                activate
                status
                buildStdout
                buildStderr
                buildTime
            }
        }
    }
    
  • GET /v1/functions/{functionId}/deployments HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Get Deployment

GET/v1/functions/{functionId}/deployments/{deploymentId}

Get a code deployment by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.read" scope.

HTTP Request

Name Type Description
functionId required string

Function ID.

deploymentId required string

Deployment ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json Deployment Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.getDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.getDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->getDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.get_deployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.get_deployment(function_id: '[FUNCTION_ID]', deployment_id: '[DEPLOYMENT_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.getDeployment(
        functionId: '[FUNCTION_ID]',
        deploymentId: '[DEPLOYMENT_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.getDeployment(
        functionId = "[FUNCTION_ID]",
        deploymentId = "[DEPLOYMENT_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.getDeployment(
        "[FUNCTION_ID]",
        "[DEPLOYMENT_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let deployment = try await functions.getDeployment(
        functionId: "[FUNCTION_ID]",
        deploymentId: "[DEPLOYMENT_ID]"
    )
    
    
  • query {
        functionsGetDeployment(
            functionId: "[FUNCTION_ID]",
            deploymentId: "[DEPLOYMENT_ID]"
        ) {
            _id
            _createdAt
            _updatedAt
            resourceId
            resourceType
            entrypoint
            size
            buildId
            activate
            status
            buildStdout
            buildStderr
            buildTime
        }
    }
    
  • GET /v1/functions/{functionId}/deployments/{deploymentId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Delete Deployment

DELETE/v1/functions/{functionId}/deployments/{deploymentId}

Delete a code deployment by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.write" scope.

HTTP Request

Name Type Description
functionId required string

Function ID.

deploymentId required string

Deployment ID.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.deleteDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.deleteDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->deleteDeployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.delete_deployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.delete_deployment(function_id: '[FUNCTION_ID]', deployment_id: '[DEPLOYMENT_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.deleteDeployment(
        functionId: '[FUNCTION_ID]',
        deploymentId: '[DEPLOYMENT_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.deleteDeployment(
        functionId = "[FUNCTION_ID]",
        deploymentId = "[DEPLOYMENT_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.deleteDeployment(
        "[FUNCTION_ID]",
        "[DEPLOYMENT_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let result = try await functions.deleteDeployment(
        functionId: "[FUNCTION_ID]",
        deploymentId: "[DEPLOYMENT_ID]"
    )
    
    
  • mutation {
        functionsDeleteDeployment(
            functionId: "[FUNCTION_ID]",
            deploymentId: "[DEPLOYMENT_ID]"
        ) {
            status
        }
    }
    
  • DELETE /v1/functions/{functionId}/deployments/{deploymentId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Create Build

POST/v1/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.write" scope.

HTTP Request

Name Type Description
functionId required string

Function ID.

deploymentId required string

Deployment ID.

buildId required string

Build unique ID.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.createBuild('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.createBuild('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->createBuild('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.create_build('[FUNCTION_ID]', '[DEPLOYMENT_ID]', '[BUILD_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.create_build(function_id: '[FUNCTION_ID]', deployment_id: '[DEPLOYMENT_ID]', build_id: '[BUILD_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.createBuild(
        functionId: '[FUNCTION_ID]',
        deploymentId: '[DEPLOYMENT_ID]',
        buildId: '[BUILD_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.createBuild(
        functionId = "[FUNCTION_ID]",
        deploymentId = "[DEPLOYMENT_ID]",
        buildId = "[BUILD_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.createBuild(
        "[FUNCTION_ID]",
        "[DEPLOYMENT_ID]",
        "[BUILD_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let result = try await functions.createBuild(
        functionId: "[FUNCTION_ID]",
        deploymentId: "[DEPLOYMENT_ID]",
        buildId: "[BUILD_ID]"
    )
    
    
  • mutation {
        functionsCreateBuild(
            functionId: "[FUNCTION_ID]",
            deploymentId: "[DEPLOYMENT_ID]",
            buildId: "[BUILD_ID]"
        ) {
            status
        }
    }
    
  • POST /v1/functions/{functionId}/deployments/{deploymentId}/builds/{buildId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Create Execution

POST/v1/functions/{functionId}/executions

Trigger a function execution. The returned object will return you the current execution status. You can ping the Get Execution endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "execution.write" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Rate Limits

This endpoint is limited to 60 requests in every 1 minutes per IP address and user account. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

HTTP Request

Name Type Description
functionId required string

Function ID.

data optional string

String of custom data to send to function.

async optional boolean

Execute code in the background. Default value is false.

HTTP Response

Status Code Content Type Payload
201  Created application/json Execution Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.createExecution('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.createExecution('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->createExecution('[FUNCTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.create_execution('[FUNCTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.create_execution(function_id: '[FUNCTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.createExecution(
        functionId: '[FUNCTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.createExecution(
        functionId = "[FUNCTION_ID]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.createExecution(
        "[FUNCTION_ID]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let execution = try await functions.createExecution(
        functionId: "[FUNCTION_ID]"
    )
    
    
  • mutation {
        functionsCreateExecution(
            functionId: "[FUNCTION_ID]"
        ) {
            _id
            _createdAt
            _updatedAt
            _permissions
            functionId
            trigger
            status
            statusCode
            response
            stdout
            stderr
            duration
        }
    }
    
  • POST /v1/functions/{functionId}/executions HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "data": "[DATA]",
      "async": false
    }
    

List Executions

GET/v1/functions/{functionId}/executions

Get a list of all the current user function execution logs. You can use the query params to filter your results.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "execution.read" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

HTTP Request

Name Type Description
functionId required string

Function ID.

queries optional array

Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, statusCode, duration

search optional string

Search term to filter your list results. Max length: 256 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json Executions List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.listExecutions('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.listExecutions('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->listExecutions('[FUNCTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.list_executions('[FUNCTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.list_executions(function_id: '[FUNCTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.listExecutions(
        functionId: '[FUNCTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.listExecutions(
        functionId = "[FUNCTION_ID]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.listExecutions(
        "[FUNCTION_ID]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let executionList = try await functions.listExecutions(
        functionId: "[FUNCTION_ID]"
    )
    
    
  • query {
        functionsListExecutions(
            functionId: "[FUNCTION_ID]"
        ) {
            total
            executions {
                _id
                _createdAt
                _updatedAt
                _permissions
                functionId
                trigger
                status
                statusCode
                response
                stdout
                stderr
                duration
            }
        }
    }
    
  • GET /v1/functions/{functionId}/executions HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Get Execution

GET/v1/functions/{functionId}/executions/{executionId}

Get a function execution log by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "execution.read" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

HTTP Request

Name Type Description
functionId required string

Function ID.

executionId required string

Execution ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json Execution Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.getExecution('[FUNCTION_ID]', '[EXECUTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.getExecution('[FUNCTION_ID]', '[EXECUTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->getExecution('[FUNCTION_ID]', '[EXECUTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.get_execution('[FUNCTION_ID]', '[EXECUTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.get_execution(function_id: '[FUNCTION_ID]', execution_id: '[EXECUTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.getExecution(
        functionId: '[FUNCTION_ID]',
        executionId: '[EXECUTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.getExecution(
        functionId = "[FUNCTION_ID]",
        executionId = "[EXECUTION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.getExecution(
        "[FUNCTION_ID]",
        "[EXECUTION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let execution = try await functions.getExecution(
        functionId: "[FUNCTION_ID]",
        executionId: "[EXECUTION_ID]"
    )
    
    
  • query {
        functionsGetExecution(
            functionId: "[FUNCTION_ID]",
            executionId: "[EXECUTION_ID]"
        ) {
            _id
            _createdAt
            _updatedAt
            _permissions
            functionId
            trigger
            status
            statusCode
            response
            stdout
            stderr
            duration
        }
    }
    
  • GET /v1/functions/{functionId}/executions/{executionId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Create Variable

POST/v1/functions/{functionId}/variables

Create a new function variable. These variables can be accessed within function in the env object under the request variable.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.write" scope.

HTTP Request

Name Type Description
functionId required string

Function unique ID.

key required string

Variable key. Max length: 255 chars.

value required string

Variable value. Max length: 8192 chars.

HTTP Response

Status Code Content Type Payload
201  Created application/json Variable Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.createVariable('[FUNCTION_ID]', '[KEY]', '[VALUE]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.createVariable('[FUNCTION_ID]', '[KEY]', '[VALUE]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->createVariable('[FUNCTION_ID]', '[KEY]', '[VALUE]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.create_variable('[FUNCTION_ID]', '[KEY]', '[VALUE]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.create_variable(function_id: '[FUNCTION_ID]', key: '[KEY]', value: '[VALUE]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.createVariable(
        functionId: '[FUNCTION_ID]',
        key: '[KEY]',
        value: '[VALUE]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.createVariable(
        functionId = "[FUNCTION_ID]",
        key = "[KEY]",
        value = "[VALUE]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.createVariable(
        "[FUNCTION_ID]",
        "[KEY]",
        "[VALUE]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let variable = try await functions.createVariable(
        functionId: "[FUNCTION_ID]",
        key: "[KEY]",
        value: "[VALUE]"
    )
    
    
  • mutation {
        functionsCreateVariable(
            functionId: "[FUNCTION_ID]",
            key: "[KEY]",
            value: "[VALUE]"
        ) {
            _id
            _createdAt
            _updatedAt
            key
            value
            functionId
        }
    }
    
  • POST /v1/functions/{functionId}/variables HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    {
      "key": "[KEY]",
      "value": "[VALUE]"
    }
    

List Variables

GET/v1/functions/{functionId}/variables

Get a list of all variables of a specific function.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.read" scope.

HTTP Request

Name Type Description
functionId required string

Function unique ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json Variables List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.listVariables('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.listVariables('[FUNCTION_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->listVariables('[FUNCTION_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.list_variables('[FUNCTION_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.list_variables(function_id: '[FUNCTION_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.listVariables(
        functionId: '[FUNCTION_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.listVariables(
        functionId = "[FUNCTION_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.listVariables(
        "[FUNCTION_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let variableList = try await functions.listVariables(
        functionId: "[FUNCTION_ID]"
    )
    
    
  • query {
        functionsListVariables(
            functionId: "[FUNCTION_ID]"
        ) {
            total
            variables {
                _id
                _createdAt
                _updatedAt
                key
                value
                functionId
            }
        }
    }
    
  • GET /v1/functions/{functionId}/variables HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Get Variable

GET/v1/functions/{functionId}/variables/{variableId}

Get a variable by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.read" scope.

HTTP Request

Name Type Description
functionId required string

Function unique ID.

variableId required string

Variable unique ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json Variable Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.getVariable('[FUNCTION_ID]', '[VARIABLE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.getVariable('[FUNCTION_ID]', '[VARIABLE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->getVariable('[FUNCTION_ID]', '[VARIABLE_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.get_variable('[FUNCTION_ID]', '[VARIABLE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.get_variable(function_id: '[FUNCTION_ID]', variable_id: '[VARIABLE_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.getVariable(
        functionId: '[FUNCTION_ID]',
        variableId: '[VARIABLE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.getVariable(
        functionId = "[FUNCTION_ID]",
        variableId = "[VARIABLE_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.getVariable(
        "[FUNCTION_ID]",
        "[VARIABLE_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let variable = try await functions.getVariable(
        functionId: "[FUNCTION_ID]",
        variableId: "[VARIABLE_ID]"
    )
    
    
  • query {
        functionsGetVariable(
            functionId: "[FUNCTION_ID]",
            variableId: "[VARIABLE_ID]"
        ) {
            _id
            _createdAt
            _updatedAt
            key
            value
            functionId
        }
    }
    
  • GET /v1/functions/{functionId}/variables/{variableId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Update Variable

PUT/v1/functions/{functionId}/variables/{variableId}

Update variable by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.write" scope.

HTTP Request

Name Type Description
functionId required string

Function unique ID.

variableId required string

Variable unique ID.

key required string

Variable key. Max length: 255 chars.

value optional string

Variable value. Max length: 8192 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json Variable Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.updateVariable('[FUNCTION_ID]', '[VARIABLE_ID]', '[KEY]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.updateVariable('[FUNCTION_ID]', '[VARIABLE_ID]', '[KEY]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->updateVariable('[FUNCTION_ID]', '[VARIABLE_ID]', '[KEY]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.update_variable('[FUNCTION_ID]', '[VARIABLE_ID]', '[KEY]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.update_variable(function_id: '[FUNCTION_ID]', variable_id: '[VARIABLE_ID]', key: '[KEY]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.updateVariable(
        functionId: '[FUNCTION_ID]',
        variableId: '[VARIABLE_ID]',
        key: '[KEY]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.updateVariable(
        functionId = "[FUNCTION_ID]",
        variableId = "[VARIABLE_ID]",
        key = "[KEY]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.updateVariable(
        "[FUNCTION_ID]",
        "[VARIABLE_ID]",
        "[KEY]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let variable = try await functions.updateVariable(
        functionId: "[FUNCTION_ID]",
        variableId: "[VARIABLE_ID]",
        key: "[KEY]"
    )
    
    
  • mutation {
        functionsUpdateVariable(
            functionId: "[FUNCTION_ID]",
            variableId: "[VARIABLE_ID]",
            key: "[KEY]"
        ) {
            _id
            _createdAt
            _updatedAt
            key
            value
            functionId
        }
    }
    
  • PUT /v1/functions/{functionId}/variables/{variableId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    {
      "key": "[KEY]",
      "value": "[VALUE]"
    }
    

Delete Variable

DELETE/v1/functions/{functionId}/variables/{variableId}

Delete a variable by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "functions.write" scope.

HTTP Request

Name Type Description
functionId required string

Function unique ID.

variableId required string

Variable unique ID.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = functions.deleteVariable('[FUNCTION_ID]', '[VARIABLE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let functions = new sdk.Functions(client);
    
    client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = functions.deleteVariable('[FUNCTION_ID]', '[VARIABLE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Functions;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $functions = new Functions($client);
    
    $result = $functions->deleteVariable('[FUNCTION_ID]', '[VARIABLE_ID]');
  • from appwrite.client import Client
    from appwrite.services.functions import Functions
    
    client = Client()
    
    (client
      .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    functions = Functions(client)
    
    result = functions.delete_variable('[FUNCTION_ID]', '[VARIABLE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    functions = Functions.new(client)
    
    response = functions.delete_variable(function_id: '[FUNCTION_ID]', variable_id: '[VARIABLE_ID]')
    
    puts response.inspect
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Functions functions = Functions(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = functions.deleteVariable(
        functionId: '[FUNCTION_ID]',
        variableId: '[VARIABLE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    val client = Client(context)
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val functions = Functions(client)
    
    val response = functions.deleteVariable(
        functionId = "[FUNCTION_ID]",
        variableId = "[VARIABLE_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Functions;
    
    Client client = new Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Functions functions = new Functions(client);
    
    functions.deleteVariable(
        "[FUNCTION_ID]",
        "[VARIABLE_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let functions = Functions(client)
    
    let result = try await functions.deleteVariable(
        functionId: "[FUNCTION_ID]",
        variableId: "[VARIABLE_ID]"
    )
    
    
  • mutation {
        functionsDeleteVariable(
            functionId: "[FUNCTION_ID]",
            variableId: "[VARIABLE_ID]"
        ) {
            status
        }
    }
    
  • DELETE /v1/functions/{functionId}/variables/{variableId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2