> For the complete documentation index, see [llms.txt](https://docs.interlynk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.interlynk.io/api/inventory/list-resources.md).

# List Products and Versions

Most API calls need IDs: a product ID, an environment ID, or a version ID. This guide shows how to find them.

## List your products

This returns every product, its environments, and the versions in each environment.

```bash
curl https://api.interlynk.io/lynkapi \
  -H "Authorization: Bearer $INTERLYNK_SECURITY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query ListProducts($first: Int) { organization { projectGroups(first: $first, enabled: true, orderBy: { field: PROJECT_GROUPS_UPDATED_AT, direction: DESC }) { totalCount nodes { id name projects { nodes { id name sboms { id projectVersion vulnRunStatus primaryComponent { name version } } } } } } } }",
    "variables": { "first": 25 }
  }'
```

Response:

```json
{
  "data": {
    "organization": {
      "projectGroups": {
        "totalCount": 3,
        "nodes": [
          {
            "id": "26ae44b7-2f68-4cf4-a405-d5ee0177bb11",
            "name": "payments-service",
            "projects": {
              "nodes": [
                {
                  "id": "1fade833-0603-4139-8ca0-26592264a4c9",
                  "name": "default",
                  "sboms": [
                    {
                      "id": "4e423fe0-d089-4025-b1e4-8fe9608138d6",
                      "projectVersion": "3.0.2",
                      "vulnRunStatus": "FINISHED",
                      "primaryComponent": { "name": "payments-service", "version": "3.0.2" }
                    }
                  ]
                },
                { "id": "d845527f-f794-4120-97e3-ee350ee6638f", "name": "development", "sboms": [] },
                { "id": "0554ca34-ae9c-48f4-bc94-d14269214a43", "name": "production", "sboms": [] }
              ]
            }
          }
        ]
      }
    }
  }
}
```

Read the IDs from the response:

* **Product ID** is `projectGroups.nodes[].id`.
* **Environment ID** is `projects.nodes[].id`.
* **Version ID** is `sboms[].id`. This is the `sbomId` other calls ask for.

## Find one product by name

If you know the product name, search for it instead of listing everything.

```bash
curl https://api.interlynk.io/lynkapi \
  -H "Authorization: Bearer $INTERLYNK_SECURITY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query FindProduct($name: String!) { organization { projectGroups(search: $name, enabled: true, first: 10) { nodes { id name projects { nodes { id name sboms { id projectVersion } } } } } } }",
    "variables": { "name": "payments-service" }
  }'
```

`search` matches partially, so confirm the `name` in the response is the exact product you want.

## Pagination

List queries return 25 items by default. They use cursor-based pagination. Request `totalCount` and `pageInfo` to page through larger result sets:

```graphql
query ListProducts($first: Int, $after: String) {
  organization {
    projectGroups(first: $first, after: $after, enabled: true,
                  orderBy: { field: PROJECT_GROUPS_UPDATED_AT, direction: DESC }) {
      totalCount
      pageInfo { endCursor hasNextPage }
      nodes { id name }
    }
  }
}
```

* Pass `first` and `after` to move forward. `first` is the page size, `after` is the `endCursor` from the previous page.
* Pass `last` and `before` to move backward.
* When `hasNextPage` is `false`, you have reached the end.

See [Conventions](/api/reference/conventions.md) for more on pagination, ordering, and search.

## Next steps

With the IDs in hand, you can [upload](/api/managing-sboms/upload-sbom.md), [download](/api/managing-sboms/download-sbom.md), or [edit](/api/managing-sboms/edit-sbom-metadata.md) an SBOM.
