WorkOS directories API

Manage directories.

OpenAPI Specification

workos-directories-api-openapi.yml Raw ↑
openapi: 3.1.1
info:
  title: WorkOS admin-portal directories 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: directories
  description: Manage directories.
  x-displayName: Directories
paths:
  /directories:
    get:
      description: Get a list of all of your existing directories matching the criteria specified.
      operationId: DirectoriesController_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.
        schema:
          example: obj_1234567890
          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.
        schema:
          example: obj_1234567890
          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.
        schema:
          $ref: '#/components/schemas/PaginationOrder'
      - name: organization_id
        required: false
        in: query
        description: Filter Directories by their associated organization.
        schema:
          example: org_01EHZNVPK3SFK441A1RGBFSHRT
          type: string
      - name: search
        required: false
        in: query
        description: Searchable text to match against Directory names.
        schema:
          example: Foo Corp
          type: string
      - name: domain
        required: false
        in: query
        description: Filter Directories by their associated domain.
        deprecated: true
        schema:
          example: foo-corp.com
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DirectoryList'
        '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
        '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 Directories
      tags:
      - directories
  /directories/{id}:
    get:
      description: Get the details of an existing directory.
      operationId: DirectoriesController_find
      parameters:
      - name: id
        required: true
        in: path
        description: Unique identifier for the Directory.
        schema:
          example: directory_01ECAZ4NV9QMV47GW873HDCX74
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Directory'
        '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
      tags:
      - directories
    delete:
      description: Permanently deletes an existing directory. It cannot be undone.
      operationId: DirectoriesController_deleteDirectory
      parameters:
      - name: id
        required: true
        in: path
        description: Unique identifier for the Directory.
        schema:
          example: directory_01ECAZ4NV9QMV47GW873HDCX74
          type: string
      responses:
        '200':
          description: OK
        '202':
          description: ''
          content:
            application/json:
              schema: {}
        '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
      summary: Delete a Directory
      tags:
      - directories
components:
  schemas:
    PaginationOrder:
      type: string
      enum:
      - normal
      - desc
      - asc
      example: desc
      default: desc
    Directory:
      type: object
      properties:
        object:
          type: string
          description: Distinguishes the Directory object.
          const: directory
        id:
          type: string
          description: Unique identifier for the Directory.
          example: directory_01ECAZ4NV9QMV47GW873HDCX74
        organization_id:
          type: string
          description: The unique identifier for the Organization in which the directory resides.
          example: org_01EHZNVPK3SFK441A1RGBFSHRT
        external_key:
          type: string
          description: External Key for the Directory.
          example: sPa12dwRQ
        type:
          description: The type of external Directory Provider integrated with.
          example: gsuite directory
          type: string
          enum:
          - azure scim v2.0
          - bamboohr
          - breathe hr
          - cezanne hr
          - cyberark scim v2.0
          - fourth hr
          - generic scim v2.0
          - gsuite directory
          - hibob
          - sailpoint scim v2.0
          - jump cloud scim v2.0
          - okta scim v2.0
          - onelogin scim v2.0
          - people hr
          - personio
          - pingfederate scim v2.0
          - rippling scim v2.0
          - s3
          - sftp
          - sftp workday
          - workday
        state:
          description: Describes whether the Directory has been successfully connected to an external provider.
          example: linked
          type: string
          enum:
          - linked
          - validating
          - invalid_credentials
          - unlinked
          - deleting
        name:
          type: string
          description: The name of the directory.
          example: Foo Corp
        domain:
          type: string
          description: The URL associated with an Enterprise Client.
          example: foo-corp.com
        metadata:
          type: object
          properties:
            users:
              type: object
              properties:
                active:
                  type: integer
                  description: Count of active directory users.
                  example: 42
                inactive:
                  type: integer
                  description: Count of inactive directory users.
                  example: 3
              required:
              - active
              - inactive
              description: Counts of active and inactive directory users.
            groups:
              type: integer
              description: Count of directory groups.
              example: 5
          required:
          - users
          - groups
          description: Aggregate counts of directory users and groups synced from the 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
      - organization_id
      - external_key
      - type
      - state
      - name
      - created_at
      - updated_at
    DirectoryList:
      type: object
      properties:
        object:
          type: string
          description: Indicates this is a list response.
          const: list
        data:
          type: array
          items:
            $ref: '#/components/schemas/Directory'
          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_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_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.