> For the complete documentation index, see [llms.txt](https://docs.reveel.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reveel.id/routes-old.md).

# Routes - old

The Routes API allows partners to configure how incoming funds should be routed, swapped, or sent out for each user. These configurations support cross-chain and token-specific routing logic.

### Parameter Reference

| Field              | Type      | Required                   | Description                                      |
| ------------------ | --------- | -------------------------- | ------------------------------------------------ |
| `userId`           | string    | Yes                        | ID of the user associated with the route         |
| `id`               | string    | Required for update/delete | Route identifier                                 |
| `name`             | string    | Optional                   | Friendly name for the route                      |
| `incomingWallets`  | string\[] | Optional                   | Specific wallets allowed to send to this route   |
| `incomingNetworks` | string\[] | Yes                        | Incoming chain identifiers (e.g., ETH, POL)      |
| `incomingTokens`   | string\[] | Yes                        | Supported tokens for the route (e.g., USDC, ETH) |
| `swapNetwork`      | string    | Optional                   | Chain where token should be swapped              |
| `swapToken`        | string    | Optional                   | Token to receive after swap                      |
| `outgoingWallet`   | string    | Yes                        | Final destination address for routed funds       |
| `routeId`          | string    | Optional                   | Used in conflict checks when editing             |

### 1. Create Route

**URL:** `POST /routes/create`\
**Authentication:** Required

**Request Body**

```json
{
  "userId": "user-id",
  "name": "Default Route",
  "incomingWallets": ["0x123...", "0x456..."],
  "incomingNetworks": ["ETH", "POL"],
  "incomingTokens": ["ETH", "USDC"],
  "swapNetwork": "POL",
  "swapToken": "USDC",
  "outgoingWallet": "0x789..."
}
```

**Success Response — `201 Created`**

```json
{
  "success": true,
  "message": "Route created successfully",
  "data": {
    "route": {
      "id": "route-id",
      "userId": "user-id",
      "name": "Default Route",
      "incomingWallets": ["0x123...", "0x456..."],
      "incomingNetworks": ["ETH", "POL"],
      "incomingTokens": ["ETH", "USDC"],
      "swapNetwork": "POL",
      "swapToken": "USDC",
      "outgoingWallet": "0x789...",
      "createdAt": "2023-01-01T00:00:00.000Z",
      "updatedAt": "2023-01-01T00:00:00.000Z"
    }
  }
}
```

**Error Responses**

| HTTP Code                   | Description                   |
| --------------------------- | ----------------------------- |
| `400 Bad Request`           | Missing or invalid parameters |
| `409 Conflict`              | Duplicate configuration       |
| `500 Internal Server Error` | Unexpected server failure     |

Example:

```json
{
  "success": false,
  "message": "Route configuration conflicts with existing routes",
  "error": "You already have routes configured for these network and token combinations"
}
```

***

### 2. Update Route

**URL:** `PUT /routes/edit-route`\
**Authentication:** Required

**Request Body**

```json
{
  "id": "route-id",
  "userId": "user-id",
  "name": "Updated Route",
  "incomingWallets": ["0x123..."],
  "incomingNetworks": ["ETH", "OP"],
  "incomingTokens": ["ETH", "USDT"],
  "swapNetwork": "BNB",
  "swapToken": "BNB",
  "outgoingWallet": "0x999..."
}
```

**Success Response — `200 OK`**

```json
{
  "success": true,
  "message": "Route updated successfully",
  "data": {
    "route": {
      "id": "route-id",
      ...
    }
  }
}
```

**Error Responses**

| HTTP Code                   | Description                            |
| --------------------------- | -------------------------------------- |
| `400 Bad Request`           | Missing required fields                |
| `403 Forbidden`             | Unauthorized to update the route       |
| `404 Not Found`             | Route does not exist                   |
| `409 Conflict`              | Route config clashes with existing one |
| `500 Internal Server Error` | Server-side issue                      |

***

### 3. Delete Route

**URL:** `DELETE /routes/delete-route`\
**Authentication:** Required

**Request Body**

```json
{
  "userId": "user-id",
  "id": "route-id"
}
```

**Success Response — `200 OK`**

```json
{
  "success": true,
  "message": "Route deleted successfully"
}
```

**Error Responses**

| HTTP Code                   | Description             |
| --------------------------- | ----------------------- |
| `400 Bad Request`           | Missing route ID        |
| `403 Forbidden`             | No permission to delete |
| `404 Not Found`             | Route not found         |
| `500 Internal Server Error` | Unexpected error        |

***

### 4. Get Routes

**URL:** `GET /routes/get-routes`\
**Authentication:** Required

**Query Parameters**

* `userId` (string, required)

**Success Response — `200 OK`**

```json
{
  "success": true,
  "message": "Found 2 route(s)",
  "data": {
    "routes": [ ... ],
    "count": 2
  }
}
```

**Error Responses**

| HTTP Code                   | Description      |
| --------------------------- | ---------------- |
| `400 Bad Request`           | Missing `userId` |
| `500 Internal Server Error` | Server error     |

***

### 5. Check Route Conflicts

**URL:** `POST /routes/route-exists`\
**Authentication:** Required

**Request Body**

```json
{
  "userId": "user-id",
  "incomingNetworks": ["ETH", "POL"],
  "incomingTokens": ["ETH", "USDC"],
  "routeId": "route-id" // optional when updating
}
```

**Success Response — No Conflict (200 OK)**

```json
{
  "success": true,
  "message": "Route configuration is available",
  "data": {
    "exists": false,
    "conflictingRoutes": []
  }
}
```

**Success Response — Conflict Found (200 OK)**

```json
{
  "success": true,
  "message": "Route configuration conflicts with existing routes",
  "data": {
    "exists": true,
    "conflictingRoutes": [
      {
        "id": "route-id-1",
        "name": "Default Route",
        "incomingNetworks": ["ETH"],
        "incomingTokens": ["USDC"]
      }
    ]
  }
}
```

**Error Responses**

| HTTP Code                   | Description                |
| --------------------------- | -------------------------- |
| `400 Bad Request`           | Missing or invalid request |
| `500 Internal Server Error` | Unexpected server failure  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.reveel.id/routes-old.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
