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

# Netting plan

> Compute the minimal intra-group transfer plan on ScripX: pass net positions per group company and scheme, get back the smallest set of internal transfers that squares the group.

<Note>
  Group netting is executed through the cross desk, which must be active on your key. Write to [amin@eximfiles.io](mailto:amin@eximfiles.io) to have it enabled.
</Note>

For groups with several importing and exporting entities: pass each company's net position per scheme and get back the **minimal** set of internal transfers that squares the group, so only the true residual goes to market. Requires the `orders:read` scope; the plan is a computation, it moves nothing.

### Request example

```bash theme={"dark"}
curl -X POST "https://api.scripxhq.com/v1/group/net-plan" \
  -H "X-ScripX-Key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"positions": [
        {"iec": "0512345678", "scheme": "RODTEP", "net_paise": 100000000},
        {"iec": "0587654321", "scheme": "RODTEP", "net_paise": -60000000}
      ]}'
```

Positive `net_paise` is surplus credit (a seller), negative is demand (a buyer).

### Response example

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

₹6,00,000 nets between the two entities; only ₹4,00,000 of surplus goes to market. Execute each internal transfer as an [intra-group cross](/api-reference/cross/create) at prices you set, after reading the full economics on the [cross quote](/api-reference/cross/quote). See the [enterprise guide](/guides/enterprise-group) for the flow end to end.

### Errors

* `422 unprocessable`, empty or malformed `positions`.

**Terms used here:** [scheme](/annexure/terminology#scheme), [IEC](/annexure/terminology#iec), [paise](/annexure/terminology#paise), [residual](/annexure/terminology#residual), [position](/annexure/terminology#position), [cross](/annexure/terminology#cross-block-deal), [group netting](/annexure/terminology#group-netting), [API key](/annexure/terminology#api-key), [scope](/annexure/terminology#scope). Full list in the [terminology annexure](/annexure/terminology).

### Next steps

* [Group positions](/api-reference/group/positions) computes the input book for you.
* [Cross desk](/api-reference/cross/create) to execute the plan's transfers.


## OpenAPI

````yaml POST /v1/group/net-plan
openapi: 3.1.0
info:
  title: ScripX Partner API
  version: 1.2.0
  description: >-
    Automate duty-credit-scrip trading: quote, order, positions, market,
    webhooks. Auth: `X-ScripX-Key: scripx_live_…`. Money = integer paise; price
    = bps of face.
  contact:
    name: ScripX API Support
    email: amin@eximfiles.io
    url: https://scripxhq.com
servers:
  - url: https://api.scripxhq.com
    description: >-
      Production and sandbox share one host; a scripx_test_ key selects the
      sandbox.
security:
  - ApiKeyAuth: []
tags:
  - name: Firms
    description: >-
      client-firm lifecycle: register, verify, authorize, credits, update,
      offboard
  - name: Trading
    description: quote, orders, positions, market
  - name: Group
    description: intra-group netting + positions (enterprise/broker)
  - name: Cross
    description: 'broker cross-desk: block deals + intra-group transfers'
  - name: Webhooks
    description: event subscriptions + delivery
  - name: Account
    description: usage + metering
  - name: Keys
    description: self-serve scoped child keys (sub-accounts)
paths:
  /v1/group/net-plan:
    post:
      tags:
        - Group
      summary: Minimal intra-group netting plan
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NetPlanRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NetPlan'
        '401':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    NetPlanRequest:
      type: object
      required:
        - positions
      properties:
        positions:
          type: array
          items:
            type: object
            properties:
              iec:
                type: string
              scheme:
                type: string
              net_paise:
                type: integer
    NetPlan:
      type: object
      properties:
        summary:
          type: object
        transfers:
          type: array
          items:
            type: object
    Error:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          description: stable machine code
          enum:
            - bad_request
            - unauthorized
            - forbidden
            - not_found
            - conflict
            - unprocessable
            - rate_limited
            - internal
        message:
          type: string
        detail:
          type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-ScripX-Key
      description: >-
        Your API key, e.g. `scripx_live_…`. Bound to one firm; tenant isolation
        is enforced.

````