# Validate domains' SPF records

This function retrieves the the Sender Policy Framework (SPF) records
for one or more domains.

Endpoint: GET /EmailAuth/validate_current_spfs
Version: 11.138.0.19
Security: BasicAuth

## Query parameters:

  - `domain` (string, required)
    The domain for which to check the SPF records.

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "validate_current_spfs"

  - `module` (string)
    The name of the module called.
    Example: "EmailAuth"

  - `result` (object)

  - `result.data` (array)
    A list of information about a domain's SPF records.

  - `result.data.domain` (string)
    The queried domain.
    Example: "example.com"

  - `result.data.error` (string)
    A message that details the reason why the DNS lookup failed.

Note:

 The function only returns this value when the state return is the ERROR value.
    Example: "(XID rm8h9f) DNS returned SERVFAIL (code 2)\nin response to the systems query for example2.coms\nTXT records."

  - `result.data.expected` (string)
    The SPF record for the domain in the DNS.
    Example: "ip6:0:0:0:0:0:ffff:c0a8:101"

  - `result.data.ip_address` (string)
    The domain's IP address.
    Example: "0:0:0:0:0:ffff:c0a8:101"

  - `result.data.ip_version` (integer)
    The IP address version.
* 4
* 6
    Enum: 4, 6

  - `result.data.records` (array)
    The SPF records of the domain's DNS.

  - `result.data.records.current` (string)
    The SPF record's contents.
    Example: "v=spf1 +a +mx ip6:0:0:0:0:0:ffff:c0a8:101 ~all"

  - `result.data.records.reason` (string)
    The reason why the SPF record is not correct, if one exists.

Note:

If no errors exist, the function does not return this value.
    Example: "'example.com: Sender\nis not authorized by default to use ''example.com''\nin ''helo'' identity, however domain is not\ncurrently prepared for false failures (mechanism\n''~all'' matched)'"

  - `result.data.records.state` (string)
    The SPF record's status:
* PASS - The SPF record confirms that the ip_address value is a valid sender.
* NEUTRAL - The current SPF record configuration does not determine the ip_address value's validity.
* FAIL - The SPF record states that the ip_address value is not a valid sender.
* SOFTFAIL - The SPF record states that the ip_address value is not a valid sender, but does not FAIL state it.
* TEMPERROR - The SPF record check resulted in a failure. For example, a network failure.
* PERMERROR - The domain's SPF records are incorrect and require manual correction.

Note:

These values correspond with [RFC7208 section 2.6](https://tools.ietf.org/html/rfc7208#section-2.6).
    Enum: "PASS", "NEUTRAL", "FAIL", "SOFTFAIL", "TEMPERROR", "PERMERROR"

  - `result.data.state` (string)
    The SPF record's status:
* VALID - A single SPF TXT record exists in the domain's DNS with the correct ip_address value or redirect mechanism.
* MISMATCHED - An SPF TXT record exists for the domain that does not match the ip_address value.
* MULTIPLE - Multiple SPF TXT records exist in the domain's DNS.
* MISSING - No SPF TXT record exists for the domain's DNS.
* ERROR - The record's DNS lookup failed. The function returns the reason in the error return.
    Enum: "VALID", "MISMATCHED", "MULTIPLE", "MISSING", "ERROR"

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.status` (integer)
    - 1 - Success.
- 0 - Failed. Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


