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

# Assign or unassign seats for multiple users

> Bulk assign or unassign seats for users in the organization. Supports up to 500 users per request. Rate limited to 10 requests per 60 seconds with max 3 concurrent requests per organization. Organization and self-hosted API keys identify users by provider user id (user_ids); workspace-scoped API tokens declaratively upsert members (members[]) identified by email or cr_user_id, reconciling each member's seat state and linked subscription_user accounts workspace-wide.



## OpenAPI

````yaml /openapi.json post /v1/users/seats
openapi: 3.0.3
info:
  title: CodeRabbit API spec
  version: 1.0.0
servers:
  - url: https://api.coderabbit.ai
security:
  - ApiKeyAuth: []
paths:
  /v1/users/seats:
    post:
      tags:
        - User Management
      summary: Assign or unassign seats for multiple users
      description: >-
        Bulk assign or unassign seats for users in the organization. Supports up
        to 500 users per request. Rate limited to 10 requests per 60 seconds
        with max 3 concurrent requests per organization. Organization and
        self-hosted API keys identify users by provider user id (user_ids);
        workspace-scoped API tokens declaratively upsert members (members[])
        identified by email or cr_user_id, reconciling each member's seat state
        and linked subscription_user accounts workspace-wide.
      operationId: manage-seats
      parameters:
        - in: header
          name: x-coderabbitai-api-key
          required: true
          schema:
            type: string
          description: API key for authentication
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  title: By provider user id (organization & self-hosted keys)
                  required:
                    - action
                    - user_ids
                  properties:
                    action:
                      type: string
                      enum:
                        - assign
                        - unassign
                      description: The action to perform on the seats
                      example: assign
                    user_ids:
                      type: array
                      minItems: 1
                      maxItems: 500
                      items:
                        type: string
                        minLength: 1
                        description: Provider user ID (Git provider's user identifier)
                      description: Array of user IDs to assign or unassign seats for
                      example:
                        - '121358802'
                        - '234567'
                - type: object
                  title: >-
                    By email or cr_user_id with account identities
                    (workspace-scoped tokens)
                  required:
                    - members
                  properties:
                    members:
                      type: array
                      minItems: 1
                      maxItems: 500
                      description: >-
                        Workspace-scoped API tokens declaratively upsert members
                        workspace-wide (no org_id). Each member is identified by
                        email or cr_user_id (at least one; cr_user_id takes
                        precedence and, unlike email, addresses unlinked members
                        that have no email). Each member's seat state and/or
                        linked accounts (subscription_user identities) are
                        reconciled; cr_user_external_accounts is not written by
                        this endpoint. Organization and self-hosted keys use the
                        user_ids form instead.
                      items:
                        type: object
                        description: >-
                          Provide email or cr_user_id (at least one). cr_user_id
                          takes precedence when both are given.
                        anyOf:
                          - required:
                              - email
                          - required:
                              - cr_user_id
                        properties:
                          email:
                            type: string
                            format: email
                            description: >-
                              Member identifier (cr_users.email, unique per
                              workspace). Resolve-or-create — the only
                              identifier that can create a member. Optional when
                              cr_user_id is provided.
                            example: jane@acme.com
                          cr_user_id:
                            type: string
                            format: uuid
                            description: >-
                              Member identifier (cr_users.id — the user_id
                              returned by GET /users). Addresses an existing
                              member directly, so it can manage unlinked members
                              that have no email. Never creates a member; an
                              unknown id fails that member with USER_NOT_FOUND.
                            example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
                          seat_assigned:
                            type: boolean
                            description: >-
                              Desired seat state. Omit to leave the current seat
                              state unchanged.
                            example: true
                          identities:
                            type: array
                            description: >-
                              Declarative account set for this member. Omit to
                              leave accounts untouched; [] removes all; a
                              present array replaces the member's full set of
                              linked subscription_user identities.
                            items:
                              type: object
                              required:
                                - provider
                                - user_id
                              properties:
                                provider:
                                  type: string
                                  description: Git provider (e.g., github, gitlab).
                                  example: github
                                self_hosted_instance_url:
                                  type: string
                                  description: >-
                                    Self-hosted instance URL, when the account
                                    is on a self-hosted instance.
                                  example: https://git.acme.com
                                user_id:
                                  type: string
                                  description: Provider user ID for this account.
                                  example: '121358802'
                                username:
                                  type: string
                                  description: Provider username for this account.
                                  example: janedoe
                                name:
                                  type: string
                                  description: Display name for this account.
                                  example: Jane Doe
      responses:
        '200':
          description: Seat management completed (partial or full success)
          headers:
            X-RateLimit-Limit:
              schema:
                type: integer
              description: Maximum requests allowed per time window (10)
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: Requests remaining in current window
            X-RateLimit-Reset:
              description: Unix timestamp when the rate limit resets
              schema:
                type: integer
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - succeeded
                  - failed
                properties:
                  status:
                    type: string
                    enum:
                      - success
                      - partial_success
                      - failure
                    description: >-
                      Status of the operation - "success" if all succeeded,
                      "partial_success" if some succeeded and some failed,
                      "failure" if all failed
                    example: success
                  succeeded:
                    type: array
                    items:
                      type: string
                    description: >-
                      Array of identifiers that were successfully processed
                      (echoes whichever identifier each member supplied -
                      provider user id, email, or cr_user_id)
                    example:
                      - '121358802'
                  failed:
                    type: array
                    items:
                      type: object
                      required:
                        - user_id
                        - code
                      properties:
                        user_id:
                          type: string
                          description: >-
                            The identifier that failed (echoes the supplied
                            provider user id, email, or cr_user_id)
                        code:
                          type: string
                          enum:
                            - USER_NOT_FOUND
                            - SEAT_NOT_AVAILABLE
                            - NO_ACTIVE_SUBSCRIPTION
                          description: Error code indicating the reason for failure
                    description: Array of failed users with error codes
                    example:
                      - user_id: '234567'
                        code: SEAT_NOT_AVAILABLE
        '400':
          description: Invalid request (validation error or batch size error)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - INVALID_REQUEST
                          - BATCH_SIZE_EXCEEDED
                        example: BATCH_SIZE_EXCEEDED
                      message:
                        type: string
                        example: Maximum 500 users per request
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - UNAUTHORIZED
                        example: UNAUTHORIZED
                      message:
                        type: string
                        example: Invalid or inactive API key
        '402':
          description: Payment Required - No active subscription
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - NO_ACTIVE_SUBSCRIPTION
                        example: NO_ACTIVE_SUBSCRIPTION
                      message:
                        type: string
                        example: No active subscription found for the organization
        '403':
          description: Forbidden - Not an admin or missing Enterprise plan
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - NOT_ADMIN
                          - ENTERPRISE_PLAN_REQUIRED
                        example: NOT_ADMIN
                      message:
                        type: string
                        example: >-
                          Only administrators can perform seat management
                          operations
        '410':
          description: >-
            Legacy API key - deprecated and no longer supported for user
            management
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - LEGACY_API_KEY
                        example: LEGACY_API_KEY
                      message:
                        type: string
                        example: >-
                          You are using a legacy API key. We are deprecating use
                          of legacy keys. Regenerate a new API key and retry the
                          request.
        '429':
          description: Rate limit exceeded or concurrency limit exceeded
          headers:
            Retry-After:
              description: Seconds to wait before retrying
              schema:
                type: integer
            X-RateLimit-Limit:
              description: Maximum requests allowed per time window
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Always 0 when rate limited
              schema:
                type: integer
            X-RateLimit-Reset:
              description: Unix timestamp when the rate limit resets
              schema:
                type: integer
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - RATE_LIMIT_EXCEEDED
                      message:
                        type: string
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - INTERNAL_ERROR
                        example: INTERNAL_ERROR
                      message:
                        type: string
                        example: Internal server error
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-coderabbitai-api-key
      description: >-
        API key for authentication. You can create an API key from the
        CodeRabbit dashboard.

````

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