---
title: openPort query | Wartiva GraphQL API
description: Retrieves an OpenPort by its graph object id: a TCP or UDP port on a discovered device. Wartiva GraphQL API reference with arguments, fields, and examples.
url: https://wartiva.com/api-docs/queries/open-port.html
updated: 2026-10-07
---

Networks, devices, and sensors · GraphQL query

# `openPort` query

Retrieves an [OpenPort](https://wartiva.com/api-docs/types/open-port.html) by its graph object id: a TCP or UDP port on a discovered device, found by endpoint port scans of local devices or by Wartiva's scan of public IP addresses, with its open and closed history and whether it is exposed publicly. A [Device](https://wartiva.com/api-docs/types/device.html) lists its ports through `ports`, and each port lists the [Service](https://wartiva.com/api-docs/types/service.html) objects identified on it; find them across the organization with [graphSearch](https://wartiva.com/api-docs/queries/graph-search.html) on the OPEN_PORT object type. Returns a not-found error when no object has the id, and an error when the id belongs to another object type.

## Response

Returns an [`OpenPortPayload!`](https://wartiva.com/api-docs/types/open-port-payload.html)

## Arguments

| Name | Description |
|---|---|
| `id` - [`ID!`](https://wartiva.com/api-docs/types/id.html) | The [OpenPort](https://wartiva.com/api-docs/types/open-port.html) identifier. |
| `mockOptions` - [`MockDataInput`](https://wartiva.com/api-docs/types/mock-data-input.html) | Options for mock data generation. Options supported: none. |

## Example

### Query

```graphql
query openPort(
  $id: ID!,
  $mockOptions: MockDataInput
) {
  openPort(
    id: $id,
    mockOptions: $mockOptions
  ) {
    node {
      id
      orgId
      objectType
      objectTypeLabel
      displayName
      firstSeen
      lastSeen
      seen {
        ...SeenOnlineFragment
      }
      createdAt
      updatedAt
      snapshotInfo {
        ...GraphObjectSnapshotInfoFragment
      }
      device {
        ...DeviceFragment
      }
      network {
        ...NetworkFragment
      }
      networkPrefix {
        ...NetworkPrefixFragment
      }
      ip {
        ...IpAddressFragment
      }
      isOpen
      public
      port
      protocol
      state
      services {
        ...ServiceConnectionFragment
      }
      endpoints {
        ...EndpointConnectionFragment
      }
      firstSeenOpen
      lastSeenOpen
      lastSeenClosed
      seenOpen {
        ...SeenOnlineFragment
      }
      openToEndpointCount
      findings {
        ...FindingsPayloadFragment
      }
      issues {
        ...IssuesPayloadFragment
      }
      issuesSummary {
        ...IssuesSummaryFragment
      }
    }
  }
}

```

### Variables

```json
{
  "id": "4",
  "mockOptions": MockDataInput
}

```

### Response

```json
{"data": {"openPort": {"node": OpenPort}}}

```

---

Wartiva is in early access. Request access: https://wartiva.com/early-access.html  
All pages: https://wartiva.com/llms.txt
