---
title: API routing
description: Let your own server decide where each respondent goes next, based on their answers.
icon: server
sidebar:
  badge: Enterprise
search:
  keywords:
    [
      api routing,
      webhook routing,
      server decides,
      crm lookup,
      dynamic end page,
      api response,
    ]
---

:::note API routing and the API response block are available on **Enterprise**. :::

API routing calls your server while someone fills in the form. Your server looks at the answers, for example to check a customer ID in your CRM, and replies with where to send them next.

## Set it up

1. **Open API routing**

    In the **Outline** panel, open **API routing**.

2. **Choose when it runs**

    Run it after a particular page, or **After submission (chooses the end
    page)**.

3. **Add your endpoint**

    Enter your URL (`https://…`), any headers (for example `Authorization:
    Bearer …`), the **response path** to read (default `next`) and a timeout
    between 3 and 30 seconds.

4. **Verify requests**

    Copy the signing secret. Every request carries an `X-Finerlise-Signature:
    sha256=…` header that you can check. See the [API routing
    reference](/developers/api-routing-reference).

## What your server can reply

Return JSON. Finerlise reads the value at your response path, for example `{ "next": "Book a call" }`.

| Value                         | Result                                  |
| ----------------------------- | --------------------------------------- |
| A page title or ID            | Jumps to that page.                     |
| An end page name or ID        | Shows that end page.                    |
| `end`, `submit` or `complete` | Submits and shows the default end page. |
| An `https://` URL             | Redirects there.                        |
| `next`, `default` or nothing  | Carries on normally.                    |

## Stop a respondent with a message

Reply with an `error` to keep the respondent on the current page and show them your message (up to 280 characters):

```json
{ "error": "We couldn't find that customer ID." }
```

If your server is slow, unreachable or replies with something Finerlise can't read, the form carries on as if no routing was set, so respondents are never stuck.

## API response block

Add an **API response** block (`/api`) to save a value from your server's reply with the submission, for example a customer tier. Set its **API response key** to a key in the reply's `fields` object:

```json
{
  "next": "Book a call",
  "fields": { "tier": "gold", "account_manager": "Sam" }
}
```

Values can be text, numbers or true/false, up to 500 characters each.

**[API routing reference](/developers/api-routing-reference)**

Request payload and signature details.

**[AI end page routing](/logic/ai-end-page-routing)**

Let AI pick the end page instead.
