# Take in a new lead from a form or a call

The composite deal intake: finds or creates the merchant, creates the deal on it, and optionally links the lead it came from — all in ONE transaction, so a failed deal never leaves an orphan merchant behind. `merchant.legalName` is required; `deal.productType`, `deal.requestedAmount` and `deal.name` fill the new record, and `leadRowId` writes the relation back to the lead. Answers 201. Deals page only.

Access class: `def:read`.

## Endpoint

`POST /v1/definitions/{key}/rows/intake`

## Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| key | path | string | Yes |

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "deal": {
      "name": "string",
      "productType": "string",
      "requestedAmount": 1.5
    },
    "leadRowId": "",
    "merchant": {
      "contactEmail": "string",
      "contactPhone": "string",
      "ein": "string",
      "industry": "string",
      "legalName": "string",
      "state": "string"
    }
  },
  "params": {
    ":key": "string"
  },
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "deal": {
      "archived_at": "string",
      "assignees": {},
      "cells": {},
      "createdBy": "string",
      "display": {},
      "externalId": "",
      "groupId": "",
      "id": "",
      "position": 1,
      "source": "string"
    },
    "merchant": {
      "archived_at": "string",
      "assignees": {},
      "cells": {},
      "createdBy": "string",
      "display": {},
      "externalId": "",
      "groupId": "",
      "id": "",
      "position": 1,
      "source": "string"
    },
    "merchantCreated": true
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
