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

# Enterprise: net a multi-entity group

> The multi-entity flow on ScripX: read net scrip positions across every group company, compute the minimal set of internal transfers that squares the group, book each transfer as an intra-group cross, and take only the residual to market.

A group that both exports and imports usually holds surplus duty credit in one entity and duty demand in another. Selling the surplus on the open market and then buying credit back for the importing entity pays the spread twice. Netting removes that: internal surplus covers internal demand first, and only the true group-level residual reaches the market.

<Note>
  All calls below use the base URL and header from [Authentication](/authentication):
  `export BASE_URL=https://api.scripxhq.com` and `X-ScripX-Key: $SCRIPX_KEY`. Run the whole flow in the [sandbox](/environments) first with a `scripx_test_…` key.
</Note>

## 1. Register every entity in the group

Each company in the group is its own firm, keyed by its own IEC, [registered](/api-reference/firms/create) and [verified](/api-reference/firms/verify) individually. A firm registers as the side it trades, `exporter` or `importer`.

```bash theme={"dark"}
curl -X POST "$BASE_URL/v1/firms" \
  -H "X-ScripX-Key: $SCRIPX_KEY" \
  -H "Content-Type: application/json" \
  -d '{"iec": "0512345678", "name": "Acme Textiles", "role": "exporter"}'
```

## 2. Read the group book

[`GET /v1/group/positions`](/api-reference/group/positions) returns your book aggregated by company and scheme, already shaped the way the netting plan expects it.

```bash theme={"dark"}
curl "$BASE_URL/v1/group/positions" \
  -H "X-ScripX-Key: $SCRIPX_KEY"
```

```json theme={"dark"}
{
  "party_iec": "0512345678",
  "positions": [
    {"iec": "0512345678", "scheme": "RODTEP", "net_paise": 100000000},
    {"iec": "0587654321", "scheme": "RODTEP", "net_paise": -60000000}
  ]
}
```

Positive `net_paise` is surplus credit; negative is duty demand.

## 3. Compute the netting plan

Feed those positions to [`POST /v1/group/net-plan`](/api-reference/group/net-plan). It returns the **minimal** set of internal transfers that squares the group, plus the residual left over.

```bash theme={"dark"}
curl -X POST "$BASE_URL/v1/group/net-plan" \
  -H "X-ScripX-Key: $SCRIPX_KEY" \
  -H "Content-Type: application/json" \
  -d '{"positions": [
        {"iec": "0512345678", "scheme": "RODTEP", "net_paise": 100000000},
        {"iec": "0587654321", "scheme": "RODTEP", "net_paise": -60000000}
      ]}'
```

```json theme={"dark"}
{
  "summary": {"internal_paise": 60000000, "residual_paise": 40000000},
  "transfers": [
    {"from_iec": "0512345678", "to_iec": "0587654321", "scheme": "RODTEP", "amount_paise": 60000000}
  ]
}
```

The plan is a computation. It moves nothing and commits you to nothing.

## 4. Book each internal transfer

Execute each transfer in the plan as an intra-group [cross](/api-reference/cross/create) with `kind: "intra_group"`. [Price it first](/api-reference/cross/quote) so both legs are known before you commit.

```bash theme={"dark"}
curl -X POST "$BASE_URL/v1/cross" \
  -H "X-ScripX-Key: $SCRIPX_KEY" \
  -H "Content-Type: application/json" \
  -d '{"seller_iec": "0512345678", "buyer_iec": "0587654321", "scheme": "RODTEP",
       "amount_paise": 60000000, "buy_price_bps": 9700, "sell_price_bps": 9700}'
```

A prepared cross never settles by itself. [Settle](/api-reference/cross/settle) funds it and [confirm](/api-reference/cross/confirm) releases it, as two separate deliberate calls.

## 5. Take the residual to market

Whatever the plan reports as `residual_paise` is the group's real market exposure. Trade it as an ordinary [order](/api-reference/trading/orders-create) on the side the residual falls, with a price floor or ceiling.

```bash theme={"dark"}
curl -X POST "$BASE_URL/v1/orders" \
  -H "X-ScripX-Key: $SCRIPX_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: acme-group-residual-2026-07" \
  -d '{"side": "sell", "scheme": "RODTEP", "amount_paise": 40000000, "min_pct_bps": 9600}'
```

## 6. Reconcile across the whole group

* [Statements](/api-reference/account/statements) itemise the period across every entity on your key.
* The [audit export](/api-reference/account/audit-export) is hash-chained and verifiable offline, covering internal transfers and market trades alike.
* Each entity keeps its own `expiry_date` per credit, so watch [validity](/concepts/scrip-validity-expiry) before parking surplus inside the group.

## Related

* [Group positions](/api-reference/group/positions)
* [Netting plan](/api-reference/group/net-plan)
* [Prepare a cross](/api-reference/cross/create)
* [Terminology](/annexure/terminology)
