---
updatedAt: 2026-04-23T05:40:30.000Z
---

# Merge duplicate users

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "API V1",
    "version": "v1"
  },
  "paths": {
    "/users/merge": {
      "post": {
        "summary": "Merge duplicate users",
        "tags": [
          "Users"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "users merged successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "primary_user_id": {
                      "type": "integer",
                      "description": "ID of the surviving user"
                    },
                    "merged_user_ids": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      },
                      "description": "IDs that were successfully merged"
                    },
                    "merged_count": {
                      "type": "integer",
                      "description": "Number of users merged"
                    },
                    "not_found_user_ids": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      },
                      "description": "IDs that were not found (only present if some IDs were missing)",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "user not found"
          },
          "422": {
            "description": "invalid parameters"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "primary_user_id": {
                    "type": "integer",
                    "description": "ID of the user to keep (the survivor). All data from duplicates will be merged into this user."
                  },
                  "user_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "IDs of the duplicate users to merge into the primary user. These users will be deactivated after merge. Also accepts a comma-separated string."
                  }
                },
                "required": [
                  "primary_user_id",
                  "user_ids"
                ],
                "example": {
                  "primary_user_id": 100,
                  "user_ids": [
                    101,
                    102,
                    103
                  ]
                }
              }
            }
          },
          "required": true,
          "description": "Merge parameters"
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.solidarity.tech/v1",
      "variables": {
        "defaultHost": {
          "default": "api.solidarity.tech/v1"
        }
      }
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
```