Teams API
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
Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.
HTTP Request
Name | Type | Description | |
teamId | required | string | Team ID. Choose a custom ID or generate a random ID with |
name | required | string | Team name. Max length: 128 chars. |
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. Maximum of 100 roles are allowed, each 32 characters long. |
HTTP Response
Status Code | Content Type | Payload |
201 Created | application/json | Team Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.create('[TEAM_ID]', '[NAME]'); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.create( teamId: '[TEAM_ID]', name: '[NAME]', ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let team = try await teams.create( teamId: "[TEAM_ID]", name: "[NAME]" )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.create( teamId = "[TEAM_ID]", name = "[NAME]", )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.create( "[TEAM_ID]", "[NAME]", new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
mutation { teamsCreate( teamId: "[TEAM_ID]", name: "[NAME]" ) { _id _createdAt _updatedAt name total prefs { data } } }
-
POST /v1/teams HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ... { "teamId": "[TEAM_ID]", "name": "[NAME]", "roles": [] }
List Teams
Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
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, total |
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 | Teams List Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.list(); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.list( ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let teamList = try await teams.list()
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.list( )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.list( new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
query { teamsList { total teams { _id _createdAt _updatedAt name total prefs { data } } } }
-
GET /v1/teams HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
Get Team
Get a team by its ID. All team members have read access for this resource.
HTTP Request
Name | Type | Description | |
teamId | required | string | Team ID. |
HTTP Response
Status Code | Content Type | Payload |
200 OK | application/json | Team Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.get('[TEAM_ID]'); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.get( teamId: '[TEAM_ID]', ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let team = try await teams.get( teamId: "[TEAM_ID]" )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.get( teamId = "[TEAM_ID]" )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.get( "[TEAM_ID]" new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
query { teamsGet( teamId: "[TEAM_ID]" ) { _id _createdAt _updatedAt name total prefs { data } } }
-
GET /v1/teams/{teamId} HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
Get Team Preferences
Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in user preferences.
HTTP Request
Name | Type | Description | |
teamId | required | string | Team ID. |
HTTP Response
Status Code | Content Type | Payload |
200 OK | application/json | Preferences Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.getPrefs('[TEAM_ID]'); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.getPrefs( teamId: '[TEAM_ID]', ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let preferences = try await teams.getPrefs( teamId: "[TEAM_ID]" )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.getPrefs( teamId = "[TEAM_ID]" )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.getPrefs( "[TEAM_ID]" new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
query { teamsGetPrefs( teamId: "[TEAM_ID]" ) { data } }
-
GET /v1/teams/{teamId}/prefs HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
Update Name
HTTP Request
Name | Type | Description | |
teamId | required | string | Team ID. |
name | required | string | New team name. Max length: 128 chars. |
HTTP Response
Status Code | Content Type | Payload |
200 OK | application/json | Team Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.updateName('[TEAM_ID]', '[NAME]'); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.updateName( teamId: '[TEAM_ID]', name: '[NAME]', ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let team = try await teams.updateName( teamId: "[TEAM_ID]", name: "[NAME]" )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.updateName( teamId = "[TEAM_ID]", name = "[NAME]" )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.updateName( "[TEAM_ID]", "[NAME]" new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
mutation { teamsUpdateName( teamId: "[TEAM_ID]", name: "[NAME]" ) { _id _createdAt _updatedAt name total prefs { data } } }
-
PUT /v1/teams/{teamId} HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ... { "name": "[NAME]" }
Update Preferences
Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded.
HTTP Request
Name | Type | Description | |
teamId | required | string | Team ID. |
prefs | required | object | Prefs key-value JSON object. |
HTTP Response
Status Code | Content Type | Payload |
200 OK | application/json | Preferences Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.updatePrefs('[TEAM_ID]', {}); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.updatePrefs( teamId: '[TEAM_ID]', prefs: {}, ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let preferences = try await teams.updatePrefs( teamId: "[TEAM_ID]", prefs: [:] )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.updatePrefs( teamId = "[TEAM_ID]", prefs = mapOf( "a" to "b" ) )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.updatePrefs( "[TEAM_ID]", mapOf( "a" to "b" ) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
mutation { teamsUpdatePrefs( teamId: "[TEAM_ID]", prefs: "{}" ) { data } }
-
PUT /v1/teams/{teamId}/prefs HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ... { "prefs": {} }
Delete Team
Delete a team using its ID. Only team members with the owner role can delete the team.
HTTP Request
Name | Type | Description | |
teamId | required | string | Team ID. |
HTTP Response
Status Code | Content Type | Payload |
204 No Content | - | - |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.delete('[TEAM_ID]'); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.delete( teamId: '[TEAM_ID]', ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let result = try await teams.delete( teamId: "[TEAM_ID]" )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.delete( teamId = "[TEAM_ID]" )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.delete( "[TEAM_ID]" new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
mutation { teamsDelete( teamId: "[TEAM_ID]" ) { status } }
-
DELETE /v1/teams/{teamId} HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
Create Team Membership
Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team.
You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters.
Use the url
parameter to redirect the user from the invitation email to your app. After 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 to avoid a Redirect Attack Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.
Rate Limits
This endpoint is limited to 10 requests in every 60 minutes per IP address. 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 | |
teamId | required | string | Team ID. |
optional | string | Email of the new team member. | |
userId | optional | string | ID of the user to be added to a team. |
phone | optional | string | Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. |
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. Maximum of 100 roles are allowed, each 32 characters long. |
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 | Name of the new team member. Max length: 128 chars. |
HTTP Response
Status Code | Content Type | Payload |
201 Created | application/json | Membership Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.createMembership('[TEAM_ID]', [], 'https://example.com'); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.createMembership( teamId: '[TEAM_ID]', roles: [], url: 'https://example.com', ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let membership = try await teams.createMembership( teamId: "[TEAM_ID]", roles: [], url: "https://example.com" )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.createMembership( teamId = "[TEAM_ID]", roles = listOf(), url = "https://example.com", )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.createMembership( "[TEAM_ID]", listOf(), "https://example.com", new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
mutation { teamsCreateMembership( teamId: "[TEAM_ID]", roles: [], url: "https://example.com" ) { _id _createdAt _updatedAt userId userName userEmail teamId teamName invited joined confirm roles } }
-
POST /v1/teams/{teamId}/memberships HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ... { "email": "email@example.com", "userId": "[USER_ID]", "phone": "+12065550100", "roles": [], "url": "https://example.com", "name": "[NAME]" }
List Team Memberships
Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint.
HTTP Request
Name | Type | Description | |
teamId | required | string | Team 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: userId, teamId, invited, joined, confirm |
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 | Memberships List Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.listMemberships('[TEAM_ID]'); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.listMemberships( teamId: '[TEAM_ID]', ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let membershipList = try await teams.listMemberships( teamId: "[TEAM_ID]" )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.listMemberships( teamId = "[TEAM_ID]", )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.listMemberships( "[TEAM_ID]", new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
query { teamsListMemberships( teamId: "[TEAM_ID]" ) { total memberships { _id _createdAt _updatedAt userId userName userEmail teamId teamName invited joined confirm roles } } }
-
GET /v1/teams/{teamId}/memberships HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
Get Team Membership
Get a team member by the membership unique id. All team members have read access for this resource.
HTTP Request
Name | Type | Description | |
teamId | required | string | Team ID. |
membershipId | required | string | Membership ID. |
HTTP Response
Status Code | Content Type | Payload |
200 OK | application/json | Membership Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.getMembership('[TEAM_ID]', '[MEMBERSHIP_ID]'); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.getMembership( teamId: '[TEAM_ID]', membershipId: '[MEMBERSHIP_ID]', ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let membership = try await teams.getMembership( teamId: "[TEAM_ID]", membershipId: "[MEMBERSHIP_ID]" )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.getMembership( teamId = "[TEAM_ID]", membershipId = "[MEMBERSHIP_ID]" )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.getMembership( "[TEAM_ID]", "[MEMBERSHIP_ID]" new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
query { teamsGetMembership( teamId: "[TEAM_ID]", membershipId: "[MEMBERSHIP_ID]" ) { _id _createdAt _updatedAt userId userName userEmail teamId teamName invited joined confirm roles } }
-
GET /v1/teams/{teamId}/memberships/{membershipId} HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
Update Membership Roles
Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about roles and permissions.
HTTP Request
Name | Type | Description | |
teamId | required | string | Team ID. |
membershipId | required | string | Membership ID. |
roles | required | array | An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about roles and permissions. Maximum of 100 roles are allowed, each 32 characters long. |
HTTP Response
Status Code | Content Type | Payload |
200 OK | application/json | Membership Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.updateMembershipRoles('[TEAM_ID]', '[MEMBERSHIP_ID]', []); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.updateMembershipRoles( teamId: '[TEAM_ID]', membershipId: '[MEMBERSHIP_ID]', roles: [], ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let membership = try await teams.updateMembershipRoles( teamId: "[TEAM_ID]", membershipId: "[MEMBERSHIP_ID]", roles: [] )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.updateMembershipRoles( teamId = "[TEAM_ID]", membershipId = "[MEMBERSHIP_ID]", roles = listOf() )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.updateMembershipRoles( "[TEAM_ID]", "[MEMBERSHIP_ID]", listOf() new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
mutation { teamsUpdateMembershipRoles( teamId: "[TEAM_ID]", membershipId: "[MEMBERSHIP_ID]", roles: [] ) { _id _createdAt _updatedAt userId userName userEmail teamId teamName invited joined confirm roles } }
-
PATCH /v1/teams/{teamId}/memberships/{membershipId} HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ... { "roles": [] }
Update Team Membership Status
Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user.
If the request is successful, a session for the user is automatically created.
HTTP Request
Name | Type | Description | |
teamId | required | string | Team ID. |
membershipId | required | string | Membership ID. |
userId | required | string | User ID. |
secret | required | string | Secret key. |
HTTP Response
Status Code | Content Type | Payload |
200 OK | application/json | Membership Object |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.updateMembershipStatus('[TEAM_ID]', '[MEMBERSHIP_ID]', '[USER_ID]', '[SECRET]'); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.updateMembershipStatus( teamId: '[TEAM_ID]', membershipId: '[MEMBERSHIP_ID]', userId: '[USER_ID]', secret: '[SECRET]', ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let membership = try await teams.updateMembershipStatus( teamId: "[TEAM_ID]", membershipId: "[MEMBERSHIP_ID]", userId: "[USER_ID]", secret: "[SECRET]" )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.updateMembershipStatus( teamId = "[TEAM_ID]", membershipId = "[MEMBERSHIP_ID]", userId = "[USER_ID]", secret = "[SECRET]" )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.updateMembershipStatus( "[TEAM_ID]", "[MEMBERSHIP_ID]", "[USER_ID]", "[SECRET]" new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
mutation { teamsUpdateMembershipStatus( teamId: "[TEAM_ID]", membershipId: "[MEMBERSHIP_ID]", userId: "[USER_ID]", secret: "[SECRET]" ) { _id _createdAt _updatedAt userId userName userEmail teamId teamName invited joined confirm roles } }
-
PATCH /v1/teams/{teamId}/memberships/{membershipId}/status HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ... { "userId": "[USER_ID]", "secret": "[SECRET]" }
Delete Team Membership
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 it is not accepted.
HTTP Request
Name | Type | Description | |
teamId | required | string | Team ID. |
membershipId | required | string | Membership ID. |
HTTP Response
Status Code | Content Type | Payload |
204 No Content | - | - |
-
import { Client, Teams } from "appwrite"; const client = new Client(); const teams = new Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; const promise = teams.deleteMembership('[TEAM_ID]', '[MEMBERSHIP_ID]'); promise.then(function (response) { console.log(response); // Success }, function (error) { console.log(error); // Failure });
-
import 'package:appwrite/appwrite.dart'; void main() { // Init SDK Client client = Client(); Teams teams = Teams(client); client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID ; Future result = teams.deleteMembership( teamId: '[TEAM_ID]', membershipId: '[MEMBERSHIP_ID]', ); result .then((response) { print(response); }).catchError((error) { print(error.response); }); }
-
import Appwrite let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID let teams = Teams(client) let result = try await teams.deleteMembership( teamId: "[TEAM_ID]", membershipId: "[MEMBERSHIP_ID]" )
-
import io.appwrite.Client import io.appwrite.services.Teams val client = Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2") // Your project ID val teams = Teams(client) val response = teams.deleteMembership( teamId = "[TEAM_ID]", membershipId = "[MEMBERSHIP_ID]" )
-
import io.appwrite.Client; import io.appwrite.coroutines.CoroutineCallback; import io.appwrite.services.Teams; Client client = new Client(context) .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint .setProject("5df5acd0d48c2"); // Your project ID Teams teams = new Teams(client); teams.deleteMembership( "[TEAM_ID]", "[MEMBERSHIP_ID]" new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) );
-
mutation { teamsDeleteMembership( teamId: "[TEAM_ID]", membershipId: "[MEMBERSHIP_ID]" ) { status } }
-
DELETE /v1/teams/{teamId}/memberships/{membershipId} HTTP/1.1 Host: HOSTNAME Content-Type: application/json X-Appwrite-Response-Format: 1.0.0 X-Appwrite-Project: 5df5acd0d48c2 X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...