---
source_url: https://www.pubnub.com/docs/admin-api/route-input-create
title: routeInputCreate
description: Create a single route input ([event listener](/docs/serverless/events-and-actions/overview#event-listeners)) to listen for messages (events) from a given producer (such as Pub/Sub API, Presence API, or Push Notifications API). In response, you'll obtain a unique string (`routeInputId` returned as `data.id`) representing the route input. This unique string is required to make other route input-related calls to Events & Actions API.
---

# routeInputCreate

> For AI agents: documentation index at https://www.pubnub.com/llms-full.txt

Create a single route input ([event listener](https://www.pubnub.com/docs/serverless/events-and-actions/overview#event-listeners)) to listen for messages (events) from a given producer (such as Pub/Sub API, Presence API, or Push Notifications API). In response, you'll obtain a unique string (`routeInputId` returned as `data.id`) representing the route input. This unique string is required to make other route input-related calls to Events & Actions API.

To create a route input, you must know the exact path to the PubNub message (event) type that this route input will listen for. This path must be specified in the `endpoint` object where you provide the `messageTypeName` and `version` identifying the most granular event type.

To identify the correct `messageTypeName` and `version`, follow this path:

1. First, make a GET request to the `/v2/messages/sources` endpoint and locate the source emitting the message (event) type you want to listen for.
2. Using the ID of the located source (`sourceId`), make a GET call to the `/v2/messages/sources/{sourceId}/producers` endpoint to locate what produces this event type on a given source.
3. Finally, using the ID of the located producer (`producerId`), make a GET call to the `/v2/messages/producers/{producerId}/message-types` endpoint to search for all message (event) types that are available for a given producer and attach it as `messageTypeName` and `version` when making a POST call to the `/v2/routes/route-inputs` endpoint.

Alternatively

1. Make a GET request to the `/v2/messages/message-types` endpoint and locate the source emitting the message (event) type you want to listen for.

### Example

Let's say you want to listen for all messages (events) emitted when a user subscribes to a channel to track channel presence.

After making a GET request to the `/v2/messages/sources` endpoint, you'll identify the `channel` source ID and use it call the `/v2/messages/sources/{sourceId}/producers` endpoint. The call will return a list of available producers for channels (currently only `Presence`), and using it, you can call the `/v2/messages/producers/{producerId}/message-types` endpoint to get the full list of the available message (event) types, out of which `UserStartedSubscriptionToChannel` is what you were looking for.

In this case, you'd use `UserStartedSubscriptionToChannel` as `messageTypeName` and `1.0.0` as `version` when calling `/v2/routes/route-inputs` and create a route input to listen for all events of type `UserStartedSubscriptionToChannel`.

## Request

Example

```
{
  "data": {
    "id": "string",
    "endpoint": {
      "platformName": "PUBNUB",
      "messageTypeId": "string",
      "messageTypeName": "string",
      "version": "string"
    },
    "version": "string",
    "name": "string",
    "state": "DISABLED",
    "filters": [
      {
        "type": "string",
        "field": "string",
        "value": "string"
      }
    ]
  },
  "meta": {},
  "errors": [
    {
      "code": "string",
      "message": "string",
      "path": "string"
    }
  ]
}
```
