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

# Check Email Risk

> Detect suspicious emails for trust & safety and fraud prevention use cases

Get risk information for a specific email address.
The response will contain a recommended action (`ALLOW`, `BLOCK`, or `CHALLENGE`) and a more granular `risk_score`.
You can also check the `address_information` and `domain_information` fields for more information about the email address and email domain.

<Info>
  This feature is in beta. Reach out to us [here](mailto:fraud-team@stytch.com?subject=Email_Intelligence_Early_Access) if you'd like to request early access.
</Info>


## OpenAPI

````yaml POST /v1/email/risk
openapi: 3.0.3
info:
  title: Stytch API
  description: The Stytch API provides endpoints for authentication and user management.
  version: 2.1.1
  contact:
    name: Stytch Support
    url: https://stytch.com/docs
    email: support@stytch.com
servers:
  - url: https://api.stytch.com
    description: Production server
  - url: https://test.stytch.com
    description: Test server
security:
  - basicAuth: []
paths:
  /v1/email/risk:
    servers:
      - url: https://telemetry.stytch.com
    post:
      tags:
        - Fraud
      summary: Risk
      description: >-
        Get risk information for a specific email address.

        The response will contain a recommended action (`ALLOW`, `BLOCK`, or
        `CHALLENGE`) and a more granular `risk_score`.

        You can also check the `address_information` and `domain_information`
        fields for more information about the email address and email domain.


        This feature is in beta. Reach out to us
        [here](mailto:fraud-team@stytch.com?subject=Email_Intelligence_Early_Access)
        if you'd like to request early access.
      operationId: api_fraud_v1_fraud_email_Risk
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api_fraud_v1_fraud_email_RiskRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api_fraud_v1_fraud_email_RiskResponse'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
          content:
            application/json:
              example:
                status_code: 401
                request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
                error_type: unauthorized_credentials
                error_message: Unauthorized credentials.
                error_url: https://stytch.com/docs/api/errors/401
        '429':
          description: Too Many Requests
          content:
            application/json:
              example:
                status_code: 429
                request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
                error_type: too_many_requests
                error_message: Too many requests have been made.
                error_url: https://stytch.com/docs/api/errors/429
        '500':
          description: Internal server error
          content:
            application/json:
              example:
                status_code: 500
                request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
                error_type: internal_server_error
                error_message: >-
                  Oops, something seems to have gone wrong, please reach out to
                  support@stytch.com to let us know what went wrong.
                error_url: https://stytch.com/docs/api/errors/500
      x-code-samples:
        - lang: csharp
          label: C#
          source: |-
            // POST /v1/email/risk
            const stytch = require('stytch');

            const client = new stytch.B2BClient({
              project_id: '${projectId}',
              secret: '${secret}',
            });

            const params = {
              email_address: "sandbox@stytch.com",
            };

            client.Fraud.Email.Risk(params)
              .then(resp => { console.log(resp) })
              .catch(err => { console.log(err) });
        - lang: go
          label: Go
          source: "// POST /v1/email/risk\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v18/stytch/consumer/fraud/email\"\n\t\"github.com/stytchauth/stytch-go/v18/stytch/consumer/stytchapi\"\n)\n\nfunc main() {\n\tclient, err := stytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &email.RiskParams{\n\t\tEmailAddress: \"sandbox@stytch.com\",\n\t}\n\n\tresp, err := client.Fraud.Email.Risk(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
        - lang: java
          label: Java
          source: |-
            // POST /v1/email/risk
            package com.example;

            import com.stytch.java.common.StytchResult;
            import com.stytch.java.consumer.models.fraudemail.RiskRequest;
            import com.stytch.java.consumer.StytchClient;

            public class Main {
                public static void main(String[] args) {
                    StytchClient.configure("${projectId}", "${secret}");

                    RiskRequest params = new RiskRequest();
                    params.setEmailAddress("sandbox@stytch.com");

                    Object result = StytchClient.getFraud().getEmail().risk(params);
                    if (result instanceof StytchResult.Success) {
                      System.out.println(((StytchResult.Success) result).getValue());
                    } else {
                      System.out.println(((StytchResult.Error) result).getException());
                    }
                }
            }
        - lang: kotlin
          label: Kotlin
          source: |
            // POST /v1/email/risk
            package com.example

            import com.stytch.java.consumer.StytchClient
            import com.stytch.java.consumer.models.fraudemail.RiskRequest

            fun main() {
                StytchClient.configure(
                    projectId = "${projectId}",
                    secret = "${secret}",
                )

                when (
                    val result =
                        StytchClient.fraud.email.risk(
                            RiskRequest(
                                emailAddress = "sandbox@stytch.com",
                            ),
                        )
                ) {
                    is StytchResult.Success -> println(result.value)
                    is StytchResult.Error -> println(result.exception)
                }
            }
        - lang: javascript
          label: Node.js
          source: |-
            // POST /v1/email/risk
            const stytch = require('stytch');

            const client = new stytch.Client({
              project_id: '${projectId}',
              secret: '${secret}',
            });

            const params = {
              email_address: "sandbox@stytch.com",
            };

            client.fraud.email.risk(params)
              .then(resp => { console.log(resp) })
              .catch(err => { console.log(err) });
        - lang: php
          label: PHP
          source: |-
            $response = $client->fraud->email->risk([
                'email_address' => 'sandbox@stytch.com',
            ]);
        - lang: python
          label: Python
          source: |
            # POST /v1/email/risk
            from stytch import Client

            client = Client(
                project_id="${projectId}",
                secret="${secret}",
            )

            resp = client.fraud.email.risk(
                email_address="sandbox@stytch.com",
            )

            print(resp)
        - lang: ruby
          label: Ruby
          source: |-
            # frozen_string_literal: true

            # POST /v1/email/risk
            require 'stytch'

            client = Stytch::Client.new(
              project_id: "${projectId}",
              secret: "${secret}"
            )

            resp = client.fraud.email.risk(
              email_address: "sandbox@stytch.com"
              
            )

            puts resp
        - lang: rust
          label: Rust
          source: |-
            // POST /v1/email/risk
            use stytch::consumer::client::Client;
            use stytch::consumer::fraud_email::RiskRequest;

            fn main() {
                let client = Client::new("${projectId}", "${secret}").unwrap();
                let resp = client.fraud.email.risk(
                    RiskRequest{
                        email_address: "sandbox@stytch.com",
                        ..Default::default()
                    }
                ).await;
                println!("The response is {:?}", resp);
            }
        - lang: bash
          label: cURL
          source: |-
            # POST /v1/email/risk
            curl --request POST \
              --url https://telemetry.stytch.com/v1/email/risk \
              -u '${projectId}:${secret}' \
              -H 'Content-Type: application/json' \
              -d '{
                "email_address": "sandbox@stytch.com"
              }'
components:
  schemas:
    api_fraud_v1_fraud_email_RiskRequest:
      type: object
      properties:
        email_address:
          type: string
          description: The email address to check.
      description: Request type
      required:
        - email_address
    api_fraud_v1_fraud_email_RiskResponse:
      type: object
      properties:
        request_id:
          type: string
          description: >-
            Globally unique UUID that is returned with every API call. This
            value is important to log for debugging purposes; we may ask for
            this value to help identify a specific API call when helping you
            debug an issue.
        address_information:
          $ref: '#/components/schemas/api_fraud_v1_AddressInformation'
          description: Information about the email address.
        domain_information:
          $ref: '#/components/schemas/api_fraud_v1_DomainInformation'
          description: Information about the email domain.
        action:
          $ref: '#/components/schemas/api_fraud_v1_fraud_email_RiskResponseAction'
          description: >-
            The suggested action based on the attributes of the email address.
            The available actions are:
              * `ALLOW` - This email is most likely safe to send to and not fraudulent.
              * `BLOCK` - This email is invalid or exhibits signs of fraud. We recommend blocking the end user.
              * `CHALLENGE` - This email has some potentially fraudulent attributes. We recommend increased friction such as 2FA or other forms of extended user verification before allowing the privileged action to proceed.
              
        risk_score:
          type: integer
          format: int32
          description: >-
            A score from 0 to 100 indicating how risky the email is. 100 is the
            most risky.
        status_code:
          type: integer
          format: int32
          description: >-
            The HTTP status code of the response. Stytch follows standard HTTP
            response status code patterns, e.g. 2XX values equate to success,
            3XX values are redirects, 4XX are client errors, and 5XX are server
            errors.
      required:
        - request_id
        - address_information
        - domain_information
        - action
        - risk_score
        - status_code
    api_fraud_v1_AddressInformation:
      type: object
      properties:
        has_known_bounces:
          type: boolean
          description: >-
            Whether email sent to this address is known to have bounced
            previously.
        has_valid_syntax:
          type: boolean
          description: Whether this email address is valid.
        is_suspected_role_address:
          type: boolean
          description: >-
            Whether the local part of the email appears to be a role or group,
            rather than an individual end user.
        normalized_email:
          type: string
          description: >-
            The normalized email address after removing '.' characters and any
            characters after a '+'.
        tumbling_character_count:
          type: integer
          format: int32
          description: >-
            The number of '.' and '+' characters in the email address. A higher
            tumbling count indicates a higher potential for fraud.
      required:
        - has_known_bounces
        - has_valid_syntax
        - is_suspected_role_address
        - normalized_email
        - tumbling_character_count
    api_fraud_v1_DomainInformation:
      type: object
      properties:
        has_mx_or_a_record:
          type: boolean
          description: Whether the email has appropriate DNS records to deliver a message.
        is_disposable_domain:
          type: boolean
          description: Whether the email domain is known to be disposable.
      required:
        - has_mx_or_a_record
        - is_disposable_domain
    api_fraud_v1_fraud_email_RiskResponseAction:
      type: string
      enum:
        - ALLOW
        - CHALLENGE
        - BLOCK
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````