Version 0.6.2  
Docs

Teams API

Server integration with     code examples.


The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources, such as database documents or storage files.

Each user who creates a team becomes the team owner and can delegate the ownership role by inviting a new team member. Only team owners can invite new users to their team.

Create Team

POST/teams

Create a new team. The user who creates the team will automatically be assigned as the owner of the team. The team owner can invite new members, who will be able add new owners and update or delete the team from your project.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "teams.write" permission scope.

Arguments

Name Type Description
name required string

Team name.

roles optional array

Array of strings. Use this param to set the roles in the team for the user who created it. The default role is owner. A role can be any string. Learn more about roles and permissions.

Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let teams = new sdk.Teams(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 = teams.create('[NAME]');
    
    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 teams = new sdk.Teams(client);
    
    client
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = teams.create('[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Teams;
    
    $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
    ;
    
    $teams = new Teams($client);
    
    $result = $teams->create('[NAME]');
  • from appwrite.client import Client
    from appwrite.services.teams import Teams
    
    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
    )
    
    teams = Teams(client)
    
    result = teams.create('[NAME]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    teams = Appwrite::Teams.new(client);
    
    response = teams.create(name: '[NAME]');
    
    puts response

List Teams

GET/teams

Get a list of all the current user teams. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project teams. Learn more about different API modes.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "teams.read" permission scope.

Arguments

Name Type Description
search optional string

Search term to filter your list results.

limit optional integer

Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.

offset optional integer

Results offset. The default value is 0. Use this param to manage pagination.

orderType optional string

Order result by ASC or DESC order.

Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let teams = new sdk.Teams(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 = teams.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 teams = new sdk.Teams(client);
    
    client
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = teams.list();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Teams;
    
    $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
    ;
    
    $teams = new Teams($client);
    
    $result = $teams->list();
  • from appwrite.client import Client
    from appwrite.services.teams import Teams
    
    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
    )
    
    teams = Teams(client)
    
    result = teams.list()
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    teams = Appwrite::Teams.new(client);
    
    response = teams.list();
    
    puts response

Get Team

GET/teams/{teamId}

Get team by its unique ID. All team members have read access for this resource.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "teams.read" permission scope.

Arguments

Name Type Description
teamId required string

Team unique ID.

Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let teams = new sdk.Teams(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 = teams.get('[TEAM_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 teams = new sdk.Teams(client);
    
    client
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = teams.get('[TEAM_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Teams;
    
    $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
    ;
    
    $teams = new Teams($client);
    
    $result = $teams->get('[TEAM_ID]');
  • from appwrite.client import Client
    from appwrite.services.teams import Teams
    
    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
    )
    
    teams = Teams(client)
    
    result = teams.get('[TEAM_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    teams = Appwrite::Teams.new(client);
    
    response = teams.get(team_id: '[TEAM_ID]');
    
    puts response

Update Team

PUT/teams/{teamId}

Update team by its unique ID. Only team owners have write access for this resource.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "teams.write" permission scope.

Arguments

Name Type Description
teamId required string

Team unique ID.

name required string

Team name.

Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let teams = new sdk.Teams(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 = teams.update('[TEAM_ID]', '[NAME]');
    
    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 teams = new sdk.Teams(client);
    
    client
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = teams.update('[TEAM_ID]', '[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Teams;
    
    $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
    ;
    
    $teams = new Teams($client);
    
    $result = $teams->update('[TEAM_ID]', '[NAME]');
  • from appwrite.client import Client
    from appwrite.services.teams import Teams
    
    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
    )
    
    teams = Teams(client)
    
    result = teams.update('[TEAM_ID]', '[NAME]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    teams = Appwrite::Teams.new(client);
    
    response = teams.update(team_id: '[TEAM_ID]', name: '[NAME]');
    
    puts response

Delete Team

DELETE/teams/{teamId}

Delete team by its unique ID. Only team owners have write access for this resource.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "teams.write" permission scope.

Arguments

Name Type Description
teamId required string

Team unique ID.

Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let teams = new sdk.Teams(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 = teams.delete('[TEAM_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 teams = new sdk.Teams(client);
    
    client
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = teams.delete('[TEAM_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Teams;
    
    $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
    ;
    
    $teams = new Teams($client);
    
    $result = $teams->delete('[TEAM_ID]');
  • from appwrite.client import Client
    from appwrite.services.teams import Teams
    
    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
    )
    
    teams = Teams(client)
    
    result = teams.delete('[TEAM_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    teams = Appwrite::Teams.new(client);
    
    response = teams.delete(team_id: '[TEAM_ID]');
    
    puts response

Create Team Membership

POST/teams/{teamId}/memberships

Use this endpoint to invite a new member to join your team. An email with a link to join the team will be sent to the new member email address if the member doesn't exist in the project it will be created automatically.

Use the 'URL' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the Update Team Membership Status endpoint to allow the user to accept the invitation to the team.

Please note that in order to avoid a Redirect Attacks the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "teams.write" permission scope.

Arguments

Name Type Description
teamId required string

Team unique ID.

email required string

New team member email.

roles required array

Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about roles and permissions.

url required string

URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an open redirect attack against your project API.

name optional string

New team member name.

Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let teams = new sdk.Teams(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 = teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com');
    
    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 teams = new sdk.Teams(client);
    
    client
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Teams;
    
    $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
    ;
    
    $teams = new Teams($client);
    
    $result = $teams->createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com');
  • from appwrite.client import Client
    from appwrite.services.teams import Teams
    
    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
    )
    
    teams = Teams(client)
    
    result = teams.create_membership('[TEAM_ID]', 'email@example.com', [], 'https://example.com')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    teams = Appwrite::Teams.new(client);
    
    response = teams.create_membership(team_id: '[TEAM_ID]', email: 'email@example.com', roles: [], url: 'https://example.com');
    
    puts response

Get Team Memberships

GET/teams/{teamId}/memberships

Get team members by the team unique ID. All team members have read access for this list of resources.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "teams.read" permission scope.

Arguments

Name Type Description
teamId required string

Team unique ID.

Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let teams = new sdk.Teams(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 = teams.getMemberships('[TEAM_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 teams = new sdk.Teams(client);
    
    client
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = teams.getMemberships('[TEAM_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Teams;
    
    $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
    ;
    
    $teams = new Teams($client);
    
    $result = $teams->getMemberships('[TEAM_ID]');
  • from appwrite.client import Client
    from appwrite.services.teams import Teams
    
    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
    )
    
    teams = Teams(client)
    
    result = teams.get_memberships('[TEAM_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    teams = Appwrite::Teams.new(client);
    
    response = teams.get_memberships(team_id: '[TEAM_ID]');
    
    puts response

Delete Team Membership

DELETE/teams/{teamId}/memberships/{inviteId}

This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if he didn't accept it.

Authentication

To access this route, init your SDK with your project unique ID and API Key secret token. Make sure your API Key is granted with access to the "teams.write" permission scope.

Arguments

Name Type Description
teamId required string

Team unique ID.

inviteId required string

Invite unique ID.

Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    let client = new sdk.Client();
    
    let teams = new sdk.Teams(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 = teams.deleteMembership('[TEAM_ID]', '[INVITE_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 teams = new sdk.Teams(client);
    
    client
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Teams;
    
    $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
    ;
    
    $teams = new Teams($client);
    
    $result = $teams->deleteMembership('[TEAM_ID]', '[INVITE_ID]');
  • from appwrite.client import Client
    from appwrite.services.teams import Teams
    
    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
    )
    
    teams = Teams(client)
    
    result = teams.delete_membership('[TEAM_ID]', '[INVITE_ID]')
    
  • require 'appwrite'
    
    client = Appwrite::Client.new()
    
    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
    ;
    
    teams = Appwrite::Teams.new(client);
    
    response = teams.delete_membership(team_id: '[TEAM_ID]', invite_id: '[INVITE_ID]');
    
    puts response