Terminal Use Organizations API

The Organizations API from Terminal Use — 7 operation(s) for organizations.

OpenAPI Specification

terminal-use-organizations-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Sb0 Agent APIKeys Organizations API
  version: 0.1.0
tags:
- name: Organizations
paths:
  /v1/organizations:
    get:
      description: List all organizations the current user belongs to.
      operationId: organizations_list
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/OrganizationResponse'
                title: Response Organizations List
                type: array
          description: Successful Response
      summary: List User Organizations
      tags:
      - Organizations
  /v1/organizations/current:
    get:
      description: Get the current user's organization info.
      operationId: organizations_retrieve_current
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationResponse'
          description: Successful Response
      summary: Get Current Organization
      tags:
      - Organizations
  /v1/organizations/invitations:
    get:
      description: List pending invitations for the current organization.
      operationId: organizations_list_invitations
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/OrganizationInvitationResponse'
                title: Response Organizations List Invitations
                type: array
          description: Successful Response
      summary: List Organization Invitations
      tags:
      - Organizations
    post:
      description: Invite a user to the current organization. Idempotent for existing pending invites by email.
      operationId: organizations_create_invitation
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrganizationInvitationRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOrganizationInvitationResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      summary: Create Organization Invitation
      tags:
      - Organizations
  /v1/organizations/invitations/{invitation_id}:
    delete:
      description: Revoke a pending invitation in the current organization.
      operationId: organizations_revoke_invitation
      parameters:
      - in: path
        name: invitation_id
        required: true
        schema:
          title: Invitation Id
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationInvitationResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      summary: Revoke Organization Invitation
      tags:
      - Organizations
  /v1/organizations/invitations/{invitation_id}/resend:
    post:
      description: Resend a pending invitation in the current organization.
      operationId: organizations_resend_invitation
      parameters:
      - in: path
        name: invitation_id
        required: true
        schema:
          title: Invitation Id
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationInvitationResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      summary: Resend Organization Invitation
      tags:
      - Organizations
  /v1/organizations/members:
    get:
      description: List active members in the current organization.
      operationId: organizations_list_members
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/OrganizationMemberResponse'
                title: Response Organizations List Members
                type: array
          description: Successful Response
      summary: List Organization Members
      tags:
      - Organizations
  /v1/organizations/members/{membership_id}:
    delete:
      description: Remove an active member from the current organization.
      operationId: organizations_remove_member
      parameters:
      - in: path
        name: membership_id
        required: true
        schema:
          title: Membership Id
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      summary: Remove Organization Member
      tags:
      - Organizations
    put:
      description: Update a member role in the current organization.
      operationId: organizations_update_member
      parameters:
      - in: path
        name: membership_id
        required: true
        schema:
          title: Membership Id
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOrganizationMemberRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationMemberResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      summary: Update Organization Member
      tags:
      - Organizations
components:
  schemas:
    CreateOrganizationInvitationRequest:
      description: Request model for creating organization invitations.
      properties:
        email:
          description: Invitee email
          title: Email
          type: string
        role_slug:
          default: member
          description: Organization role slug for the invited member
          enum:
          - admin
          - member
          title: Role Slug
          type: string
      required:
      - email
      title: CreateOrganizationInvitationRequest
      type: object
    OrganizationMemberResponse:
      description: Response model for organization member details.
      properties:
        created_at:
          description: Membership created timestamp
          title: Created At
          type: string
        email:
          anyOf:
          - type: string
          - type: 'null'
          description: User email
          title: Email
        membership_id:
          description: The WorkOS organization membership ID
          title: Membership Id
          type: string
        name:
          anyOf:
          - type: string
          - type: 'null'
          description: User display name
          title: Name
        role_slug:
          description: Membership role slug
          title: Role Slug
          type: string
        status:
          description: Membership status
          title: Status
          type: string
        updated_at:
          description: Membership updated timestamp
          title: Updated At
          type: string
        user_id:
          description: The WorkOS user ID
          title: User Id
          type: string
      required:
      - membership_id
      - user_id
      - role_slug
      - status
      - created_at
      - updated_at
      title: OrganizationMemberResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
      - loc
      - msg
      - type
      title: ValidationError
      type: object
    DeleteResponse:
      properties:
        id:
          title: Id
          type: string
        message:
          title: Message
          type: string
      required:
      - id
      - message
      title: DeleteResponse
      type: object
    OrganizationResponse:
      description: Response model for organization info.
      properties:
        id:
          description: The WorkOS organization ID
          title: Id
          type: string
        name:
          anyOf:
          - type: string
          - type: 'null'
          description: Organization display name
          title: Name
        slug:
          anyOf:
          - type: string
          - type: 'null'
          description: Organization slug (URL-friendly)
          title: Slug
      required:
      - id
      title: OrganizationResponse
      type: object
    OrganizationInvitationResponse:
      description: Response model for organization invitation details.
      properties:
        accepted_user_id:
          anyOf:
          - type: string
          - type: 'null'
          description: Accepted WorkOS user ID
          title: Accepted User Id
        created_at:
          description: Invitation created timestamp
          title: Created At
          type: string
        email:
          description: Invitee email
          title: Email
          type: string
        expires_at:
          description: Invitation expiration timestamp
          title: Expires At
          type: string
        id:
          description: The WorkOS invitation ID
          title: Id
          type: string
        inviter_user_id:
          anyOf:
          - type: string
          - type: 'null'
          description: Inviter WorkOS user ID
          title: Inviter User Id
        role_slug:
          anyOf:
          - type: string
          - type: 'null'
          description: Invitation role slug
          title: Role Slug
        state:
          description: Invitation state
          title: State
          type: string
        updated_at:
          description: Invitation updated timestamp
          title: Updated At
          type: string
      required:
      - id
      - email
      - state
      - expires_at
      - created_at
      - updated_at
      title: OrganizationInvitationResponse
      type: object
    UpdateOrganizationMemberRequest:
      description: Request model for updating organization member role.
      properties:
        role_slug:
          description: Organization role slug for the target member
          enum:
          - admin
          - member
          title: Role Slug
          type: string
      required:
      - role_slug
      title: UpdateOrganizationMemberRequest
      type: object
    CreateOrganizationInvitationResponse:
      description: Response model for create invitation endpoint.
      properties:
        already_exists:
          default: false
          description: True when a pending invite already exists for this email
          title: Already Exists
          type: boolean
        invitation:
          $ref: '#/components/schemas/OrganizationInvitationResponse'
      required:
      - invitation
      title: CreateOrganizationInvitationResponse
      type: object
x-fern-idempotency-headers:
- header: Idempotency-Key
  name: idempotency_key