> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List the identity provider's groups

> List every group the identity provider has, to choose which to sync. They're
 read with the given settings, which needn't be saved yet, so groups can be
 chosen before the directory is first corrected. Fails with invalid argument
 when the settings are for another identity provider than the directory's,
 and with failed precondition and what to fix when the identity provider
 refuses them.



## OpenAPI

````yaml /docs/api/openapi/directory_sync_openapi.json post /core.v1.DirectorySyncService/ListDirectoryIdpGroups
openapi: 3.1.0
info:
  title: core.v1.DirectorySyncService
  version: 0.0.1
servers:
  - url: https://api.joinformal.com
    description: Production API
security: []
tags:
  - name: core.v1.DirectorySyncService
paths:
  /core.v1.DirectorySyncService/ListDirectoryIdpGroups:
    post:
      tags:
        - core.v1.DirectorySyncService
      summary: List the identity provider's groups
      description: >-
        List every group the identity provider has, to choose which to sync.
        They're
         read with the given settings, which needn't be saved yet, so groups can be
         chosen before the directory is first corrected. Fails with invalid argument
         when the settings are for another identity provider than the directory's,
         and with failed precondition and what to fix when the identity provider
         refuses them.
      operationId: core.v1.DirectorySyncService.ListDirectoryIdpGroups
      parameters:
        - name: Connect-Protocol-Version
          in: header
          schema:
            $ref: '#/components/schemas/connect-protocol-version'
        - name: Connect-Timeout-Ms
          in: header
          schema:
            $ref: '#/components/schemas/connect-timeout-header'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/core.v1.ListDirectoryIdpGroupsRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/core.v1.ListDirectoryIdpGroupsResponse'
        '400':
          description: Bad Request - Invalid request parameters or body
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: invalid_request
                  message:
                    type: string
                    example: Invalid request parameters
                  details:
                    type: object
        '401':
          description: Unauthorized - Missing or invalid authentication
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: unauthorized
                  message:
                    type: string
                    example: Authentication required
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: forbidden
                  message:
                    type: string
                    example: Insufficient permissions to perform this action
        '404':
          description: Not Found - Resource does not exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: not_found
                  message:
                    type: string
                    example: Resource not found
        '500':
          description: Internal Server Error - An error occurred processing the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: internal_error
                  message:
                    type: string
                    example: An internal error occurred
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/connect.error'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >-
            curl -X POST
            "https://api.joinformal.com/core.v1.DirectorySyncService/ListDirectoryIdpGroups"
            \
              -H "X-API-KEY: YOUR_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "example": "value"
              }'
        - lang: javascript
          label: JavaScript (fetch)
          source: >-
            fetch("https://api.joinformal.com/core.v1.DirectorySyncService/ListDirectoryIdpGroups",
            {
              method: "POST",
              headers: {
                "X-API-KEY": "YOUR_API_KEY",
                "Content-Type": "application/json"
              },
              body: JSON.stringify({
                example: "value"
              })
            })
              .then(response => response.json())
              .then(data => console.log(data))
              .catch(error => console.error(error));
        - lang: python
          label: Python
          source: >-
            import requests


            url =
            "https://api.joinformal.com/core.v1.DirectorySyncService/ListDirectoryIdpGroups"

            headers = {
                "X-API-KEY": "YOUR_API_KEY",
                "Content-Type": "application/json"
            }

            data = {
                "example": "value"
            }


            response = requests.post(url, headers=headers, json=data)

            print(response.json())
        - lang: go
          label: Go
          source: |-
            package main

            import (
                "bytes"
                "encoding/json"
                "fmt"
                "io"
                "net/http"
            )

            func main() {
                url := "https://api.joinformal.com/core.v1.DirectorySyncService/ListDirectoryIdpGroups"

                body := map[string]string{
                    "example": "value",
                }

                jsonData, _ := json.Marshal(body)

                req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
                req.Header.Set("X-API-KEY", "YOUR_API_KEY")
                req.Header.Set("Content-Type", "application/json")

                client := &http.Client{}
                resp, err := client.Do(req)
                if err != nil {
                    panic(err)
                }
                defer resp.Body.Close()

                responseBody, _ := io.ReadAll(resp.Body)
                fmt.Println(string(responseBody))
            }
components:
  schemas:
    connect-protocol-version:
      type: number
      title: Connect-Protocol-Version
      enum:
        - 1
      description: Define the version of the Connect protocol
      const: 1
    connect-timeout-header:
      type: number
      title: Connect-Timeout-Ms
      description: Define the timeout, in ms
    core.v1.ListDirectoryIdpGroupsRequest:
      type: object
      properties:
        directoryId:
          type: string
          title: directory_id
          minLength: 1
        googleWorkspace:
          $ref: '#/components/schemas/core.v1.GoogleWorkspaceConfig'
          title: google_workspace
          description: One of the discriminated union fields - use exactly one
      title: ListDirectoryIdpGroupsRequest
      additionalProperties: false
      description: 'Exactly one of these fields is required: google_workspace.'
    core.v1.ListDirectoryIdpGroupsResponse:
      type: object
      properties:
        groups:
          type: array
          items:
            $ref: '#/components/schemas/core.v1.DirectoryIdpGroup'
          title: groups
      title: ListDirectoryIdpGroupsResponse
      additionalProperties: false
    connect.error:
      type: object
      properties:
        code:
          type: string
          examples:
            - not_found
          enum:
            - canceled
            - unknown
            - invalid_argument
            - deadline_exceeded
            - not_found
            - already_exists
            - permission_denied
            - resource_exhausted
            - failed_precondition
            - aborted
            - out_of_range
            - unimplemented
            - internal
            - unavailable
            - data_loss
            - unauthenticated
          description: >-
            The status code, which should be an enum value of
            [google.rpc.Code][google.rpc.Code].
        message:
          type: string
          description: >-
            A developer-facing error message, which should be in English. Any
            user-facing error message should be localized and sent in the
            [google.rpc.Status.details][google.rpc.Status.details] field, or
            localized by the client.
        details:
          type: array
          items:
            $ref: '#/components/schemas/connect.error_details.Any'
          description: >-
            A list of messages that carry the error details. There is no limit
            on the number of messages.
      title: Connect Error
      additionalProperties: true
      description: >-
        Error type returned by Connect:
        https://connectrpc.com/docs/go/errors/#http-representation
    core.v1.GoogleWorkspaceConfig:
      type: object
      properties:
        serviceAccount:
          type: string
          title: service_account
          minLength: 1
        customerId:
          type: string
          title: customer_id
          minLength: 1
        groupIds:
          type: array
          items:
            type: string
          title: group_ids
      title: GoogleWorkspaceConfig
      additionalProperties: false
    core.v1.DirectoryIdpGroup:
      type: object
      properties:
        id:
          type: string
          title: id
        name:
          type: string
          title: name
        email:
          type: string
          title: email
      title: DirectoryIdpGroup
      additionalProperties: false
    connect.error_details.Any:
      type: object
      properties:
        type:
          type: string
          description: >-
            A URL that acts as a globally unique identifier for the type of the
            serialized message. For example:
            `type.googleapis.com/google.rpc.ErrorInfo`. This is used to
            determine the schema of the data in the `value` field and is the
            discriminator for the `debug` field.
        value:
          type: string
          format: binary
          description: >-
            The Protobuf message, serialized as bytes and base64-encoded. The
            specific message type is identified by the `type` field.
        debug:
          oneOf:
            - type: object
              title: Any
              additionalProperties: true
              description: Detailed error information.
          discriminator:
            propertyName: type
          title: Debug
          description: >-
            Deserialized error detail payload. The 'type' field indicates the
            schema. This field is for easier debugging and should not be relied
            upon for application logic.
      additionalProperties: true
      description: >-
        Contains an arbitrary serialized message along with a @type that
        describes the type of the serialized message, with an additional debug
        field for ConnectRPC error details.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API key authentication. Get your API key from the Control Plane.

````

## Related topics

- [Identities](https://docs.formal.ai/docs/guides/core-concepts/identities.md)
- [ListIntegrationsAIProvider](https://docs.formal.ai/api-reference/corev1integrationaiproviderservice/listintegrationsaiprovider.md)
- [Terraform Provider](https://docs.formal.ai/docs/changelog/terraform-provider.md)
- [Delete a directory's identity provider connection](https://docs.formal.ai/api-reference/corev1directorysyncservice/delete-a-directorys-identity-provider-connection.md)
- [List groups](https://docs.formal.ai/api-reference/corev1groupservice/list-groups.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.