> ## Documentation Index
> Fetch the complete documentation index at: https://docs.airlead.de/llms.txt
> Use this file to discover all available pages before exploring further.

# End-to-end ingest example

> Walk from a webhook sample through mapping, live ingest, and the first transaction.

# End-to-end ingest example

This example shows the complete path from a partner JSON sample to a delivery transaction.

Product setup first: [Connect source via webhook](/guides/lead-capture/webhook-setup).

Technical contracts: [Lead ingest](/developers/lead-ingest) · [Outbound delivery](/developers/outbound-delivery) · [Partner lifecycle](/developers/partner-lifecycle).

## Goal

1. Receive a synthetic lead through a channel source webhook
2. Publish a mapping
3. Switch the source to live
4. Deliver once
5. Confirm the resulting transaction

## 1. Create the source path in Airlead

In Markets:

1. Create or open a channel.
2. Create an API source.
3. Open **Technik**.
4. Copy the **Test-Webhook** URL.
5. Enable a source secret for anything beyond local testing.

Example live path shape:

```http theme={null}
POST /api/webhooks/channels/{channelId}/sources/{sourceId}/leads
```

## 2. Send a sample payload

While the source is in test mode, send partner-native JSON to the test URL.

Example partner payload:

```json theme={null}
{
  "lead_id": "demo-1001",
  "contact": {
    "first_name": "Alex",
    "last_name": "Example",
    "email": "alex@example.com",
    "phone": "+491701234567"
  },
  "product": "heat-pump",
  "answers": {
    "current_heating": "oil"
  },
  "consent": "granted"
}
```

Confirm the request appears under **Eingänge**.

## 3. Publish the mapping

In **Zuordnen**:

1. Map `contact.first_name` → person first name
2. Map `contact.last_name` → person last name
3. Map `contact.email` / `phone` → person contact fields
4. Map `product` → product
5. Map `answers.*` → interest field values
6. Map `lead_id` → external ID
7. Publish the mapping

Until a mapping is published, Airlead expects the native ingest schema instead of partner-native JSON.

## 4. Validate the records

Open Records and the channel. Confirm:

* one person was created
* one interest exists for the expected product
* field values are correct
* the external ID is stored
* replaying the same `lead_id` returns an idempotent replay

## 5. Go live carefully

1. Switch the source from test to live.
2. Use the live webhook URL for production systems.
3. Keep `triggerAutoDelivery` false, or Delivery 1.0 disabled, until a manual delivery succeeds.
4. Send one more synthetic live lead.

## 6. Deliver and create a transaction

1. Confirm the interest is routing-ready.
2. Confirm at least one buyer is eligible.
3. Deliver manually once.
4. Verify the buyer received the payload.
5. Open the transaction and store its `transactionId`.

Example outbound event fields the buyer should persist:

```json theme={null}
{
  "event": "lead.delivered",
  "transactionId": "txn_...",
  "leadRequestId": "...",
  "leadId": "..."
}
```

## 7. Report the commercial outcome

The buyer system then calls the lifecycle endpoints with the same `transactionId`:

1. confirmation or rejection
2. optional payout pending
3. payout
4. or cancellation / Storno with a required reason

Treat already-applied lifecycle responses as success.

## Success checklist

* [ ] Sample received in Technik
* [ ] Mapping published
* [ ] Person and interest verified
* [ ] External ID replay is idempotent
* [ ] Live URL and secret configured
* [ ] Manual delivery created one transaction
* [ ] Buyer can confirm or cancel with the transaction ID

## If something fails

| Step                      | Start here                                                    |
| ------------------------- | ------------------------------------------------------------- |
| Sample never appears      | URL, secret, JSON content type                                |
| Mapping not publish-ready | Required fields and path selection                            |
| Records look wrong        | Mapping preview and product fields                            |
| No delivery               | [Troubleshoot a delivery](/guides/troubleshooting/delivery)   |
| Buyer callback fails      | [Errors, retries, and limits](/developers/rate-limits-errors) |

Next: [Lead ingest](/developers/lead-ingest) · [Outbound delivery](/developers/outbound-delivery) · [API reference](/api-reference/introduction)
