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

# Send records from Clay sheet

> Learn how to send records from a Clay sheet into Unify via webhook.

## Overview

This tutorial walks through the process of sending records from a Clay sheet
into Unify. To do this, we'll set up a webhook in Clay that sends records to the
[Data API](/developers/api/data/overview).

<Tip>
  This guide uses a sheet of companies as an example, but the same approach can
  be used for any object type, such as `person` or a custom object.
</Tip>

## Prerequisites

* An existing Clay sheet that you want to send into Unify
* An existing [API key](https://app.unifygtm.com/dashboard/settings/integrations/api-keys) for Unify

## Steps

<Steps titleSize="h3">
  <Step title="Select the webhook action">
    Navigate to your Clay sheet and open the **Actions** pane.

    <Frame caption="The webhook action appears under Enrichments in the Actions pane.">
      <img src="https://mintcdn.com/unify-19/sc9t8pwF45Nnu44g/images/developers/guides/send-data/clay-webhook/clay-sheet-select-action.png?fit=max&auto=format&n=sc9t8pwF45Nnu44g&q=85&s=7b039977d07e1b98add67004e02b52af" width="2304" height="1639" data-path="images/developers/guides/send-data/clay-webhook/clay-sheet-select-action.png" />
    </Frame>

    Under **Enrichments**, select **View all enrichments** and then choose **HTTP API**.

    <Frame caption="Select the HTTP API action from the menu.">
      <img src="https://mintcdn.com/unify-19/sc9t8pwF45Nnu44g/images/developers/guides/send-data/clay-webhook/clay-sheet-select-enrichment.png?fit=max&auto=format&n=sc9t8pwF45Nnu44g&q=85&s=f9813c324d0b8ae5cf868f4ad976372f" width="2304" height="1639" data-path="images/developers/guides/send-data/clay-webhook/clay-sheet-select-enrichment.png" />
    </Frame>

    <Frame caption="After selecting the HTTP API action, the configuration panel should appear.">
      <img src="https://mintcdn.com/unify-19/sc9t8pwF45Nnu44g/images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-empty.png?fit=max&auto=format&n=sc9t8pwF45Nnu44g&q=85&s=0ba92680880b5505c3385e09eba21a04" width="2304" height="1639" data-path="images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-empty.png" />
    </Frame>
  </Step>

  <Step title="Add credentials">
    Select the **Configure** tab. Under **Select HTTP API (Headers) account**, choose **Add account**.

    <Frame caption="The Configure tab can be selected in the top-right corner of the panel.">
      <img src="https://mintcdn.com/unify-19/sc9t8pwF45Nnu44g/images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-empty-configure.png?fit=max&auto=format&n=sc9t8pwF45Nnu44g&q=85&s=e3819f6d331e4c235b098b09965ed0e3" width="2304" height="1639" data-path="images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-empty-configure.png" />
    </Frame>

    <Note>
      If you have already completed this step in the past, you can simply select
      your existing headers account for Unify.
    </Note>

    Give the new account a name (e.g., "unify-api") and add a header named
    `X-Api-Key` whose value is your Unify API key.

    <Frame caption="Fill in your Unify credentials here.">
      <img src="https://mintcdn.com/unify-19/sc9t8pwF45Nnu44g/images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-add-headers.png?fit=max&auto=format&n=sc9t8pwF45Nnu44g&q=85&s=9530eabaab7687ea7b4a2058e471d331" width="2304" height="1639" data-path="images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-add-headers.png" />
    </Frame>

    Select **Save** to confirm the credentials.
  </Step>

  <Step title="Determine which object to use">
    You can send records into Unify for any standard or custom object using the
    [Data API](/developers/api/data/overview). Before constructing the request,
    decide which object you want to send records into (e.g., company, person, or
    a custom object).

    Once you've picked an object, you will need its API name. The API name can
    be found on the [object settings page](https://app.unifygtm.com/dashboard/settings/integrations/objects).
    For example, the company object's API name is `company`.

    For an overview of how objects work in Unify, see [Objects in Unify](/reference/objects/overview).
  </Step>

  <Step title="Construct the request">
    The best way to send data into Unify is with the [Upsert method](/developers/api/data/records/upsert).
    The URL for this API method is:

    ```http theme={null}
    https://api.unifygtm.com/data/v1/objects/{object_name}/records/upsert
    ```

    <Note>
      You will need to replace `{object_name}` with the API name of the object you
      want to send records into (e.g., `company`, `person`, or a custom object).

      For example, the company object's API name is `company`, so the URL is:

      ```http theme={null}
      https://api.unifygtm.com/data/v1/objects/company/records/upsert
      ```
    </Note>

    Under **Setup Inputs**, fill in a few fields:

    * **Method**: Choose `POST` when performing an upsert. For other operations,
      use the correct method from the API reference.
    * **Endpoint**: Insert the URL of the API constructed above.
    * **Body**: A valid payload for the [Upsert method](/developers/api/data/records/upsert). For example:

      ```json theme={null}
      {
        "match": {
          "domain": "{{Website}}"
        },
        "create_or_update_if_empty": {
          "name": "{{Company Name}}",
          "domain": "{{Website}}",
          "status": "{{Status}}"
        }
      }
      ```

      A person upsert can also include a nested company match or upsert:

      ```json theme={null}
      {
        "match": {
          "email": "{{Email}}"
        },
        "create_or_update_if_empty": {
          "first_name": "{{First Name}}",
          "last_name": "{{Last Name}}",
          "email": "{{Email}}",
          "title": "{{Title}}",
          "company": {
            "match": {
              "domain": "{{Company Domain}}"
            },
            "create_or_update_if_empty": {
              "name": "{{Company Name}}",
              "domain": "{{Company Domain}}"
            }
          }
        }
      }
      ```

      Be sure to replace these placeholders with the actual column names from
      your Clay sheet. Press the slash (`/`) key to select a column when editing
      the body.

          <Warning>
            Don't forget to include quotation marks around the column placeholders!
          </Warning>

    That's it! All of the other settings can be left in their default state or
    modified as needed.

    <Frame caption="A fully configured HTTP API action for upserting records into Unify.">
      <img src="https://mintcdn.com/unify-19/sc9t8pwF45Nnu44g/images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-json-body.png?fit=max&auto=format&n=sc9t8pwF45Nnu44g&q=85&s=7b4dd14395834c610fb48206febde0de" width="2304" height="1639" data-path="images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-json-body.png" />
    </Frame>
  </Step>

  <Step title="Test and save">
    Once the action is configured, you can test it by clicking the **Try on 5 rows**
    button. You should see a status code in the range 200-299 if the request was
    successful.

    <Frame caption="Test the configured API call for the first five rows in the sheet.">
      <img src="https://mintcdn.com/unify-19/sc9t8pwF45Nnu44g/images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-preview.png?fit=max&auto=format&n=sc9t8pwF45Nnu44g&q=85&s=94ff091f44f51890ce06aed2537f586c" width="2304" height="1639" data-path="images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-preview.png" />
    </Frame>

    Finally, select **Save** and choose whether you want to immediately run the
    action on all rows in the sheet. Once run, you should see successful status
    codes appear in the column.

    <Frame caption="Test the configured API call for the first five rows in the sheet.">
      <img src="https://mintcdn.com/unify-19/sc9t8pwF45Nnu44g/images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-success.png?fit=max&auto=format&n=sc9t8pwF45Nnu44g&q=85&s=02633071b32bd8f8fb0897cd2b022724" width="2304" height="1639" data-path="images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-success.png" />
    </Frame>

    You can click into any cell in the column to see the full response from the
    API. Typically, the Data API will return the full record that was created or
    updated.

    <Frame caption="View the full API response for a specific row.">
      <img src="https://mintcdn.com/unify-19/sc9t8pwF45Nnu44g/images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-success-result.png?fit=max&auto=format&n=sc9t8pwF45Nnu44g&q=85&s=5c2245e7b3dad97353042530617b3dbf" width="2304" height="1639" data-path="images/developers/guides/send-data/clay-webhook/clay-sheet-http-api-success-result.png" />
    </Frame>

    If you search for that record in Unify, you should see it appear with the
    correct data!
  </Step>
</Steps>

## FAQ

<AccordionGroup>
  <Accordion title="Why am I getting an undefined or 400 status code error response?">
    Here are a few things to try:

    * **Inspect the response**: All error responses should contain details about
      why the request failed. Click into the cell in the sheet to view the full
      response and look for any error messages or details.
    * **Check the object API name**: The URL must use the object's API name,
      such as `company`, `person`, or the custom object API name from settings.
    * **Check the upsert body**: Upsert requests must include `match` and one of
      `create`, `create_or_update`, or `create_or_update_if_empty`.
    * **Check the body formatting**: Ensure that the JSON body correctly matches
      the expected format of the [Data API](/developers/api/data/overview)
      method you are trying to use. Double check that all Clay column variable
      placeholders are inside quotation marks.
    * **Check nested references**: If you are linking a person to a company,
      make sure the nested company value is a valid match, create, or upsert
      payload.
    * **Check for sheet errors**: Look for a red error symbol in the column name
      of the HTTP API column in the sheet. Sometimes, this will indicate an
      error in the Clay UI. For example, you may be referencing a deleted column
      name, or there may have been a subtle error when pasting the body into the
      Clay UI.
  </Accordion>
</AccordionGroup>
