---
title: "Query custom routes"
method: GET
path: "/v1/projects/{project_id}/routes"
tags: ["Phone"]
---

# Query custom routes

`GET /v1/projects/{project_id}/routes`

## Request

- Base URL: `https://api.telerivet.com`
- URL: `https://api.telerivet.com/v1/projects/{project_id}/routes`
- Auth: one of:
  - HTTP basic
  - OAuth 2 (authorization code, authorization URL `https://telerivet.com/oauth/authorize`, token URL `https://api.telerivet.com/oauth/token`)

Queries custom routes that can be used to send messages (not including Phones).

## Path parameters

- `project_id` string, required

## Query parameters

- `name` string
- `sort` 'default' | 'name'
- `sort_dir` 'asc' | 'desc'
- `page_size` integer
- `offset` integer
- `marker` string
- `count` boolean

## Response `200`

Successful response. When count=1 parameter is provided, returns {"count": N} instead.

- object
  - `data` Route[]: Array of results (omitted when count=1)
    - `id` string: Telerivet's internal ID for the route
    - `name` string: The name of the route
    - `vars` object: Custom variables stored for this route. Variable names may be up to 32 characters in length and can contain the characters a-z, A-Z, 0-9, and _. Values may be strings, numbers, or boolean (true/false). String values may be up to 4096 bytes in length when encoded as UTF-8. Up to 100 variables are supported per object. Setting a variable to null will delete the variable.
    - `url` string: URL to this route in the Telerivet web app
    - `project_id` string: ID of the project this route belongs to
    - `actions` RoutingAction[]: Array of routing action objects. Allowed action types: `use_phone`, `condition`.
      - union: A routing action for custom routes. Only `use_phone` and `condition` action types are supported.
        - object: Within a custom route, selects one or more basic routes that can be used to send the message.
          - `type` 'use_phone', required: Action type identifier
          - `phone_ids` string[], required: Array of basic route IDs that can be used to send the message
        - object: A rule that only matches if a certain condition is true (e.g. the message has a particular keyword or sender). Always combined with one or more other rules. "If ... then ..." rules can use the following types of conditions: * is * is not * has word * does not have word * contains * does not contain * starts with * does not start with * ends with * does not end with * alphabetically before * alphabetically after * equals * does not equal * less than * greater than * less than or equal to * greater than or equal to * contact is in group * contact is not in group A single "If ... then ..." rule can contain multiple conditions, joined together with either 'and' or 'or'.
          - `type` 'condition', required: Action type identifier
          - `conditions` object[]: Array of condition objects. Required unless <code>if_mode</code> is <code>else</code>.
            - `type` string, required: Condition type. Values: <code>is</code>, <code>is_not</code>, <code>has_word</code>, <code>does_not_have_word</code>, <code>contains</code>, <code>does_not_contain</code>, <code>starts_with</code>, <code>does_not_start_with</code>, <code>ends_with</code>, <code>does_not_end_with</code>, <code>alpha_before</code>, <code>alpha_after</code>, <code>equals</code>, <code>does_not_equal</code>, <code>less_than</code>, <code>greater_than</code>, <code>less_or_equal</code>, <code>greater_or_equal</code>, <code>contact_is_in_group</code>, <code>contact_not_in_group</code>.
            - `variable` string, required: Variable to test, e.g. <code>[[word1]]</code>, <code>[[contact.name]]</code>. Not required for <code>contact_is_in_group</code> and <code>contact_not_in_group</code> conditions.
            - `value` string, required: Value to compare against (or group name for group membership conditions).
          - `actions` Action[], required: Array of actions to execute if the conditions match.
            - union: An action in a Custom Actions service. The `type` property determines which action is performed and what additional properties are available. See [Rules Engine Actions](/api/rules_engine#actions) for detailed documentation.
              - …
          - `op` string: Operator to join multiple conditions. Values: <code>and</code> (all conditions must match), <code>or</code> (any condition must match). Default: <code>or</code>.
          - `if_mode` string: Controls how this condition relates to previous conditions. Values: <code>if</code> (default, starts a new conditional block), <code>else_if</code> (only evaluated if the previous <code>if</code> or <code>else_if</code> did not match), <code>else</code> (executed if none of the previous <code>if</code>/<code>else_if</code> conditions matched; does not require <code>conditions</code> array).
  - `truncated` boolean: True if there are more results
  - `next_marker` string: Marker for pagination
  - `page_size` integer: Number of results per page
  - `sort_dir` 'asc' | 'desc': Sort direction
  - `count` integer: Total count of matching items (only when count=1 parameter is provided)

## Other responses

- `400`: Invalid request parameters
- `401`: Invalid or missing API key or Bearer token
- `404`: Resource not found

---

[API](https://skmtc.dev/telerivet/apis/telerivet-api.md) · [All operations](https://skmtc.dev/telerivet/apis/telerivet-api/llms.txt) · [OpenAPI document](https://skmtc.dev/telerivet/apis/telerivet-api/revisions/4e14b1c8d917?raw)
