Appwrite is now available as a DigitalOcean 1-click app! Click to install! 🚀
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 your own unique ID or pass the string "unique()" to auto generate it. 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
    
    suspend fun main() {
        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",
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            name = "[NAME]",
            execute = listOf("any"),
            runtime = "node-14.5",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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"
        )
    
        print(String(describing: function)
    }
    

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
    
    suspend fun main() {
        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(
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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 Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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()
    
        print(String(describing: functionList)
    }
    

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
    
    suspend fun main() {
        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()
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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 Continuation<Response>() {
            @NotNull
            @Override
            public CoroutineContext getContext() {
                return EmptyCoroutineContext.INSTANCE;
            }
    
            @Override
            public void resumeWith(@NotNull Object o) {
                String json = "";
                try {
                    if (o instanceof Result.Failure) {
                        Result.Failure failure = (Result.Failure) o;
                        throw failure.exception;
                    } else {
                        Response response = (Response) o;
                    }
                } catch (Throwable th) {
                    Log.e("ERROR", th.toString());
                }
            }
        });
    }
  • import Appwrite
    
    func main() async throws {
        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()
    
        print(String(describing: runtimeList)
    }
    

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
    
    suspend fun main() {
        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]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: function)
    }
    

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
    
    suspend fun main() {
        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"),
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            name = "[NAME]",
            execute = listOf("any"),
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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"]
        )
    
        print(String(describing: function)
    }
    

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
    
    suspend fun main() {
        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]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            deploymentId = "[DEPLOYMENT_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: function)
    }
    

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
    
    suspend fun main() {
        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]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: result)
    }
    

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
    
    suspend fun main() {
        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
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.models.InputFile
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            entrypoint = "[ENTRYPOINT]",
            code = InputFile.fromPath("file.png"),
            activate = false
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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
        )
    
        print(String(describing: deployment)
    }
    

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
    
    suspend fun main() {
        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]",
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: deploymentList)
    }
    

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
    
    suspend fun main() {
        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]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            deploymentId = "[DEPLOYMENT_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: deployment)
    }
    

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
    
    suspend fun main() {
        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]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            deploymentId = "[DEPLOYMENT_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: result)
    }
    

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
    
    suspend fun main() {
        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]",
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: execution)
    }
    

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. On admin mode, this endpoint will return a list of all of the project's executions. Learn more about different API modes.

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
    
    suspend fun main() {
        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]",
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: executionList)
    }
    

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
    
    suspend fun main() {
        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]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            executionId = "[EXECUTION_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: execution)
    }
    

Retry 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 created with the "functions.write" 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.

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.retryBuild('[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.retryBuild('[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->retryBuild('[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.retry_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.retry_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.retryBuild(
        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
    
    suspend fun main() {
        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.retryBuild(
            functionId = "[FUNCTION_ID]",
            deploymentId = "[DEPLOYMENT_ID]",
            buildId = "[BUILD_ID]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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.retryBuild(
            functionId = "[FUNCTION_ID]",
            deploymentId = "[DEPLOYMENT_ID]",
            buildId = "[BUILD_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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.retryBuild(
            functionId: "[FUNCTION_ID]",
            deploymentId: "[DEPLOYMENT_ID]",
            buildId: "[BUILD_ID]"
        )
    
        print(String(describing: result)
    }
    

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
    
    suspend fun main() {
        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]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            key = "[KEY]",
            value = "[VALUE]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: variable)
    }
    

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
    
    suspend fun main() {
        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]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: variableList)
    }
    

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
    
    suspend fun main() {
        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]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            variableId = "[VARIABLE_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: variable)
    }
    

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
    
    suspend fun main() {
        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]",
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            variableId = "[VARIABLE_ID]",
            key = "[KEY]",
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: variable)
    }
    

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
    
    suspend fun main() {
        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]"
        )
        val json = response.body?.string()
    }
  • import io.appwrite.Client
    import io.appwrite.services.Functions
    
    public void main() {
        Client client = Client(context)
            .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(
            functionId = "[FUNCTION_ID]",
            variableId = "[VARIABLE_ID]"
            new Continuation<Response>() {
                @NotNull
                @Override
                public CoroutineContext getContext() {
                    return EmptyCoroutineContext.INSTANCE;
                }
    
                @Override
                public void resumeWith(@NotNull Object o) {
                    String json = "";
                    try {
                        if (o instanceof Result.Failure) {
                            Result.Failure failure = (Result.Failure) o;
                            throw failure.exception;
                        } else {
                            Response response = (Response) o;
                        }
                    } catch (Throwable th) {
                        Log.e("ERROR", th.toString());
                    }
                }
            }
        );
    }
  • import Appwrite
    
    func main() async throws {
        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]"
        )
    
        print(String(describing: result)
    }