{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/the-things-network/json-schema/the-things-network-v3-stream-events-request-schema.json",
  "title": "v3StreamEventsRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/the-things-network-events-api-openapi.yml#/components/schemas/v3StreamEventsRequest",
  "type": "object",
  "properties": {
    "identifiers": {
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "#/$defs/v3EntityIdentifiers"
      }
    },
    "tail": {
      "type": "integer",
      "format": "int64",
      "description": "If greater than zero, this will return historical events, up to this maximum when the stream starts.\nIf used in combination with \"after\", the limit that is reached first, is used.\nThe availability of historical events depends on server support and retention policy."
    },
    "after": {
      "type": "string",
      "format": "date-time",
      "description": "If not empty, this will return historical events after the given time when the stream starts.\nIf used in combination with \"tail\", the limit that is reached first, is used.\nThe availability of historical events depends on server support and retention policy."
    },
    "names": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "If provided, this will filter events, so that only events with the given names are returned.\nNames can be provided as either exact event names (e.g. 'gs.up.receive'),\nor as regular expressions (e.g. '/^gs\\..+/')."
    }
  },
  "$defs": {
    "lorawanv3GatewayIdentifiers": {
      "type": "object",
      "properties": {
        "gateway_id": {
          "type": "string"
        },
        "eui": {
          "type": "string",
          "format": "string",
          "description": "Secondary identifier, which can only be used in specific requests."
        }
      }
    },
    "v3ApplicationIdentifiers": {
      "type": "object",
      "properties": {
        "application_id": {
          "type": "string"
        }
      }
    },
    "v3ClientIdentifiers": {
      "type": "object",
      "properties": {
        "client_id": {
          "type": "string"
        }
      }
    },
    "v3EndDeviceIdentifiers": {
      "type": "object",
      "properties": {
        "device_id": {
          "type": "string"
        },
        "application_ids": {
          "$ref": "#/$defs/v3ApplicationIdentifiers"
        },
        "dev_eui": {
          "type": "string",
          "format": "string",
          "description": "The LoRaWAN DevEUI."
        },
        "join_eui": {
          "type": "string",
          "format": "string",
          "description": "The LoRaWAN JoinEUI (AppEUI until LoRaWAN 1.0.3 end devices)."
        },
        "dev_addr": {
          "type": "string",
          "format": "string",
          "description": "The LoRaWAN DevAddr."
        }
      }
    },
    "v3EntityIdentifiers": {
      "type": "object",
      "properties": {
        "application_ids": {
          "$ref": "#/$defs/v3ApplicationIdentifiers"
        },
        "client_ids": {
          "$ref": "#/$defs/v3ClientIdentifiers"
        },
        "device_ids": {
          "$ref": "#/$defs/v3EndDeviceIdentifiers"
        },
        "gateway_ids": {
          "$ref": "#/$defs/lorawanv3GatewayIdentifiers"
        },
        "organization_ids": {
          "$ref": "#/$defs/v3OrganizationIdentifiers"
        },
        "user_ids": {
          "$ref": "#/$defs/v3UserIdentifiers"
        }
      },
      "description": "EntityIdentifiers contains one of the possible entity identifiers."
    },
    "v3OrganizationIdentifiers": {
      "type": "object",
      "properties": {
        "organization_id": {
          "type": "string",
          "description": "This ID shares namespace with user IDs."
        }
      }
    },
    "v3UserIdentifiers": {
      "type": "object",
      "properties": {
        "user_id": {
          "type": "string",
          "description": "This ID shares namespace with organization IDs."
        },
        "email": {
          "type": "string",
          "description": "Secondary identifier, which can only be used in specific requests."
        }
      }
    }
  }
}