---
source_url: https://www.pubnub.com/docs/admin-api/route-create
title: routeCreate
description: Create a connection between a router ([action](/docs/serverless/events-and-actions/overview#actions)) and a route input ([event listener](/docs/serverless/events-and-actions/overview#event-listeners)) to set up the whole message (event) flow (input-to-output). In response, you'll obtain a unique string (`route-id` returned as `data.id`) representing the connection that's required to make a `routerId` call.
---

# routeCreate

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

Create a connection between a router ([action](https://www.pubnub.com/docs/serverless/events-and-actions/overview#actions)) and a route input ([event listener](https://www.pubnub.com/docs/serverless/events-and-actions/overview#event-listeners)) to set up the whole message (event) flow (input-to-output). In response, you'll obtain a unique string (`route-id` returned as `data.id`) representing the connection that's required to make a `routerId` call.

You can create a route between one router and one route input, but a single router or route input can be used in multiple routes (like one router with two route inputs or numerous routers connected to a single route input).

To create a route, at least one of its elements must already exist (router represented by `routerId` or route input represented by `routeInputId`), but the following combinations are allowed:

* `routeInputId` + `router` — where you create a router (by providing its configuration) and join an existing route input to it (`routeInputId`)
* `routeInputId` + `routerId` — where you join an existing route input (`routeInputId`) with the existing router (`routerId`)
* `routeInput` + `routerId` — where you create a route input (by providing its configuration) and join an existing router to it (`routerId`)

## Request

Example

```
{
  "data": {
    "id": "string",
    "revisions": [
      {
        "id": "string",
        "subscribeKey": "string",
        "routeInput": {},
        "router": {}
      }
    ]
  },
  "meta": {},
  "errors": [
    {
      "code": "string",
      "message": "string",
      "path": "string"
    }
  ]
}
```
