> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.schoolset.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.schoolset.io/_mcp/server.

# Merge one family into another

POST https://ssuccessv2.com/app/api/v1/families/merge
Content-Type: application/json

Merges the source family into the target family using the selected profile, people, contracts, and payment records. The target family remains after a successful merge.

Reference: https://docs.schoolset.io/api-reference/school-set-api/families/merge-families

## Authentication

- `Authorization` header (bearer token, required) — The signed-in SchoolSet user token sent by the frontend.

## Request

### Body (application/json)

This endpoint expects an object.

- `target_family_student_id` (integer, required)
- `source_family_student_id` (integer, required)
- `profile_from` (enum, optional)
  - Allowed values: `target`, `source`
- `family_profile_field_sources` (map from string to enum, optional)
  - Allowed values: `target`, `source`
- `selection` (ApiV1FamiliesMergePostRequestBodyContentApplicationJsonSchemaSelection, optional)

## Response

### 200

Family merged successfully.

- `status` (string, required)
- `message` (string, required)
- `data` (ApiV1FamiliesMergePostResponsesContentApplicationJsonSchemaData, required)

## Errors

### 401 Unauthorized Error

Authentication required.

- `status` (string, required)
- `message` (string, required)
- `data` (any, optional, nullable)

### 403 Forbidden Error

The user cannot merge families.

- `status` (string, required)
- `message` (string, required)
- `data` (any, optional, nullable)

### 422 Unprocessable Entity Error

The merge plan is invalid.

- `message` (string, required)
- `errors` (map from string to list of string, required)

## Types

### ApiV1FamiliesMergePostRequestBodyContentApplicationJsonSchemaSelection

- `student_plans` (list of ApiV1FamiliesMergePostRequestBodyContentApplicationJsonSchemaSelectionStudentPlansItems, optional)
- `parent_ids` (list of integer, optional)
- `parent_plans` (list of map from string to any, optional)
- `relative_plans` (list of map from string to any, optional)
- `emergency_contact_plans` (list of map from string to any, optional)
- `contract_ids` (list of integer, optional)
- `wallet_ids` (list of integer, optional)
- `family_student_pay_ids` (list of integer, optional)
- `merchant_account_customer_ids` (list of integer, optional)
- `registration_session_ids` (list of integer, optional)
- `payment_ids` (list of integer, optional)
- `payment_plan_ids` (list of integer, optional)
- `pta_event_slot_family_ids` (list of integer, optional)
- `pta_event_slot_family_setting_ids` (list of integer, optional)
- `pta_event_slot_family_remove_ids` (list of integer, optional)
- `familystudentgable_links` (list of ApiV1FamiliesMergePostRequestBodyContentApplicationJsonSchemaSelectionFamilystudentgableLinksItems, optional)
- `emergency_contact_ids` (list of integer, optional)
- `family_address_ids` (list of integer, optional)
- `confirm_destructive_skip_student_ids` (list of integer, optional)
- `contract_profile_from` (map from string to enum, optional)
  - Allowed values: `target`, `source`
- `contract_batch_plans` (list of map from string to any, optional)

### ApiV1FamiliesMergePostResponsesContentApplicationJsonSchemaData

- `merge_uuid` (string, required)
- `merge_event_id` (integer, required)
- `target_family_student_id` (integer, required)
- `source_family_student_id` (integer, required)
- `family` (map from string to any, optional)

### ApiV1FamiliesMergePostRequestBodyContentApplicationJsonSchemaSelectionStudentPlansItems

- `source_student_id` (integer, required)
- `action` (enum, required)
  - Allowed values: `move`, `merge_into`, `skip`
- `target_student_id` (integer, optional, nullable)
- `field_sources` (map from string to enum, optional)
  - Allowed values: `target`, `source`
- `morph_addresses_from` (enum, optional, nullable)
  - Allowed values: `target`, `source`
- `immunization_from` (enum, optional, nullable)
  - Allowed values: `target`, `source`
- `grade_class_from` (enum, optional, nullable)
  - Allowed values: `target`, `source`

### ApiV1FamiliesMergePostRequestBodyContentApplicationJsonSchemaSelectionFamilystudentgableLinksItems

- `familystudentgable_id` (integer, required)
- `familystudentgable_type` (string, required)

## Examples

**Request**

```json
{
  "target_family_student_id": 1842,
  "source_family_student_id": 1976,
  "profile_from": "target",
  "selection": {
    "student_plans": [
      {
        "source_student_id": 3210,
        "action": "move"
      }
    ],
    "parent_ids": [
      4401
    ],
    "contract_ids": [
      812
    ]
  }
}
```

**Response**

```json
{
  "status": "success",
  "message": "Families merged successfully.",
  "data": {
    "merge_uuid": "4f1e6f8f-0ac9-4d8d-a2d3-6d0d02b8b1a0",
    "merge_event_id": 72,
    "target_family_student_id": 1842,
    "source_family_student_id": 1976,
    "family": {
      "id": 1842,
      "name": "Garcia Family"
    }
  }
}
```

**SDK Code**

```python Families_mergeFamilies_example
import requests

url = "https://ssuccessv2.com/app/api/v1/families/merge"

payload = {
    "target_family_student_id": 1842,
    "source_family_student_id": 1976,
    "profile_from": "target",
    "selection": {
        "student_plans": [
            {
                "source_student_id": 3210,
                "action": "move"
            }
        ],
        "parent_ids": [4401],
        "contract_ids": [812]
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Families_mergeFamilies_example
const url = 'https://ssuccessv2.com/app/api/v1/families/merge';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"target_family_student_id":1842,"source_family_student_id":1976,"profile_from":"target","selection":{"student_plans":[{"source_student_id":3210,"action":"move"}],"parent_ids":[4401],"contract_ids":[812]}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Families_mergeFamilies_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://ssuccessv2.com/app/api/v1/families/merge"

	payload := strings.NewReader("{\n  \"target_family_student_id\": 1842,\n  \"source_family_student_id\": 1976,\n  \"profile_from\": \"target\",\n  \"selection\": {\n    \"student_plans\": [\n      {\n        \"source_student_id\": 3210,\n        \"action\": \"move\"\n      }\n    ],\n    \"parent_ids\": [\n      4401\n    ],\n    \"contract_ids\": [\n      812\n    ]\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Families_mergeFamilies_example
require 'uri'
require 'net/http'

url = URI("https://ssuccessv2.com/app/api/v1/families/merge")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"target_family_student_id\": 1842,\n  \"source_family_student_id\": 1976,\n  \"profile_from\": \"target\",\n  \"selection\": {\n    \"student_plans\": [\n      {\n        \"source_student_id\": 3210,\n        \"action\": \"move\"\n      }\n    ],\n    \"parent_ids\": [\n      4401\n    ],\n    \"contract_ids\": [\n      812\n    ]\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Families_mergeFamilies_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://ssuccessv2.com/app/api/v1/families/merge")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"target_family_student_id\": 1842,\n  \"source_family_student_id\": 1976,\n  \"profile_from\": \"target\",\n  \"selection\": {\n    \"student_plans\": [\n      {\n        \"source_student_id\": 3210,\n        \"action\": \"move\"\n      }\n    ],\n    \"parent_ids\": [\n      4401\n    ],\n    \"contract_ids\": [\n      812\n    ]\n  }\n}")
  .asString();
```

```php Families_mergeFamilies_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://ssuccessv2.com/app/api/v1/families/merge', [
  'body' => '{
  "target_family_student_id": 1842,
  "source_family_student_id": 1976,
  "profile_from": "target",
  "selection": {
    "student_plans": [
      {
        "source_student_id": 3210,
        "action": "move"
      }
    ],
    "parent_ids": [
      4401
    ],
    "contract_ids": [
      812
    ]
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Families_mergeFamilies_example
using RestSharp;

var client = new RestClient("https://ssuccessv2.com/app/api/v1/families/merge");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"target_family_student_id\": 1842,\n  \"source_family_student_id\": 1976,\n  \"profile_from\": \"target\",\n  \"selection\": {\n    \"student_plans\": [\n      {\n        \"source_student_id\": 3210,\n        \"action\": \"move\"\n      }\n    ],\n    \"parent_ids\": [\n      4401\n    ],\n    \"contract_ids\": [\n      812\n    ]\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Families_mergeFamilies_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "target_family_student_id": 1842,
  "source_family_student_id": 1976,
  "profile_from": "target",
  "selection": [
    "student_plans": [
      [
        "source_student_id": 3210,
        "action": "move"
      ]
    ],
    "parent_ids": [4401],
    "contract_ids": [812]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://ssuccessv2.com/app/api/v1/families/merge")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```