---
title: "Get commodity graph for a commodity tree"
method: GET
path: "/public/v2/network/tree/{commodityTreeId}/commodity-graph"
tags: ["Collections - Network"]
---

# Get commodity graph for a commodity tree

`GET /public/v2/network/tree/{commodityTreeId}/commodity-graph`

Retrieve a commodity-based network graph using a commodity tree ID.

This endpoint is similar to the collection-based commodity graph endpoint but uses a commodity
tree ID to identify the collection. The commodity tree represents a hierarchical organization
of commodity categories.

**Use Cases**:
- Analyze commodity-based networks using commodity tree identifiers
- Visualize relationships for specific commodity hierarchies
- Integrate with systems that use commodity tree IDs

**Response Format**:
Returns an array of tree nodes organized by commodity relationships.

**Required Permission**: `ACCESS_PUBLIC_COMMODITY_GRAPH`

**Performance Impact**: High

## Path parameters

- `commodityTreeId` integer, required

## Response `200`

Successfully retrieved commodity graph

- PublicTreeTargetV2[]
  - `target` integer, required — The target id of the supplier
  - `suppliers` PublicTreeTargetV2[], required — All sub-suppliers nested in the same structure
  - `targetInfo` PublicTargetInfoDTO, required — Information about the supplier (tier, path, collection)
    - `tier` integer, nullable — How far the supplier is away from the root supplier
    - `path` integer[], required — The path to the supplier, where the first element is the root supplier
    - `collectionLevel` integer, nullable — How deep the supplier is in the collection hierarchy
    - `collectionPath` integer[], required — The path to the collection, where the first element is the root collection
    - `collectionPaths` array[], nullable — List of collection paths per target with collection id as bottom level collection
      - integer[] — List of collection paths per target with collection id as bottom level collection
  - `edgeSource` string, required — Allowed values "Public Media", "Public Customs", "Private", "Shared", "Prewave Prediction"
  - `edgeInfo` PublicEdgeInfo
    - `hsCodes` PublicHSCode[], required
      - `code` string, required
      - `nShipments` integer, nullable
      - `nshipments` integer
    - `probability` number, double, nullable
  - `merged_targets` integer[] — Target ids of past targets that were merged into this current target

## Other responses

- `403` — 403 Forbidden - Authentication or authorization failure. This status code is returned when: (1) the request lacks valid authentication credentials (missing or invalid X-Auth-Token header), or (2) the authenticated user does not have the required permission to access this resource.
- `404` — 404 Not Found - Commodity tree not found or no associated collection found
- `429` — 429 Too Many Requests - API rate limit exceeded. The request has been rejected because the rate limit for this endpoint has been exceeded. Default rate limits: GET requests - 100 per 10 seconds, 500 per minute; POST/PUT/PATCH/DELETE requests - 20 per 10 seconds, 100 per minute. For increased access, please contact customer success.
- `500` — 500 Internal Server Error - An unexpected error occurred on the server. The request may or may not have been processed.

---

[API](https://skmtc.net/prewave/apis/public-prewave-api.md) · [All operations](https://skmtc.net/prewave/apis/public-prewave-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/prewave/public-prewave-api/revisions/466169815b78/schema)
