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

# Validating with External Data

The following example demonstrates how to use row hooks to validate data against an external API.

<Info>
  For more information on row hooks, see the [Row Hooks](/reference/hooks#row-hooks) documentation.
</Info>

Although it's not required to use `async`/`await` with hooks, we recommend you use it with an external API call.

<CodeGroup>
  ```javascript JavaScript theme={null}
  export const fields = [
    {
      label: 'Email',
      key: 'email'
    }
  ];

  let hasFetchedData = false;
  let serverResults;

  dromo.registerRowHook(async function (record) {
    const newRecord = record;
    if (!hasFetchedData) {
      await fetch('https://my-json-server.typicode.com/dromoio/docs-email-api/leads', {
        method: 'GET'
      })
        .then((response) => response.json())
        .then(function (json) {
          serverResults = json.map((record) => {
            return record['email'];
          });
          hasFetchedData = true;
        });
    }
    if (serverResults.includes(newRecord.row['email'].value)) {
      newRecord.row['email'].info = [
        {
          message: 'Duplicate record. This user is already in the database.',
          level: 'error'
        }
      ];
    }
    return newRecord;
  });
  ```

  ```jsx React theme={null}
  let hasFetchedData = false;
  let serverResults;

  <DromoUploader
    licenseKey={"FRONTEND_API_KEY"}
    user={{ id: "12345" }}
    fields={[
      {
        label: "Email",
        key: "email",
      },
    ]}
    settings={{
      importIdentifier: "Row Hooks Example",
    }}
    rowHooks={[
      async (record) => {
        const newRecord = record;
        if (!hasFetchedData) {
          await fetch('https://my-json-server.typicode.com/dromoio/docs-email-api/leads', {
            method: 'GET'
          })
            .then((response) => response.json())
            .then(function (json) {
              serverResults = json.map((record) => {
                return record['email'];
              });
              hasFetchedData = true;
            });
        }
        if (serverResults.includes(newRecord.row['email'].value)) {
          newRecord.row['email'].info = [
            {
              message: 'Duplicate record. This user is already in the database.',
              level: 'error'
            }
          ];
        }
        return newRecord;
      }
    ]}>
    Import Contacts
  </DromoUploader>
  ```
</CodeGroup>
