WorkOS directory-groups API

Manage directory groups.

OpenAPI Specification

workos-directory-groups-api-openapi.yml Raw ↑
openapi: 3.1.1
info:
  title: WorkOS admin-portal directory-groups API
  description: WorkOS REST API
  version: '1.0'
  contact:
    name: WorkOS
    url: https://workos.com
    email: support@workos.com
  license:
    name: MIT
    url: https://opensource.org/license/MIT
servers:
- url: https://api.workos.com
  description: Production
- url: https://api.workos-test.com
  description: Staging
security:
- bearer: []
tags:
- name: directory-groups
  description: Manage directory groups.
  x-displayName: Directory Groups
paths:
  /directory_groups:
    get:
      description: Get a list of all of existing directory groups matching the criteria specified.
      operationId: DirectoryGroupsController_list
      parameters:
      - name: before
        required: false
        in: query
        description: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
        schema:
          example: xxx_01HXYZ123456789ABCDEFGHIJ
          type: string
      - name: after
        required: false
        in: query
        description: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
        schema:
          example: xxx_01HXYZ987654321KJIHGFEDCBA
          type: string
      - name: limit
        required: false
        in: query
        description: Upper limit on the number of objects to return, between `1` and `100`.
        schema:
          minimum: 1
          maximum: 100
          default: 10
          example: 10
          type: integer
      - name: order
        required: false
        in: query
        description: Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending.
        schema:
          $ref: '#/components/schemas/PaginationOrder'
      - name: directory
        required: false
        in: query
        description: Unique identifier of the WorkOS Directory. This value can be obtained from the WorkOS dashboard or from the WorkOS API.
        schema:
          example: directory_01ECAZ4NV9QMV47GW873HDCX74
          type: string
      - name: user
        required: false
        in: query
        description: Unique identifier of the WorkOS Directory User. This value can be obtained from the WorkOS API.
        schema:
          example: directory_user_01E1JG7J09H96KYP8HM9B0G5SJ
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DirectoryGroupList'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error.
                    example: 'Organization not found: ''org_01EHQMYV6MBK39QC5PZXHY59C3''.'
                required:
                - message
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error.
                    example: 'Organization not found: ''org_01EHQMYV6MBK39QC5PZXHY59C3''.'
                required:
                - message
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error.
                    example: 'Organization not found: ''org_01EHQMYV6MBK39QC5PZXHY59C3''.'
                required:
                - message
      summary: List Directory Groups
      tags:
      - directory-groups
  /directory_groups/{id}:
    get:
      description: Get the details of an existing Directory Group.
      operationId: DirectoryGroupsController_find
      parameters:
      - name: id
        required: true
        in: path
        description: Unique identifier for the Directory Group.
        schema:
          example: directory_group_01E1JJS84MFPPQ3G655FHTKX6Z
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DirectoryGroup'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error.
                    example: 'Organization not found: ''org_01EHQMYV6MBK39QC5PZXHY59C3''.'
                required:
                - message
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A human-readable description of the error.
                    example: 'Organization not found: ''org_01EHQMYV6MBK39QC5PZXHY59C3''.'
                required:
                - message
      summary: Get a Directory Group
      tags:
      - directory-groups
components:
  schemas:
    DirectoryGroup:
      type: object
      properties:
        object:
          type: string
          description: Distinguishes the Directory Group object.
          const: directory_group
        id:
          type: string
          description: Unique identifier for the Directory Group.
          example: directory_group_01E1JJS84MFPPQ3G655FHTKX6Z
        idp_id:
          type: string
          description: Unique identifier for the group, assigned by the Directory Provider. Different Directory Providers use different ID formats.
          example: 02grqrue4294w24
        directory_id:
          type: string
          description: The identifier of the Directory the Directory Group belongs to.
          example: directory_01ECAZ4NV9QMV47GW873HDCX74
        organization_id:
          type: string
          description: The identifier for the Organization in which the Directory resides.
          example: org_01EZTR6WYX1A0DSE2CYMGXQ24Y
        name:
          type: string
          description: The name of the Directory Group.
          example: Developers
        raw_attributes:
          type: object
          additionalProperties: {}
          description: The raw attributes received from the directory provider.
        created_at:
          format: date-time
          type: string
          description: An ISO 8601 timestamp.
          example: '2026-01-15T12:00:00.000Z'
        updated_at:
          format: date-time
          type: string
          description: An ISO 8601 timestamp.
          example: '2026-01-15T12:00:00.000Z'
      required:
      - object
      - id
      - idp_id
      - directory_id
      - organization_id
      - name
      - created_at
      - updated_at
    PaginationOrder:
      type: string
      enum:
      - normal
      - desc
      - asc
      example: desc
      default: desc
    DirectoryGroupList:
      type: object
      properties:
        object:
          type: string
          description: Indicates this is a list response.
          const: list
        data:
          type: array
          items:
            $ref: '#/components/schemas/DirectoryGroup'
          description: The list of records for the current page.
        list_metadata:
          type: object
          properties:
            before:
              type:
              - string
              - 'null'
              description: An object ID that defines your place in the list. When the ID is not present, you are at the start of the list.
              example: directory_group_01HXYZ123456789ABCDEFGHIJ
            after:
              type:
              - string
              - 'null'
              description: An object ID that defines your place in the list. When the ID is not present, you are at the end of the list.
              example: directory_group_01HXYZ987654321KJIHGFEDCBA
          required:
          - before
          - after
          description: Pagination cursors for navigating between pages of results.
      required:
      - object
      - data
      - list_metadata
      - list_metadata
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: 'Your WorkOS API key prefixed with `sk_`. Pass it as a Bearer token: `Authorization: Bearer sk_example_123456789`.'
    access_token:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: An SSO access token returned from the Get a Profile and Token endpoint.