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

# Archive users bulk

> Archive users in bulk.

## Behavior

* **Transaction**: If one part of the payload is not parsable (or understandable
  by the system), we raise you an error and we don’t archive anyone from
  the payload. You have to fix your payload and send it to us again.
  And if the answer is a success, it means that every user to archive you sent
  us have been archived successfully
* **Conflict Rule and archive**: If you try to archive a user that is managing
  someone on the given archive period, we raise you an error.
* **Limit**: you can’t archive more than 50 users at a time.
* **Error behavior**: In case of any error, your user wont be archived


## OpenAPI

````yaml delete /v1/users/archive/bulk
openapi: 3.0.2
info:
  version: 1.0.0
  title: Qobra API
  description: API documentation for Qobra
servers:
  - url: https://api.qobra.co
    description: API
security: []
paths:
  /v1/users/archive/bulk:
    delete:
      tags:
        - public_api
        - v1
        - users
      summary: Archive users bulk
      description: Archive users in bulk.
      operationId: DELETE_/v1/users/archive/bulk
      requestBody:
        description: The body contains the user data necessary to archive a user in Qobra
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/DeleteManyInputModel_ArchiveUserDeleteBodyModel
            examples:
              archive-bulk-body:
                $ref: >-
                  #/components/examples/DeleteManyInputModel_ArchiveUserDeleteBodyModelExample
        required: true
      responses:
        '200':
          description: Success operation
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ArchiveUsersBulkDeleteSuccessModelResponse
              examples:
                archive-user-bulk-success:
                  $ref: >-
                    #/components/examples/ArchiveUsersBulkDeleteSuccessModelResponseExample
        '400':
          description: ClientError operation
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ArchiveUsersBulkDeleteClientErrorModelResponse
              examples:
                user-bulk-errors:
                  $ref: >-
                    #/components/examples/ArchiveUsersBulkDeleteClientErrorModelResponseExample
      security:
        - api_key: []
components:
  schemas:
    DeleteManyInputModel_ArchiveUserDeleteBodyModel:
      type: object
      properties:
        data:
          title: Data
          type: array
          items:
            $ref: '#/components/schemas/ArchiveUserDeleteBodyModel'
      required:
        - data
      title: DeleteManyInputModel[ArchiveUserDeleteBodyModel]
    ArchiveUsersBulkDeleteSuccessModelResponse:
      type: object
      properties:
        message:
          description: Confirmation message
          type: string
      required:
        - message
      title: ArchiveUsersBulkDeleteSuccessModelResponse
    ArchiveUsersBulkDeleteClientErrorModelResponse:
      type: object
      properties:
        count:
          description: Errors count
          type: integer
        errors:
          description: Array of errors
          type: array
          items:
            $ref: >-
              #/components/schemas/ArchiveUsersBulkDeleteClientErrorModelResponse
      required:
        - count
        - errors
      title: ArchiveUsersBulkDeleteClientErrorModelResponse
    ArchiveUserDeleteBodyModel:
      type: object
      properties:
        user:
          title: User
          type: string
          format: email
          description: Email of the user
        end_date:
          title: End Date
          type: string
          description: >-
            Archive date of the user. Not providing it will default to the end
            of the month of your api call
          format: date
      required:
        - user
      title: ArchiveUserDeleteBodyModel
  examples:
    DeleteManyInputModel_ArchiveUserDeleteBodyModelExample:
      value:
        data:
          - user: user-1@company.com
            end_date: 2023-10
          - user: user-2@company.com
          - ...
    ArchiveUsersBulkDeleteSuccessModelResponseExample:
      value:
        message: users archived successfully
    ArchiveUsersBulkDeleteClientErrorModelResponseExample:
      value:
        count: <Errors count>
        errors:
          - error: NotFoundError
            resource: user
            description: User not found for email john.doe@qobra.co
          - error: ValidationError
            resource: end_date
            description: Invalid date format, '2024-07-01' doesn't match the YYYY-MM format
  securitySchemes:
    api_key:
      type: apiKey
      name: X-API-Key
      in: header

````