> 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.

# Create family contracts for an academic year

POST https://ssuccessv2.com/app/api/v2/school/structure/generator/contract/creation-contracts
Content-Type: multipart/form-data

Checks, adds, or replaces family contracts from fee-plan assignments for the selected academic year and optional registration phase.

Reference: https://docs.schoolset.io/api-reference/school-set-api/contracts/create-family-contracts-for-academic-year

## Authentication

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

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form.

- `actions` (enum, required)
- `academic_year` (integer, required)
- `registration_phase_id` (integer, optional)
- `data` (list of ApiV2SchoolStructureGeneratorContractCreationContractsPostRequestBodyContentMultipartFormDataSchemaDataItems, required)

## Response

### 200

Contract generation completed and the service result is returned.

- `status` (string, optional)
- `message` (string, optional)
- `data` (map from string to any, optional)

## Errors

### 401 Unauthorized Error

Authentication is required to generate family contracts.

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

### 403 Forbidden Error

The authenticated user cannot edit school settings.

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

### 404 Not Found Error

The requested academic year was not found.

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

### 422 Unprocessable Entity Error

Contract generation data failed the required validation rules.

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

## Examples

**Request**

```json
{
  "actions": "add",
  "academic_year": 2026,
  "data": [
    {
      "contract_fees_type_id": 4,
      "due_date": {},
      "amount": 12000,
      "fees_plan": [
        {
          "date": {},
          "amount": 1200
        }
      ],
      "applied_to": {
        "id": 101,
        "full_name": "Jordan Smith",
        "type": "student"
      }
    }
  ]
}
```

**Response**

```json
{
  "status": "success",
  "message": "Created successfully",
  "data": {
    "created": 12,
    "skipped": 0
  }
}
```

**SDK Code**

```python
import requests

url = "https://ssuccessv2.com/app/api/v2/school/structure/generator/contract/creation-contracts"

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"actions\"\r\n\r\nadd\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"academic_year\"\r\n\r\n2026\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"registration_phase_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n[\n  {\n    \"contract_fees_type_id\": 4,\n    \"due_date\": {},\n    \"amount\": 12000,\n    \"fees_plan\": [\n      {\n        \"date\": {},\n        \"amount\": 1200\n      }\n    ],\n    \"applied_to\": {\n      \"id\": 101,\n      \"full_name\": \"Jordan Smith\",\n      \"type\": \"student\"\n    }\n  }\n]\r\n-----011000010111000001101001--\r\n"
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "multipart/form-data; boundary=---011000010111000001101001"
}

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

print(response.json())
```

```javascript
const url = 'https://ssuccessv2.com/app/api/v2/school/structure/generator/contract/creation-contracts';
const form = new FormData();
form.append('actions', 'add');
form.append('academic_year', '2026');
form.append('registration_phase_id', '');
form.append('data', '[
  {
    "contract_fees_type_id": 4,
    "due_date": {},
    "amount": 12000,
    "fees_plan": [
      {
        "date": {},
        "amount": 1200
      }
    ],
    "applied_to": {
      "id": 101,
      "full_name": "Jordan Smith",
      "type": "student"
    }
  }
]');

const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

options.body = form;

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

```go
package main

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

func main() {

	url := "https://ssuccessv2.com/app/api/v2/school/structure/generator/contract/creation-contracts"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"actions\"\r\n\r\nadd\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"academic_year\"\r\n\r\n2026\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"registration_phase_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n[\n  {\n    \"contract_fees_type_id\": 4,\n    \"due_date\": {},\n    \"amount\": 12000,\n    \"fees_plan\": [\n      {\n        \"date\": {},\n        \"amount\": 1200\n      }\n    ],\n    \"applied_to\": {\n      \"id\": 101,\n      \"full_name\": \"Jordan Smith\",\n      \"type\": \"student\"\n    }\n  }\n]\r\n-----011000010111000001101001--\r\n")

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

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

url = URI("https://ssuccessv2.com/app/api/v2/school/structure/generator/contract/creation-contracts")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"actions\"\r\n\r\nadd\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"academic_year\"\r\n\r\n2026\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"registration_phase_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n[\n  {\n    \"contract_fees_type_id\": 4,\n    \"due_date\": {},\n    \"amount\": 12000,\n    \"fees_plan\": [\n      {\n        \"date\": {},\n        \"amount\": 1200\n      }\n    ],\n    \"applied_to\": {\n      \"id\": 101,\n      \"full_name\": \"Jordan Smith\",\n      \"type\": \"student\"\n    }\n  }\n]\r\n-----011000010111000001101001--\r\n"

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

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

HttpResponse<String> response = Unirest.post("https://ssuccessv2.com/app/api/v2/school/structure/generator/contract/creation-contracts")
  .header("Authorization", "Bearer <token>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"actions\"\r\n\r\nadd\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"academic_year\"\r\n\r\n2026\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"registration_phase_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n[\n  {\n    \"contract_fees_type_id\": 4,\n    \"due_date\": {},\n    \"amount\": 12000,\n    \"fees_plan\": [\n      {\n        \"date\": {},\n        \"amount\": 1200\n      }\n    ],\n    \"applied_to\": {\n      \"id\": 101,\n      \"full_name\": \"Jordan Smith\",\n      \"type\": \"student\"\n    }\n  }\n]\r\n-----011000010111000001101001--\r\n")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://ssuccessv2.com/app/api/v2/school/structure/generator/contract/creation-contracts', [
  'multipart' => [
    [
        'name' => 'actions',
        'contents' => 'add'
    ],
    [
        'name' => 'academic_year',
        'contents' => '2026'
    ],
    [
        'name' => 'data',
        'contents' => '[
  {
    "contract_fees_type_id": 4,
    "due_date": {},
    "amount": 12000,
    "fees_plan": [
      {
        "date": {},
        "amount": 1200
      }
    ],
    "applied_to": {
      "id": 101,
      "full_name": "Jordan Smith",
      "type": "student"
    }
  }
]'
    ]
  ]
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://ssuccessv2.com/app/api/v2/school/structure/generator/contract/creation-contracts");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"actions\"\r\n\r\nadd\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"academic_year\"\r\n\r\n2026\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"registration_phase_id\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data\"\r\n\r\n[\n  {\n    \"contract_fees_type_id\": 4,\n    \"due_date\": {},\n    \"amount\": 12000,\n    \"fees_plan\": [\n      {\n        \"date\": {},\n        \"amount\": 1200\n      }\n    ],\n    \"applied_to\": {\n      \"id\": 101,\n      \"full_name\": \"Jordan Smith\",\n      \"type\": \"student\"\n    }\n  }\n]\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]
let parameters = [
  [
    "name": "actions",
    "value": "add"
  ],
  [
    "name": "academic_year",
    "value": "2026"
  ],
  [
    "name": "registration_phase_id",
    "value": 
  ],
  [
    "name": "data",
    "value": "[
  {
    \"contract_fees_type_id\": 4,
    \"due_date\": {},
    \"amount\": 12000,
    \"fees_plan\": [
      {
        \"date\": {},
        \"amount\": 1200
      }
    ],
    \"applied_to\": {
      \"id\": 101,
      \"full_name\": \"Jordan Smith\",
      \"type\": \"student\"
    }
  }
]"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://ssuccessv2.com/app/api/v2/school/structure/generator/contract/creation-contracts")! 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()
```