Returns a list of teams. Can be filtered on team name or team type.

View interactive version here

Request Parameters

Parameter Required Type Description
entryCount No number The number of teams to return in a page (default=50)
offset No number The offset (page number) to start from (default=0)
teamNameFilter No string An optional filter to return teams with a matching name
teamTypeFilter No string An optional filter to return teams of a particular type

Response Parameters

A response containing the list of teams for a game.

Parameter Type Description
scriptData ScriptData A JSON Map of any data added either to the Request or the Response by your Cloud Code
teams Team[] A list of JSON objects containing team information

Nested types


A collection of arbitrary data that can be added to a message via a Cloud Code script.

Parameter Type Description
myKey string An arbitrary data key
myValue JSON An arbitrary data value.


A nested object that represents a player.

Parameter Type Description
achievements string[] The achievements of the Player
displayName string The display name of the Player
externalIds JSON The external Id's of the Player
id string The Id of the Player
online boolean The online status of the Player
scriptData JSON The script data of the Player
virtualGoods string[] The virtual goods of the Player


A nested object that represents the team. This object does not contain a list of the members.

Parameter Type Description
owner Player A summary of the owner
teamId string The Id of the team
teamName string The team name
teamType string The team type

Error Codes

Key Value Description
authentication NOTAUTHORIZED The player is not authorized to perform the request

Code Samples


    using GameSparks.Api;
    using GameSparks.Api.Requests;
    using GameSparks.Api.Responses;
    new ListTeamsRequest()
        .Send((response) => {
        GSData scriptData = response.ScriptData;
        GSEnumerable<ListTeamsResponse._Team> teams = response.Teams;

ActionScript 3

    import com.gamesparks.*;
    import com.gamesparks.api.requests.*;
    import com.gamesparks.api.responses.*;
    import com.gamesparks.api.types.*;

        .send(function(response:com.gamesparks.api.responses.ListTeamsResponse):void {
        var scriptData:ScriptData = response.getScriptData(); 
        var teams:Vector.<Team> = response.getTeams(); 


    #import "GS.h"
    #import "GSAPI.h"
    GSListTeamsRequest* request = [[GSListTeamsRequest alloc] init];
    [request setEntryCount:entryCount;
    [request setOffset:offset;
    [request setTeamNameFilter:teamNameFilter;
    [request setTeamTypeFilter:teamTypeFilter;
    [request setCallback:^ (GSListTeamsResponse* response) {
    NSDictionary* scriptData = [response getScriptData]; 
    NSArray* teams = [response getTeams]; 
    [gs send:request];


    #include <GameSparks/generated/GSRequests.h>
    using namespace GameSparks::Core;
    using namespace GameSparks::Api::Responses;
    using namespace GameSparks::Api::Requests;

    void ListTeamsRequest_Response(GS& gsInstance, const ListTeamsResponse& response) {
    GSData scriptData = response.getScriptData(); 
    gsstl:vector<Types::Team*> teams = response.getTeams(); 

    ListTeamsRequest request(gsInstance);


import com.gamesparks.sdk.api.autogen.GSRequestBuilder.ListTeamsRequest;
import com.gamesparks.sdk.api.autogen.GSResponseBuilder.ListTeamsResponse;
import com.gamesparks.sdk.api.autogen.GSTypes.*;
import com.gamesparks.sdk.api.GSEventListener;

    .send(new GSEventListener<ListTeamsResponse>() {
        public void onEvent(ListTeamsResponse response) {
            List<Team> teams = response.getTeams(); 

Cloud Code

    var request = new SparkRequests.ListTeamsRequest();
    request.entryCount = ...;
    request.offset = ...;
    request.teamNameFilter = ...;
    request.teamTypeFilter = ...;
    var response = request.Send();

var scriptData = response.scriptData; 
var teams = response.teams;