> For the complete documentation index, see [llms.txt](https://docs.insurgrid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.insurgrid.com/intake-forms/attach-your-own-id-with-traceid.md). Agents can also search and read this documentation through its [MCP server](https://docs.insurgrid.com/~gitbook/mcp).

# Attach your own ID with traceId

Add your own request or lead ID to a form link and get it back on the webhook for that submission.

Every visit to an InsurGrid form gets a **trace ID**: one value that follows the visitor through the form, any carrier login after it, and into the webhooks you receive. InsurGrid creates one automatically. If you'd rather it was **your** ID, such as a request ID, lead ID or CRM record ID, put it on the form link and it comes back to you on the webhook for that submission.

That way you can match each submission to your own record directly, without matching on names or email addresses.

***

## Add it to the link

Add `traceId` to the form's link as a query parameter:

```
https://link.insurgrid.com/jane-smith/form/f_9c2a7b1e4d/apartment-intake-acme?traceId=REQ-48213
```

It works the same with other parameters, for example when embedding:

```
https://link.insurgrid.com/jane-smith/form/f_9c2a7b1e4d/apartment-intake-acme?embed=1&traceId=REQ-48213
```

The parameter name is case-sensitive: `traceId`, with a capital `I`.

Nothing needs setting up in InsurGrid first. Any published form link accepts it, on staging (`link-staging.insurgrid.com`) and production (`link.insurgrid.com`).

***

## If you leave it off

`traceId` is optional. Without it, InsurGrid generates a trace ID for each visitor: a random UUID such as `3f6c1a9e-8b2d-4e57-a1c0-7d94e2b5f018`. It behaves exactly like one you supply. It covers the whole visit and comes back as `data.trace_id` on the same webhooks. The only difference is that you have no record of it on your side until the first webhook arrives.

So you can add `traceId` to some links and not others. Links without it keep working as they always have.

***

## What a valid trace ID looks like

| Rule                                        | Why                                                                                                                                                             |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **64 characters or fewer.**                 | A longer value is ignored on the `form-submission` event, which then shows `trace_id: null`. The form still submits normally, so there is no error to warn you. |
| **Letters, digits, `-`, `_` and `.` only.** | Other characters can be dropped or rejected along the way. Spaces and non-English characters are the usual problem.                                             |
| **URL-encoded.**                            | Use `encodeURIComponent` (or your language's equivalent) when you build the link.                                                                               |
| **Not personal data.**                      | The ID is stored with the submission and appears in logs. Use an opaque ID, never an email address, name or phone number.                                       |

A UUID, or your own prefix plus a number (`REQ-48213`, `lead_9f2a7b`), is ideal.

***

## One ID per person

Generate a **separate link for each person** you send the form to, each with its own ID.

Everything that happens on a link carrying a `traceId` is filed under that ID. If you put the same ID on a link you send to many people, or on a button on your public website, every one of those submissions arrives with the same `trace_id` and you can no longer tell them apart.

For a link shared with many people, leave `traceId` off and let InsurGrid create one per visitor.

***

## Where you get it back

The ID comes back as `trace_id` inside `data`, on both webhook events.

### `form-submission`

Sent when the person submits the form. `trace_id` is the value from the link:

```json
{
  "topic": "form-submission",
  "data": {
    "submission_id": 55231,
    "trace_id": "REQ-48213",
    "submitted_at": "2026-08-24T18:22:40Z",
    "form": { "id": 4412, "public_id": "f_9c2a7b1e4d", "name": "Apartment Intake — Acme Agency" },
    "contact": { "name": "Jimmy Swanson", "email": "jimmy.swanson@example.com", "phone": "(555) 010-1234" },
    "answers": [ … ]
  }
}
```

The full payload is in [Form submission](https://docs.insurgrid.com/data-webhook-page/webhooks/data-format/form-submission.md).

### `client-submission`

If the form hands the person over to log in to their insurance carrier, the policy data that comes back from that login arrives later as a `client-submission` event. It carries the same `trace_id`:

```json
{
  "topic": "client-submission",
  "data": {
    "document_link": "https://files.insurgrid.com/dl/9f2a7b/declaration.pdf",
    "policy_type": "Personal Auto",
    "policy": { … },
    "policyholder": { … },
    "trace_id": "REQ-48213"
  }
}
```

The same applies to an ordinary policy-connect link (one without `/form/` in it): add `?traceId=` and it comes back on `client-submission`.

### When `trace_id` is `null`

Treat `trace_id` as optional and handle `null`. You will see it when:

* the value on the link was longer than 64 characters;
* the submission didn't start from a browser visit to a link, for example a document uploaded directly in the dashboard.

***

## How long the ID lasts

The ID is held in the visitor's browser and **stays active while they keep using InsurGrid, until they have been away for an hour**. So:

* Reloading the page, going back a step, or carrying on to a carrier login all keep the same ID. Nothing extra needs adding to later pages.
* If the same browser opens a link **without** a `traceId` within that hour, it reuses the last ID. In practice that only matters when one person tests several links in a row, as in the next section.
* Opening a link **with** a different `traceId` always switches to the new one straight away.

***

## Test it

1. Build a link with a test ID, e.g. `?traceId=test-001`, on a published form.
2. Open it in a **new private or incognito window** so no earlier ID is carried over.
3. Submit the form all the way to the confirmation screen.
4. Check the `form-submission` event that reaches your endpoint (or the webhook logs in the dashboard). `data.trace_id` should be `test-001`.

For each new test, use a new ID and a fresh private window.

***

## Related

* [Quickstart B — Share a form and receive submissions](https://docs.insurgrid.com/intake-forms/b-embed-form.md)
* [Data format](https://docs.insurgrid.com/data-webhook-page/webhooks/data-format.md)
* [Delivery & de-duplication](https://docs.insurgrid.com/guides/delivery-dedup.md): de-duplicate on `submission_id`, not `trace_id`, because one trace ID can cover more than one event.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.insurgrid.com/intake-forms/attach-your-own-id-with-traceid.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
