---
title: "Create Network Flow"
method: POST
path: "/network-flow"
tags: ["Network Flow"]
---

# Create Network Flow

`POST /network-flow`

## Request

- Base URL: `https://oneuptime.com/api`
- URL: `https://oneuptime.com/api/network-flow`
- Auth: API key in header `APIKey`
- TypeScript: <https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/docs/network-flow/post.ts> (a function with typed inputs; its response is checked against the schema)

Endpoint to create a new Network Flow

## Request body

- object
  - `data` NetworkFlowV1CreateSchema, required: Create schema for NetworkFlowV1
    - `projectId` string, uuid: ID of project
    - `networkDeviceId` string, uuid, required: ID of the NetworkDevice that exported this flow (matched from the exporter's address on ingest), or the project's ID when the exporter is not a device of the project yet
    - `exporterIp` string, required: Address of the router or switch that observed the flow: the sFlow agent address, or the address an IPFIX or NetFlow v9 exporter gives for itself, else the source address of the export datagram
    - `srcIp` string, required: Source IP address of the flow's traffic
    - `dstIp` string, required: Destination IP address of the flow's traffic
    - `srcPort` number, required: TCP/UDP source port; 0 when the protocol has none, and on the client side of a conversation with a service (the probe folds a client's ephemeral port into 0)
    - `dstPort` number, required: TCP/UDP destination port; 0 when the protocol has none, and on the client side of a conversation with a service
    - `protocol` number, required: IP protocol number (6 = TCP, 17 = UDP, 1 = ICMP, ...)
    - `inputInterfaceIndex` number, required: SNMP ifIndex of the interface the flow entered through (0 when unknown)
    - `outputInterfaceIndex` number, required: SNMP ifIndex of the interface the flow left through (0 when unknown)
    - `octets` union, required: Bytes in the flow - an estimate of the real traffic: what the device reported, multiplied by its sampling rate
      - number
      - string
    - `packets` union, required: Packets in the flow - an estimate of the real traffic: what the device reported, multiplied by its sampling rate
      - number
      - string
    - `flowStartAt` string, date-time, required: Wall-clock time the flow started
    - `flowEndAt` string, date-time, required: Wall-clock time the flow ended
    - `ingestedAt` string, date-time, required: When the server ingested this flow record
    - `flowFormat` string, required: The export format the device used: NetFlow v5, NetFlow v9, IPFIX or sFlow (empty on rows from probes older than IPFIX and sFlow support)
    - `samplingRate` number, required: The device counted one packet in this many (1: every packet). Octets and Packets are already multiplied by it.
    - `flowCount` number, required: How many flow records the device sent for this conversation that the probe summed into this row (records of the same conversation arriving within seconds of each other)
    - `probeId` string, uuid: ID of the probe whose flow collector received this flow (empty on rows stored before it was recorded)
    - `srcName` string, required: DNS name of the source address when the probe forwarded the flow, if it points back to the address (empty when none)
    - `dstName` string, required: DNS name of the destination address when the probe forwarded the flow, if it points back to the address (empty when none)

## Response `201`

Created successfully

- object
  - `data` NetworkFlowV1ReadSchema
    - `projectId` string, required: Project ID
    - `networkDeviceId` string, required: Network Device ID
    - `exporterIp` string, required: Exporter IP
    - `srcIp` string, required: Source IP
    - `dstIp` string, required: Destination IP
    - `srcPort` number, required: Source Port
    - `dstPort` number, required: Destination Port
    - `protocol` number, required: Protocol
    - `inputInterfaceIndex` number, required: Input Interface Index
    - `outputInterfaceIndex` number, required: Output Interface Index
    - `octets` string: Octets
    - `packets` string: Packets
    - `flowStartAt` string: Flow Start
    - `flowEndAt` string: Flow End
    - `ingestedAt` string: Ingested At
    - `flowFormat` string, required: Flow Format
    - `samplingRate` number, required: Sampling Rate
    - `flowCount` number, required: Flow Count
    - `probeId` string: Probe ID
    - `srcName` string, required: Source Name
    - `dstName` string, required: Destination Name

## Other responses

- `400`: Bad request. This response indicates that the request was malformed or contained invalid data.
- `401`: Unauthorized. This response indicates that the request requires user authentication.
- `402`: Payment Required. This response indicates that the request requires payment or a valid subscription.
- `403`: Forbidden. This response indicates that the server understood the request, but refuses to authorize it.
- `405`: Project not found. This response indicates that the requested project does not exist or is not accessible.
- `408`: Request Timeout. This response indicates that the server timed out waiting for the request.
- `415`: Unable to reach server. This response indicates that the server is currently unreachable or down.
- `422`: Not authorized. This response indicates that the user does not have permission to access the requested resource.
- `500`: Internal Server Error. This response indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

---

[API](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification.md) - [All operations](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/llms.txt) - [OpenAPI document](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/revisions/ba3307d00304?raw)
