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

# email.created

> Sent when an email OTP or magic link needs to be delivered through your own email provider.

Triggered when a challenge is created for an email-based authenticator. The `data` payload contains either `code` (for email OTP) or `url` (for magic link).

This webhook is synchronous, so a non-2xx response fails the challenge.

Open the Email OTP or Email Magic Link authenticator in [authenticator settings](https://portal.authsignal.com/organisations/tenants/authenticators) and set the email provider to **Webhook**. The URL you enter as part of provider setup is where this event is delivered.

## Payload

<ParamField path="to" type="string" required>
  The email address the OTP or magic link should be delivered to.
</ParamField>

<ParamField path="code" type="string">
  The email OTP code. Present for email OTP authenticators.
</ParamField>

<ParamField path="url" type="string">
  The URL of the magic link. Present for email magic link authenticators.
</ParamField>

<ParamField path="userId" type="string" required>
  The ID of the user the challenge is for.
</ParamField>

<ParamField path="idempotencyKey" type="string" required>
  The idempotency key of the request that created the challenge.
</ParamField>

<ParamField path="actionCode" type="string" required>
  The action code of the track request that created the challenge.
</ParamField>

<ParamField path="userAgent" type="string">
  The user agent of the user who requested the challenge.

  <Info>
    Only present if the user agent was captured when [tracking an
    action](/api-reference/server-api/track-action).
  </Info>
</ParamField>

<ParamField path="timezone" type="string">
  The timezone of the user who requested the challenge.

  <Info>
    Only present if the IP address was captured when [tracking an
    action](/api-reference/server-api/track-action).
  </Info>
</ParamField>

<ParamField path="ipAddress" type="string">
  The IP address of the user who requested the challenge.

  <Info>
    Only present if the IP address was captured when [tracking an
    action](/api-reference/server-api/track-action).
  </Info>
</ParamField>

<ParamField path="locale" type="string">
  The locale of the user who requested the challenge.

  <Info>
    Only present if the locale was captured when [tracking an
    action](/api-reference/server-api/track-action#body-locale) or set on the user via [update
    user](/api-reference/server-api/update-user#body-locale).
  </Info>
</ParamField>

<ResponseExample>
  ```json Magic link theme={null}
  {
    "version": 1,
    "id": "a3f68e12-7b4c-4d2a-9e5f-1c8b3a6d9e72",
    "source": "https://authsignal.com",
    "time": "2024-01-01T01:23:45.678Z",
    "tenantId": "dddddddd-dddd-dddd-dddd-dddddddddddd",
    "type": "email.created",
    "data": {
      "to": "jane.smith@acme.com",
      "url": "https://mfa.authsignal.com/api/verify-magic-link?token=...",
      "userId": "11111111-1111-1111-1111-111111111111",
      "idempotencyKey": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
      "actionCode": "sign-in",
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
      "timezone": "America/New_York",
      "ipAddress": "203.0.113.42",
      "locale": "en"
    }
  }
  ```

  ```json Email OTP theme={null}
  {
    "version": 1,
    "id": "b7d29a45-3e1f-4c8b-a6d2-9f5e1c3b7a84",
    "source": "https://authsignal.com",
    "time": "2024-01-01T01:23:45.678Z",
    "tenantId": "dddddddd-dddd-dddd-dddd-dddddddddddd",
    "type": "email.created",
    "data": {
      "to": "john.doe@example.org",
      "code": "847291",
      "userId": "11111111-1111-1111-1111-111111111111",
      "idempotencyKey": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
      "actionCode": "transfer-funds",
      "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
      "timezone": "Europe/London",
      "ipAddress": "198.51.100.17",
      "locale": "en"
    }
  }
  ```
</ResponseExample>
