# Create esign

URL: https://docs.hanzo.ai/docs/openapi/marketing/post-marketing-leads-esign

> Takes Hanzo eSign's webhook: a SAFE was signed, countersigned, completed, declined or voided, and the investor's form in the brand's CRM moves to that status.

`POST /v1/marketing/leads/esign`

> [Marketing →](https://docs.hanzo.ai/docs/openapi/marketing) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                 |
| ------------- | ----------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/marketing/leads/esign` |
| **Method**    | `POST`                                          |
| **Operation** | `post_marketing_leads_esign`                    |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`          |

Takes Hanzo eSign's webhook: a SAFE was signed, countersigned,
completed, declined or voided, and the investor's form in the brand's CRM moves
to that status. The caller is Hanzo eSign acting as itself: its own IAM
client\_credentials token, verified by the identity boundary like every other.
No caller answers 401, and any caller but eSign's application 403.

A status only moves forward (submitted, investor signed, countersigned,
completed; or declined, or voided), so a replay or a late event changes
nothing. The document must be the one the form recorded; any other, and any
reference that names no investor's form, answers 200 with no status and
changes nothing.

## Request

7 fields, body `application/json` (required).

| Field                                | In   | Type                        | Required | Description                                                                                                                    |
| ------------------------------------ | ---- | --------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `event`                              | body | string                      | —        | Event is what happened: DOCUMENT\_SIGNED (a recipient signed), DOCUMENT\_COMPLETED, DOCUMENT\_REJECTED or DOCUMENT\_CANCELLED. |
| `payload`                            | body | marketing.EsignDocument     | —        |                                                                                                                                |
| `payload.externalId`                 | body | string                      | —        | ExternalID is the reference the document was made under: the lead's.                                                           |
| `payload.id`                         | body | integer (int64)             | —        | ID is the document's id in eSign.                                                                                              |
| `payload.recipients`                 | body | marketing.EsignRecipient\[] | —        | Recipients are the document's signers.                                                                                         |
| `payload.recipients[].signingOrder`  | body | integer (int64)             | —        | SigningOrder is the signer's turn: 1 is the investor, 2 the countersigner.                                                     |
| `payload.recipients[].signingStatus` | body | string                      | —        | SigningStatus is NOT\_SIGNED, SIGNED or REJECTED.                                                                              |

## Response

| Status    | Body              | Meaning |
| --------- | ----------------- | ------- |
| `200`     | marketing.Signing | ok      |
| `default` | problem-details   | refused |

`200` body — 1 field.

| Field    | In   | Type   | Always | Description                                                                                                |
| -------- | ---- | ------ | ------ | ---------------------------------------------------------------------------------------------------------- |
| `status` | body | string | —      | Status is where the SAFE stands: submitted, investor signed, countersigned, completed, declined or voided. |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo marketing leads esign
```

**SDK**

**.ts**

```ts
import { Configuration, MarketingApi } from 'hanzoai';

const api = new MarketingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postMarketingLeadsEsign({ event: "<event>", payload: {"externalId":"<externalId>","id":0,"recipients":[{"signingOrder":0,"signingStatus":"<signingStatus>"}]} });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import MarketingApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = MarketingApi(client).post_marketing_leads_esign(event="<event>", payload={"externalId":"<externalId>","id":0,"recipients":[{"signingOrder":0,"signingStatus":"<signingStatus>"}]})
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.MarketingAPI.PostMarketingLeadsEsign(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, marketing_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = marketing_api::post_marketing_leads_esign(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.MarketingApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new MarketingApi(client).postMarketingLeadsEsign();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/marketing/leads/esign \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "event": "<event>",
       "payload": {
         "externalId": "<externalId>",
         "id": 0,
         "recipients": [
           {
             "signingOrder": 0,
             "signingStatus": "<signingStatus>"
           }
         ]
       }
     }'
```

**MCP**

MCP reaches **marketing** through the `marketing` tool, which names its 82 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_marketing_audiences"
         }
       }
     }'
```

---

[Marketing API](https://docs.hanzo.ai/docs/openapi/marketing) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
