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

# Get Org Routing

> See how many rows of a validated import go to each organization of your group before you submit it

[← Imports](https://code.dcycle.io/api-reference/imports/overview.md)

A holding can import one file for its whole group: each row is written into one organization of the group. This
endpoint says, for a validated session, how many of the rows the submit will write go to each organization, and
whether some go to an organization other than the one you import from. Read it after
[Validate](https://code.dcycle.io/api-reference/imports/validate.md) and after correcting or deleting rows, and show it before
[Submit](https://code.dcycle.io/api-reference/imports/submit.md).

The destination of each row is decided as the submit decides it, from the template:

* In most templates, the row's organization column (`organization_id`), or a fixed value for it; a blank cell is a row
  of the organization you import from.
* A facility consumption or a waste goes to the organization of its facility (the row's, or the session's
  `facility_id`), whatever the organization column says.
* A use of product goes to the organization of its product.

Rows with errors are not counted: the submit does not write them.

## Request

### Headers

**x-api-key** `string` *required*

Your API key for authentication

**Example:** `sk_live_1234567890abcdef`

**x-organization-id** `string` *required*

Your organization UUID

**Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`

### Path Parameters

**import\_id** `string` *required*

UUID of the import session

**Example:** `"11111111-1111-1111-1111-111111111111"`

## Response

**import\_id** `string`

UUID of the import session

**org\_routing** `object | null`

Where the rows go. Null when the template writes every row into the organization you import from (it has no
organization column), and before the session is validated.

**properties**

**entries** `array`

One entry per destination organization: those other than yours first, the most rows first.

**properties**

**organization\_id** `string`

UUID of the organization

**name** `string`

Its name

**row\_count** `integer`

How many of the rows the submit writes go to it

**is\_workspace** `boolean`

It is the organization you import from

**requires\_acknowledgement** `boolean`

Some row goes to an organization other than yours: ask whoever submits to confirm it first

## Example

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X GET "https://api.dcycle.io/v2/imports/11111111-1111-1111-1111-111111111111/org-routing" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import requests
import os

headers = {
    "x-api-key": os.getenv("DCYCLE_API_KEY"),
    "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
}

import_id = "11111111-1111-1111-1111-111111111111"
response = requests.get(
    f"https://api.dcycle.io/v2/imports/{import_id}/org-routing",
    headers=headers,
)

routing = response.json()["org_routing"]
if routing:
    for entry in routing["entries"]:
        print(f"{entry['name']}: {entry['row_count']} rows")
```

```json Response theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "import_id": "11111111-1111-1111-1111-111111111111",
  "org_routing": {
    "entries": [
      {
        "organization_id": "5a1c7e1e-2b5e-4f43-9d7a-0f6c2f6f2d10",
        "name": "Subsidiary Ltd",
        "row_count": 12,
        "is_workspace": false
      },
      {
        "organization_id": "a8315ef3-dd50-43f8-b7ce-d839e68d51fa",
        "name": "Holding SA",
        "row_count": 30,
        "is_workspace": true
      }
    ],
    "requires_acknowledgement": true
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.