## Link a customer contract to a supplier contract (tenant:trade:contract:write)

`POST /api/trade/v1/contracts/back-to-back`

Module: Trade · operationId: `createBackToBackLink` · Tag: Contracts · Auth: access token (`Authorization: Bearer <accessToken>`)

Both contracts must be contracts of your tenant; an unknown contract id answers 404.

### Request body

`application/json` (required)

- `allocatedMargin` (number): Margin allocated to the link.
- `createdAt` (string (date-time), read-only): When the link was created.
- `customerContractId` (string (uuid)): Id of the customer contract.
- `customerNo` (string, read-only): Customer number of the tenant.
- `id` (string (uuid), read-only): Id of the back-to-back link.
- `notes` (string): Free-text notes.
- `supplierContractId` (string (uuid)): Id of the supplier contract.
- `tenantName` (string, read-only): Name of the tenant.

Example:

```json
{
  "allocatedMargin": 120,
  "customerContractId": "4b0c2f9e-3d7a-4c55-9a1e-2f6b8d1c0a11",
  "notes": "Microsoft 365 Business Premium",
  "supplierContractId": "8e5d1a2b-6c3f-4e77-b0a9-1d2c3e4f5a66"
}
```

### Responses

- **201** Created (`application/json`)
- **400** Error (`application/json`)
- **401** No valid session or bearer token (no body).
- **404** Not found in the tenant. (`application/json`)

Fields of the 201 answer:

- `allocatedMargin` (number): Margin allocated to the link.
- `createdAt` (string (date-time), read-only): When the link was created.
- `customerContractId` (string (uuid)): Id of the customer contract.
- `customerNo` (string, read-only): Customer number of the tenant.
- `id` (string (uuid), read-only): Id of the back-to-back link.
- `notes` (string): Free-text notes.
- `supplierContractId` (string (uuid)): Id of the supplier contract.
- `tenantName` (string, read-only): Name of the tenant.

Example 201 answer:

```json
{
  "allocatedMargin": 42,
  "createdAt": "2026-01-05T09:00:00Z",
  "customerContractId": "0e1f2a3b-4c5d-4e6f-8a7b-9c0d1e2f3a07",
  "customerNo": "99999",
  "id": "6b7c8d9e-0f1a-4b2c-9d3e-4f5a6b7c8d01",
  "notes": "Cloud-Server kanzlei-srv01 bei ITC Riemer",
  "supplierContractId": "0e1f2a3b-4c5d-4e6f-8a7b-9c0d1e2f3a03",
  "tenantName": "DEMO"
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/trade/v1/contracts/back-to-back' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"allocatedMargin":120,"customerContractId":"4b0c2f9e-3d7a-4c55-9a1e-2f6b8d1c0a11","notes":"Microsoft 365 Business Premium","supplierContractId":"8e5d1a2b-6c3f-4e77-b0a9-1d2c3e4f5a66"}'
```
