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

# Step 2 Remove users (passkey or wallet)

> Remove users from a Byzantine account, with the authorization issued by `get-remove-users-payload`.

A Turnkey account sends the stamped `bodyToSign` (`signedBody` + `webAuthnStamp`). The passkey that produced the
stamp must be registered to a `root` member of the account, who is the remover: the users are deleted from the
Turnkey sub-organization, then from the account. A self-custodial account sends the same user IDs and chain as
the payload request plus the wallet signature of its `typedData` (`accountId`, `userIds`, `walletSignature`,
`issuedAt`).

Whatever the account, a `root` user cannot be removed (demote them first), and the account's KYC subject or an
entity's beneficiaries keep their membership with the `beneficiary` role: only their access is revoked (Turnkey
user, passkeys, OTP sessions). A pending invitation of a removed user is cancelled; an accepted one is history
and stays.



## OpenAPI

````yaml /api-reference/openapi-integrator.json post /v1/submit/remove-users
openapi: 3.0.3
info:
  title: Byzantine Integrator API
  description: Byzantine REST API for integrators.
  license:
    name: ''
  version: 0.2.0
servers:
  - url: https://api.byzantine.fi
    description: Prod deployment
security: []
tags:
  - name: API health
    description: Check API status.
  - name: Customer management
    description: Endpoints to create, update, and retrieve customer information.
  - name: Account management
    description: Endpoints to manage accounts, bank accounts, invitations, and user roles.
  - name: Products
    description: Endpoints to get data about products and vaults.
  - name: Transactions
    description: Endpoints to create and manage transactions.
  - name: OTP authentication
    description: Endpoints to initialize and manage user authentication with OTP.
  - name: Events
    description: Endpoints to list lifecycle events.
  - name: Webhooks
    description: Integrator-managed outbound webhook subscriptions and delivery history.
  - name: Integrator key management
    description: >-
      Endpoints to inspect the current integrator credential scope, create,
      update and delete integrator keys.
paths:
  /v1/submit/remove-users:
    post:
      tags:
        - Account management
      summary: Step 2 Remove users (passkey or wallet)
      description: >-
        Remove users from a Byzantine account, with the authorization issued by
        `get-remove-users-payload`.


        A Turnkey account sends the stamped `bodyToSign` (`signedBody` +
        `webAuthnStamp`). The passkey that produced the

        stamp must be registered to a `root` member of the account, who is the
        remover: the users are deleted from the

        Turnkey sub-organization, then from the account. A self-custodial
        account sends the same user IDs and chain as

        the payload request plus the wallet signature of its `typedData`
        (`accountId`, `userIds`, `walletSignature`,

        `issuedAt`).


        Whatever the account, a `root` user cannot be removed (demote them
        first), and the account's KYC subject or an

        entity's beneficiaries keep their membership with the `beneficiary`
        role: only their access is revoked (Turnkey

        user, passkeys, OTP sessions). A pending invitation of a removed user is
        cancelled; an accepted one is history

        and stays.
      operationId: remove_users
      parameters:
        - name: X-Pubkey
          in: header
          description: >-
            Integrator's ECDSA public key (P-256 curve, compressed SEC1 format).
            Example:
            0x038fedef7c12f93bbf342ad8943b7a825a3b41f61c9dc118b2c718efebabbf62fd
          required: true
          schema:
            type: string
        - name: X-Timestamp
          in: header
          description: >-
            Unix timestamp in seconds (UTC). Must be within tolerance window (1
            minute) to prevent replay attacks. Example: 1760375826
          required: true
          schema:
            type: string
        - name: X-Signature
          in: header
          description: >-
            ECDSA signature (DER-encoded, hex with 0x prefix). Signs the
            message: `{timestamp}{METHOD}{path_and_query}{json_body}`. Example:
            0x3045022100...
          required: true
          schema:
            type: string
        - name: chain_id
          in: query
          description: >-
            Chain ID the payload was requested for (1 for Ethereum, 8453 for
            Base). Defaults to 1. Only used by self-custodial accounts
          required: false
          schema:
            type: integer
            format: int32
            nullable: true
            minimum: 0
      requestBody:
        description: The authorization to remove users from an existing account
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RemoveUsersRequestBody'
        required: true
      responses:
        '200':
          description: Users removed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RemoveUsersResponse'
        '400':
          description: >-
            Invalid request payload, invalid chain ID, user not in the account,
            root user or beneficiary without access, last member of a
            self-custodial account, or authorization kind not matching the
            account
        '401':
          description: Unauthorized - Invalid credential or signature
        '403':
          description: >-
            Forbidden - the stamp is not from a root user of the account, or the
            signature does not authorize this removal
        '404':
          description: Account not found
        '500':
          description: Internal server error
      security:
        - integrator_auth: []
components:
  schemas:
    RemoveUsersRequestBody:
      oneOf:
        - type: object
          description: >-
            Turnkey account: the `bodyToSign` returned by
            `get-remove-users-payload`, stamped with a root user's passkey
          required:
            - signedBody
            - webAuthnStamp
          properties:
            signedBody:
              $ref: '#/components/schemas/DeleteUsersRequest'
            webAuthnStamp:
              type: string
              description: >-
                Cryptographically passkey signed (stamped). For more info, see
                [authentication
                methods](https://docs.byzantine.fi/api-reference/authentication-methods).
        - type: object
          description: >-
            Self-custodial account: the user IDs sent to
            `get-remove-users-payload`, and the wallet signature of its
            `typedData`
          required:
            - accountId
            - userIds
            - walletSignature
            - issuedAt
          properties:
            accountId:
              $ref: '#/components/schemas/Uuid'
            userIds:
              type: array
              items:
                $ref: '#/components/schemas/Uuid'
              description: >-
                The user IDs sent to `get-remove-users-payload`, unchanged and
                in the same order.
            walletSignature:
              type: string
              description: >-
                Hex-encoded signature of the `typedData` by the account wallet
                (`eth_signTypedData_v4`).
              example: 0x1b2c...
            issuedAt:
              type: integer
              format: int64
              description: The `issuedAt` returned with the `typedData` (unix seconds).
              example: 1700000000
              minimum: 0
      description: >-
        Request body of `remove-users`: the authorization issued by
        `get-remove-users-payload`, matching the account kind.


        No `removedBy` is sent: a Turnkey account's remover is the root user
        whose passkey produced the stamp, and a

        self-custodial account acts through its wallet.
    RemoveUsersResponse:
      type: object
      description: Response body when users are removed from a Byzantine account
      required:
        - accountId
        - removedUsers
        - removedAt
      properties:
        accountId:
          $ref: '#/components/schemas/Uuid'
        removedUsers:
          type: array
          items:
            $ref: '#/components/schemas/RemovedUser'
        removedBy:
          allOf:
            - $ref: '#/components/schemas/Uuid'
          nullable: true
        removedAt:
          type: string
          format: date-time
          description: The timestamp of the removal.
    DeleteUsersRequest:
      type: object
      description: >-
        The object that needs to be signed by a root user to delete users from a
        Byzantine account's sub-organization.
      required:
        - type
        - timestampMs
        - organizationId
        - parameters
      properties:
        type:
          type: string
          description: Defaults to `ACTIVITY_TYPE_DELETE_USERS`
          example: ACTIVITY_TYPE_DELETE_USERS
        timestampMs:
          type: string
          description: UNIX timestamp of the creation of the request.
        organizationId:
          type: string
          description: The account ID (sub-organization ID) the users are removed from.
          example: d107c1e1-766a-4091-802c-de61a3973e91
        parameters:
          $ref: '#/components/schemas/DeleteUsersParams'
    Uuid:
      type: string
      format: uuid
      description: A UUID string
      example: 550e8400-e29b-41d4-a716-446655440000
    RemovedUser:
      type: object
      description: One removed user and what happened to their membership
      required:
        - userId
        - outcome
      properties:
        userId:
          $ref: '#/components/schemas/Uuid'
        outcome:
          $ref: '#/components/schemas/RemovalOutcome'
    DeleteUsersParams:
      type: object
      description: The Turnkey user IDs to delete.
      required:
        - userIds
      properties:
        userIds:
          type: array
          items:
            type: string
    RemovalOutcome:
      type: string
      description: What a removal did to the user's membership
      enum:
        - removed
        - access_revoked
      example: removed
  securitySchemes:
    integrator_auth:
      type: apiKey
      in: header
      name: X-Pubkey, X-Timestamp, X-Signature

````

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