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

# Update automation contact properties

> **Endpoint:** `v1/automation/contacts/{email}`

Update a contact's properties using deep merge with null deletion. Properties can be used in workflow conditions and email personalization.

**Merge Behavior:**
- **Omitted fields**: Preserved unchanged in existing properties
- **Fields with values**: Updated or added to properties
- **Fields set to `null`**: Explicitly deleted from properties
- **Nested objects**: Recursively merged (NOT replaced entirely)
- **Arrays**: Replaced entirely (NOT merged element-wise)

**Unsubscribe Management:**
To manage subscriptions, include `{{ unsubscribe_url }}` in your email templates. When a contact clicks this link, they will be automatically unsubscribed from the workflow. Subscription status cannot be managed via this endpoint.

**Note:** Contact must exist before updating. Send an event first to create the contact.




## OpenAPI

````yaml api-reference/openapi.yml patch /automation/contacts/{email}
openapi: 3.1.0
info:
  title: Send Email API
  description: >
    Send transactional emails through MailDiver.


    ### Base URL

    All API endpoints are prefixed with `api.` subdomain:

    ```

    https://api.maildiver.com

    ```


    For the self-hosted version, if your domain is `example.com`:

    ```

    https://api.example.com

    ```


    ### Endpoint

    ```

    v1/emails

    ```


    ### Authentication

    All API requests require authentication using your API key in the
    Authorization header:

    ```

    Authorization: Bearer your-api-key

    ```
  version: 1.0.0
  license:
    name: MIT
servers:
  - url: https://api.maildiver.com/v1
    description: Production server
    variables:
      domain:
        default: yourdomain.com
        description: Your domain (without the api. prefix)
security:
  - bearerAuth: []
paths:
  /automation/contacts/{email}:
    patch:
      tags:
        - Automation Contact
      summary: Update automation contact properties
      description: >
        **Endpoint:** `v1/automation/contacts/{email}`


        Update a contact's properties using deep merge with null deletion.
        Properties can be used in workflow conditions and email personalization.


        **Merge Behavior:**

        - **Omitted fields**: Preserved unchanged in existing properties

        - **Fields with values**: Updated or added to properties

        - **Fields set to `null`**: Explicitly deleted from properties

        - **Nested objects**: Recursively merged (NOT replaced entirely)

        - **Arrays**: Replaced entirely (NOT merged element-wise)


        **Unsubscribe Management:**

        To manage subscriptions, include `{{ unsubscribe_url }}` in your email
        templates. When a contact clicks this link, they will be automatically
        unsubscribed from the workflow. Subscription status cannot be managed
        via this endpoint.


        **Note:** Contact must exist before updating. Send an event first to
        create the contact.
      operationId: updateAutomationContact
      parameters:
        - name: email
          in: path
          required: true
          description: Contact's email address
          schema:
            type: string
          example: user@example.com
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                properties:
                  type: object
                  description: >-
                    Contact properties to merge (key-value pairs, set to null to
                    delete)
                  example:
                    first_name: John
                    plan: enterprise
            examples:
              basic_update:
                summary: Basic update
                value:
                  properties:
                    first_name: John
                    last_name: Doe
                    plan: enterprise
              delete_field:
                summary: Delete field with null
                value:
                  properties:
                    old_field: null
              merge_nested:
                summary: Merge nested object (preserves unchanged nested fields)
                value:
                  properties:
                    user:
                      profile:
                        avatar: new-photo.jpg
              delete_nested_field:
                summary: Delete nested field
                value:
                  properties:
                    user:
                      profile:
                        avatar: null
              replace_array:
                summary: Replace array entirely
                value:
                  properties:
                    tags:
                      - new
                      - tags
              delete_array:
                summary: Delete array with null
                value:
                  properties:
                    tags: null
      responses:
        '200':
          description: Contact successfully updated
          content:
            application/json:
              examples:
                success:
                  summary: Success response
                  value:
                    message: Contact metadata updated successfully
                    email: user@example.com
                    updated_properties:
                      - first_name
                      - last_name
                      - plan
                      - company
        '400':
          description: Bad request
          content:
            application/json:
              examples:
                emailRequired:
                  summary: Email is required
                  value:
                    error: Email is required
                invalidEmail:
                  summary: Invalid email format
                  value:
                    error: Invalid email format
                invalidJson:
                  summary: Invalid JSON payload
                  value:
                    error: Invalid JSON payload
                invalidProperties:
                  summary: Invalid properties
                  value:
                    error: properties must be an object
                emptyProperties:
                  summary: Empty properties
                  value:
                    error: properties cannot be empty
        '403':
          description: Forbidden (API key is missing or invalid)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Contact not found
          content:
            application/json:
              examples:
                notFound:
                  summary: Contact not found
                  value:
                    error: >-
                      Contact not found. Send an event first to create the
                      contact.
        '500':
          description: Internal server error
          content:
            application/json:
              examples:
                serverError:
                  summary: Internal server error
                  value:
                    error: Failed to update contact metadata
                    details: Unknown error
components:
  schemas:
    Error:
      type: object
      properties:
        message:
          type: string
          description: Error description
      description: |
        Error response with message.

        ### Common Errors

        #### 400 Bad Request
        Validation errors return only the error message:
        ```json
        {
          "message": "from field is required"
        }
        ```

        Common validation messages:
        - `"from field is required"`
        - `"to field is required"`
        - `"subject field is required"`
        - `"html content size (42MB) exceeds maximum of 40MB"`
        - `"Too many recipients: 51. Maximum allowed is 50"`
        - `"Invalid email format in from field"`
        - `"template_id cannot be used together with html"`

        #### 403 Forbidden
        Authentication errors include both message and code:
        ```json
        {
          "message": "Invalid API key",
          "code": "invalid_api_key"
        }
        ```
        ```json
        {
          "message": "Invalid authorization header",
          "code": "invalid_authorization_header"
        }
        ```

        #### 404 Not Found
        ```json
        {
          "message": "Template 'welcome-email' not found"
        }
        ```
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key with format "Bearer {your-api-key}"

````