1. Packages
  2. Packages
  3. Github Provider
  4. API Docs
  5. getOrganizationTeams
Viewing docs for GitHub v4.17.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
github logo
Viewing docs for GitHub v4.17.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Use this data source to retrieve information about all GitHub teams in an organization.

    Example Usage

    To retrieve

    using System.Collections.Generic;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var all = Github.GetOrganizationTeams.Invoke();
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v4/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := github.GetOrganizationTeams(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.GithubFunctions;
    import com.pulumi.github.inputs.GetOrganizationTeamsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var all = GithubFunctions.getOrganizationTeams();
    
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const all = pulumi.output(github.getOrganizationTeams());
    
    import pulumi
    import pulumi_github as github
    
    all = github.get_organization_teams()
    
    variables:
      all:
        Fn::Invoke:
          Function: github:getOrganizationTeams
          Arguments: {}
    

    To retrieve only the team's at the root of the organization

    using System.Collections.Generic;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var rootTeams = Github.GetOrganizationTeams.Invoke(new()
        {
            RootTeamsOnly = true,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v4/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := github.GetOrganizationTeams(ctx, &GetOrganizationTeamsArgs{
    			RootTeamsOnly: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.GithubFunctions;
    import com.pulumi.github.inputs.GetOrganizationTeamsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var rootTeams = GithubFunctions.getOrganizationTeams(GetOrganizationTeamsArgs.builder()
                .rootTeamsOnly(true)
                .build());
    
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const rootTeams = pulumi.output(github.getOrganizationTeams({
        rootTeamsOnly: true,
    }));
    
    import pulumi
    import pulumi_github as github
    
    root_teams = github.get_organization_teams(root_teams_only=True)
    
    variables:
      rootTeams:
        Fn::Invoke:
          Function: github:getOrganizationTeams
          Arguments:
            rootTeamsOnly: true
    

    Using getOrganizationTeams

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getOrganizationTeams(args: GetOrganizationTeamsArgs, opts?: InvokeOptions): Promise<GetOrganizationTeamsResult>
    function getOrganizationTeamsOutput(args: GetOrganizationTeamsOutputArgs, opts?: InvokeOptions): Output<GetOrganizationTeamsResult>
    def get_organization_teams(root_teams_only: Optional[bool] = None,
                               opts: Optional[InvokeOptions] = None) -> GetOrganizationTeamsResult
    def get_organization_teams_output(root_teams_only: Optional[pulumi.Input[bool]] = None,
                               opts: Optional[InvokeOptions] = None) -> Output[GetOrganizationTeamsResult]
    func GetOrganizationTeams(ctx *Context, args *GetOrganizationTeamsArgs, opts ...InvokeOption) (*GetOrganizationTeamsResult, error)
    func GetOrganizationTeamsOutput(ctx *Context, args *GetOrganizationTeamsOutputArgs, opts ...InvokeOption) GetOrganizationTeamsResultOutput

    > Note: This function is named GetOrganizationTeams in the Go SDK.

    public static class GetOrganizationTeams 
    {
        public static Task<GetOrganizationTeamsResult> InvokeAsync(GetOrganizationTeamsArgs args, InvokeOptions? opts = null)
        public static Output<GetOrganizationTeamsResult> Invoke(GetOrganizationTeamsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetOrganizationTeamsResult> getOrganizationTeams(GetOrganizationTeamsArgs args, InvokeOptions options)
    public static Output<GetOrganizationTeamsResult> getOrganizationTeams(GetOrganizationTeamsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: github:index/getOrganizationTeams:getOrganizationTeams
      arguments:
        # arguments dictionary

    The following arguments are supported:

    RootTeamsOnly bool
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
    RootTeamsOnly bool
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
    rootTeamsOnly Boolean
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
    rootTeamsOnly boolean
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
    root_teams_only bool
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
    rootTeamsOnly Boolean
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.

    getOrganizationTeams Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Teams List<GetOrganizationTeamsTeam>
    An Array of GitHub Teams. Each team block consists of the fields documented below.


    RootTeamsOnly bool
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
    Id string
    The provider-assigned unique ID for this managed resource.
    Teams []GetOrganizationTeamsTeam
    An Array of GitHub Teams. Each team block consists of the fields documented below.


    RootTeamsOnly bool
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
    id String
    The provider-assigned unique ID for this managed resource.
    teams List<GetOrganizationTeamsTeam>
    An Array of GitHub Teams. Each team block consists of the fields documented below.


    rootTeamsOnly Boolean
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
    id string
    The provider-assigned unique ID for this managed resource.
    teams GetOrganizationTeamsTeam[]
    An Array of GitHub Teams. Each team block consists of the fields documented below.


    rootTeamsOnly boolean
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
    id str
    The provider-assigned unique ID for this managed resource.
    teams Sequence[GetOrganizationTeamsTeam]
    An Array of GitHub Teams. Each team block consists of the fields documented below.


    root_teams_only bool
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.
    id String
    The provider-assigned unique ID for this managed resource.
    teams List<Property Map>
    An Array of GitHub Teams. Each team block consists of the fields documented below.


    rootTeamsOnly Boolean
    Only return teams that are at the organization's root, i.e. no nested teams. Defaults to false.

    Supporting Types

    GetOrganizationTeamsTeam

    Description string
    the team's description.
    Id int
    the ID of the team.
    Members List<string>
    List of team members.
    Name string
    the team's full name.
    NodeId string
    the Node ID of the team.
    Privacy string
    the team's privacy type.
    Repositories List<string>
    List of team repositories.
    Slug string
    the slug of the team.
    Description string
    the team's description.
    Id int
    the ID of the team.
    Members []string
    List of team members.
    Name string
    the team's full name.
    NodeId string
    the Node ID of the team.
    Privacy string
    the team's privacy type.
    Repositories []string
    List of team repositories.
    Slug string
    the slug of the team.
    description String
    the team's description.
    id Integer
    the ID of the team.
    members List<String>
    List of team members.
    name String
    the team's full name.
    nodeId String
    the Node ID of the team.
    privacy String
    the team's privacy type.
    repositories List<String>
    List of team repositories.
    slug String
    the slug of the team.
    description string
    the team's description.
    id number
    the ID of the team.
    members string[]
    List of team members.
    name string
    the team's full name.
    nodeId string
    the Node ID of the team.
    privacy string
    the team's privacy type.
    repositories string[]
    List of team repositories.
    slug string
    the slug of the team.
    description str
    the team's description.
    id int
    the ID of the team.
    members Sequence[str]
    List of team members.
    name str
    the team's full name.
    node_id str
    the Node ID of the team.
    privacy str
    the team's privacy type.
    repositories Sequence[str]
    List of team repositories.
    slug str
    the slug of the team.
    description String
    the team's description.
    id Number
    the ID of the team.
    members List<String>
    List of team members.
    name String
    the team's full name.
    nodeId String
    the Node ID of the team.
    privacy String
    the team's privacy type.
    repositories List<String>
    List of team repositories.
    slug String
    the slug of the team.

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the github Terraform Provider.
    github logo
    Viewing docs for GitHub v4.17.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.