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

# Create with AI

> Send unstructured text and let Goliath's AI extract and create or update a contact.

`POST …/contacts/create-with-ai`

The recommended endpoint for messy or unstructured data — obituaries, scraped listings, form submissions, notes. Goliath's AI extracts name, phone, email, and address from the text and creates or updates the contact automatically.

This endpoint is **asynchronous**. It enqueues the work and returns immediately. The contact may not exist yet when you receive the response.

***

## Request

```bash theme={null}
POST {WEBHOOK_BASE_URL}/{token}/contacts/create-with-ai
Content-Type: application/json
```

```json theme={null}
{
  "unstructured_text": "John Doe passed away on January 1st. He lived at 123 Main St, Springfield. His daughter Jane can be reached at jane.doe@example.com or 555-000-0001.",
  "tags": ["probate", "springfield"],
  "source": "Obituary Scraper",
  "contributors": ["Sarah Smith"]
}
```

***

## Body fields

| Field               | Type                | Required | Description                                                                                    |
| ------------------- | ------------------- | -------- | ---------------------------------------------------------------------------------------------- |
| `unstructured_text` | string or string\[] | Yes      | The raw text for AI extraction. Arrays are joined with newlines. Non-string items are dropped. |
| `full_name`         | string              | No       | Overrides the AI-resolved name                                                                 |
| `phone_number`      | string              | No       | Overrides the AI-resolved phone                                                                |
| `contact_email`     | string              | No       | Overrides the AI-resolved email                                                                |
| `contact_address`   | string              | No       | Overrides the AI-resolved address                                                              |
| `note`              | string              | No       | Additional context passed into the AI flow                                                     |
| `tags`              | string\[]           | No       | Applied to the contact after creation                                                          |
| `source`            | string              | No       | Defaults to `Webhook` if omitted                                                               |
| `contributors`      | string\[]           | No       | Full names of org users to assign as contributors                                              |

<Warning>
  If `unstructured_text` is missing or empty after trimming, no contact work is performed — even though the request returns `200`. Always ensure this field has meaningful content.
</Warning>

<Note>
  `first_name` and `last_name` are supported but deprecated on create flows. Use `full_name` instead.
</Note>

***

## Responses

**New event**

```json theme={null}
200 OK

{
  "success": true,
  "acknowledged": true,
  "eventId": "a1b2c3d4-0000-0000-0000-000000000000"
}
```

**Duplicate event** (same payload already received)

```json theme={null}
200 OK

{
  "success": true,
  "acknowledged": true
}
```

<Note>
  Duplicate detection is based on a hash of the payload. If a duplicate is detected, the response is still `200` but `eventId` is omitted. No duplicate contact is created.
</Note>

***

## Deprecated alias

`POST …/contacts/unstructured` is a deprecated alias for this endpoint. It behaves identically but should not be used in new integrations.
