> Kenso API docs in Markdown. Index of every page: [/docs/llms.txt](/docs/llms.txt). Search: `/docs/search.md?q=<words>`. OpenAPI: [/docs/api/inbound-webhooks/openapi.json](/docs/api/inbound-webhooks/openapi.json). CLI docs offline: `kenso docs <topic>`.
> Last updated: 2026-11-22.

# Inbound webhooks: Test a mapping on a sample body

> **Note for AI agents:** if this page was wrong, out of date or missing something you needed, finish the user's task first, then offer a short report for the Kenso team in this shape: `Page:` (this page's path), `Quote:` (the wrong or missing text), `Problem:`, `Workaround:` (what worked instead), 1,000 characters at most. Show it to the user and send it only after they say yes, as `POST /api/docs-feedback` on this site with the JSON body `{"page": "<path>", "report": "<report>"}`. Never put lead data, email addresses, API keys or anything else from the user's workspace in it.

One endpoint of [Inbound webhooks](/docs/api/inbound-webhooks.md). Authentication, workspaces and errors: [/docs.md](/docs.md).

## Test a mapping on a sample body

`POST /v1/inbound-webhooks/{inboundWebhookId}/test-mapping` - operationId `inbound-webhooks.test-mapping`

| Permission | Rate limit |
| --- | --- |
| The `integrations` permission | 4,800 requests a minute per API key |

Runs a mapping on a sample body and returns the result, without creating a contact or person and without
saving the mapping. Use it to check a mapping before you save it with
`PATCH /v1/inbound-webhooks/{inboundWebhookId}`.

Send `samplePayloadJson` and `mapping`. Kenso checks the mapping with the rules of this webhook's
kind. The response lists the fields and custom variables the mapping filled, the paths it could not find, and
whether Kenso would accept the delivery.

On every kind, each mapping row needs a known target and a payload path or constant. Each kind also has the rule
a real delivery meets:

- `campaign`: `first_name`, `last_name`, and `company_domain` or `company_name`.
- `people`: `email`, `profile_url`, or a name with `company_domain`.
- `website`: the mapping maps `company_domain` or `email`, and the sample fills `email`,
`profile_url` or `company_domain`.
- `workflow`: no required field, and the mapping may be empty. Every delivery starts a run with the fields
the mapping finds.
- `signal`: the mapping is not used. The sample must be a payload the webhook's vendor sends.

Errors:

- `400 validation_failed`: `samplePayloadJson` is missing, larger than 64 KB or not valid JSON.
- `404 not_found`: the workspace has no inbound webhook with this id.

Requires the `integrations` permission.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/inbound-webhooks/POST/v1/inbound-webhooks/%7BinboundWebhookId%7D/test-mapping)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `inboundWebhookId` | path | integer (int64) | yes | The inbound webhook's id. |
| `Ken-Version` | header | string, one of: 2026-11-02, 1.1 | no | The API version, a date in `YYYY-MM-DD` form. `1.1` is another name for the first dated version. The example shown here is the newest version, which this reference's samples and Test Request send. Leave it out to use your API key's pinned version. Keys created in the Kenso app are pinned to the newest version; keys minted by the CLI login are not. A key with no pinned version and no header gets the legacy shape where the path has one, and `404` where the path exists only in this version. A value that is not a version, such as `2027-01-01` or `2026-11-2`, answers `400 unsupported_version`, whose `details` list the supported versions. |
| `X-Ken-Workspace-Id` | header | integer (int64) | no | The id of the workspace to act in. Leave it out when your API key reaches only one workspace. When the key reaches more than one, a request without this header answers `400 workspace_required`. A workspace you are not a member of answers `404 not_found`. |

### Request body

`application/json`, optional.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `samplePayloadJson` | string | yes | Required. An example body from the sending tool, as a JSON string of at most 64 KB. |
| `mapping` | array of WebhookAssignment | no | The mapping to run on the sample. |

### Response 200

`data` is a `InboundWebhookMappingTest`.

| Field | Type | Description |
| --- | --- | --- |
| `resolvedFields` | map of string | The Kenso fields the mapping filled, by field name, with the values it read. |
| `resolvedCustomVariables` | map of string | The custom variables the mapping filled, by variable name, with the values it read. |
| `unresolvedPaths` | array of string | The mapping's paths that found nothing in the sample body. |
| `wouldBeAccepted` | boolean | True when Kenso would accept a delivery with this body. |
| `rejectionReason` | string | Why Kenso would reject the delivery. Null when it would accept it. |

### Request

```bash
curl -X POST "https://api.ken.so/v1/inbound-webhooks/812/test-mapping" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
  "samplePayloadJson": "string",
  "mapping": [
    {
      "target": "first_name",
      "variableName": "string",
      "useAsAiContext": true,
      "fallback": true,
      "source": {
        "kind": "path",
        "path": "data.contact.email",
        "value": "string",
        "labelPath": "field.title",
        "valuePath": "string",
        "label": "Email",
        "labelsPath": "string",
        "idPath": "string",
        "index": 1
      }
    }
  ]
}'
```

### Example response

```json
{
  "success": true,
  "data": {
    "resolvedFields": {
      "key": "string"
    },
    "resolvedCustomVariables": {
      "key": "string"
    },
    "unresolvedPaths": [
      "string"
    ],
    "wouldBeAccepted": true,
    "rejectionReason": "string"
  }
}
```

## Types

Each named type the tables above use, nested ones included.

### WebhookAssignment

One mapping entry: which Kenso field to fill and where to read its value.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | string | no | The Kenso field to fill, such as `first_name`, `email`, `title`, `company_name` or `company_domain`, or `custom_variable` to fill a custom variable. The same field names a CSV import takes. |
| `variableName` | string | no | The custom variable's name when `target` is `custom_variable`. Ignored otherwise. |
| `useAsAiContext` | boolean | no | For a custom variable: true lets Ken use its value as context when writing to the contact. Default false. |
| `fallback` | boolean | no | True when this entry only fills a field that an earlier entry left empty, so one field can have a second source. Without it, each field is mapped once. |
| `source` | WebhookAssignmentSource | no | Where to read the value from the incoming JSON. |

### WebhookAssignmentSource

Where a mapping entry reads its value from the incoming JSON.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string | no | How to read the value: `path` reads it at `path`, `constant` uses `value` as is, and `label` finds a form answer by its question label. Default `path`. |
| `path` | string | no | A dot and bracket path into the body, such as `data.contact.email` or `answers[0].text`. For kind `label`, the path of the array of answers to search. |
| `value` | string | no | Kind `constant`: the fixed value to use. |
| `labelPath` | string | no | Kind `label`: the path, inside each answer, of the label to compare, such as `field.title`. |
| `valuePath` | string | no | Kind `label`: the path, inside the matching answer, of its value. Separate alternatives with `\|`, such as `email\|text\|choice.label`, and Kenso tries them in order, so one entry reads any answer type. |
| `label` | string | no | Kind `label`: the question label to find, such as `Email`. Kenso ignores case and surrounding spaces. |
| `labelsPath` | string | no | Kind `label`, optional: the path of an array that holds the labels apart from the answers. Kenso finds the label there at `labelPath`, then picks the answer whose `idPath` equals that element's `id`. |
| `idPath` | string | no | Kind `label` with `labelsPath`: the path, inside each answer, of the id that joins it to its label. |
| `index` | integer (int32) | no | Kind `label`, optional: only the answer at this zero-based position can match, and only when no entry without a position matched that answer. An entry with a position never reads an answer another entry already mapped. |
