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

# contact.created

> Occurs when a contact is created.

Use `contact.created` to handle this event at your webhook endpoint.

## Triggers

Occurs when a contact is created.

Subscribe to `contact.created` when you [configure your webhook endpoint](https://docs.ycloud.com/en/api-reference/guides/api-fundamentals/configure-webhooks.md).

## Syntax

YCloud sends an HTTP `POST` request to your configured webhook URL. The following shape shows one payload variant. Angle-bracket values are placeholders; their types are listed under **Parameters**. Optional fields and other variants are described below.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "contact.created",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "contactCreated": {
    "id": "<ID>",
    "remarkName": "<REMARK_NAME>",
    "nickName": "<NICK_NAME>",
    "realName": "<REAL_NAME>",
    "phoneNumber": "<PHONE_NUMBER>",
    "countryCode": "<COUNTRY_CODE>",
    "countryName": "<COUNTRY_NAME>",
    "email": "<EMAIL>",
    "sourceType": "<SOURCE_TYPE>",
    "sourceId": "<SOURCE_ID>",
    "sourceUrl": "<SOURCE_URL>",
    "lastSeen": "<LAST_SEEN>",
    "lastConnectedNumber": "<LAST_CONNECTED_NUMBER>",
    "ownerEmail": "<OWNER_EMAIL>",
    "tags": [
      "<TAGS>"
    ],
    "createTime": "<CREATE_TIME>",
    "updateTime": "<UPDATE_TIME>",
    "blocked": "<BLOCKED_VALUE>",
    "customAttributes": {
      "attr1": "<ATTR1>",
      "attr2": "<ATTR2>",
      "attr3": "<ATTR3_VALUE>"
    }
  }
}
```

## Parameters

Validate the `YCloud-Signature` HTTP header before you process the JSON body. See [signature validation](https://docs.ycloud.com/en/api-reference/guides/api-fundamentals/configure-webhooks.md).

### Event envelope

| Parameter | Type | Required | Description |
| - | - | - | - |
| `id` | string | Yes | Unique ID for the event. Minimum length: `6`. Maximum length: `128`. |
| `type` | string | Yes | Always `contact.created`. |
| `apiVersion` | string | Yes | The API version used to render this event. |
| `createTime` | string (date-time) | Yes | The time at which this event was created, formatted in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339). e.g., `2022-06-01T12:00:00.000Z`. |

### Event payload

| Parameter | Type | Required | Description |
| - | - | - | - |
| `contactCreated` | object | No | Event-specific `contactCreated` payload. |

The four common envelope fields are required. Payload fields depend on the event variant. In each object table, **Required** applies when its parent object is present. Optional fields can be omitted; a sample does not make a field required.

#### contactCreated

| Parameter | Type | Required | Description |
| - | - | - | - |
| `id` | string | Yes | Unique ID for the object. |
| `remarkName` | string | No | The business-managed remark name for the contact. |
| `nickName` | string | No | Contact's nickname. |
| `realName` | string | No | Contact's real name. |
| `phoneNumber` | string | No | Unique Phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format. |
| `countryCode` | string | No | Two-letter country abbreviation. See [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). |
| `countryName` | string | No | Full country name. |
| `email` | string | No | The contact's email address. If present, the email address must be unique. |
| `sourceType` | string | No | The source type where the contact was created. |
| `sourceId` | string | No | The source ID where the contact was created. |
| `sourceUrl` | string | No | The source URL where the contact was created. |
| `lastSeen` | string (date-time) | No | The time at which the contact last sent a message to your business, formatted in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339). e.g., `2022-06-01T12:00:00.000Z`. |
| `lastConnectedNumber` | string | No | The business phone number that the contact last connected to. |
| `ownerEmail` | string | No | The email address of the contact's owner. |
| `tags` | string\[] | No | Contact's tags. |
| `createTime` | string (date-time) | No | The time at which the contact was created, formatted in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339). e.g., `2022-06-01T12:00:00.000Z`. |
| `updateTime` | string (date-time) | No | The time at which the contact was last updated, formatted in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339). e.g., `2022-06-01T12:00:00.000Z`. |
| `blocked` | boolean | No | Whether the contact is blocked. |
| `customAttributes` | object | No | Contact's custom attributes as key-value pairs. |

## Example

The following JSON is the body delivered to your receiver. IDs, phone numbers, and other account values are illustrative.

> [accordion] Contact created event
>
> Example payload when a new contact is created
>
> ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
> {
>   "id": "evt_2345678901",
>   "type": "contact.created",
>   "apiVersion": "v2",
>   "createTime": "2024-01-01T12:00:00.000Z",
>   "contactCreated": {
>     "id": "1824266594102064128",
>     "remarkName": "Priority customer",
>     "nickName": "John Doe",
>     "realName": "John Smith",
>     "phoneNumber": "+12025550124",
>     "countryCode": "US",
>     "countryName": "United States",
>     "email": "recipient@example.com",
>     "sourceType": "api",
>     "sourceId": "import_batch_123",
>     "sourceUrl": "https://example.com/signup",
>     "lastSeen": "2024-01-01T11:59:00.000Z",
>     "lastConnectedNumber": "+16315552222",
>     "ownerEmail": "owner@example.com",
>     "tags": [
>       "premium",
>       "newsletter"
>     ],
>     "createTime": "2024-01-01T12:00:00.000Z",
>     "updateTime": "2024-01-01T12:00:00.000Z",
>     "blocked": false,
>     "customAttributes": {
>       "attr1": "value1",
>       "attr2": "value2",
>       "attr3": 123
>     }
>   }
> }
> ```

> [accordion] Contact Created Example
>
> ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
> {
>   "id": "evt_2345678901",
>   "type": "contact.created",
>   "apiVersion": "v2",
>   "createTime": "2024-01-01T12:00:00.000Z",
>   "contactCreated": {
>     "id": "1824266594102064128",
>     "nickName": "John Doe",
>     "realName": "John Smith",
>     "phoneNumber": "+12025550124",
>     "countryCode": "US",
>     "countryName": "United States",
>     "email": "recipient@example.com",
>     "sourceType": "api",
>     "sourceId": "import_batch_123",
>     "sourceUrl": "https://example.com/signup",
>     "lastSeen": "2024-01-01T11:59:00.000Z",
>     "lastConnectedNumber": "+16315552222",
>     "ownerEmail": "owner@example.com",
>     "tags": [
>       "premium",
>       "newsletter"
>     ],
>     "createTime": "2024-01-01T12:00:00.000Z",
>     "updateTime": "2024-01-01T12:00:00.000Z",
>     "blocked": false,
>     "customAttributes": {
>       "company": "YCloud Inc",
>       "age": 25
>     }
>   }
> }
> ```

After verifying the signature and durably accepting the event, return a `2xx` response. Process slow work asynchronously.

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
HTTP/1.1 200 OK
```

For scenario walkthroughs, see [annotated examples](https://docs.ycloud.com/en/api-reference/guides/examples/webhook-examples/contact-created-webhook-examples).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.