# New EmailAddress

Note that the Organization/Brand which the EmailAddress will belong to is determined automatically by TonicDM. If an appropriate Organization/Brand doesnt exist, TonicDM will auto-create them.
If the UUID of a Person is given, the EmailAddress will belong to that person, Otherwise TonicDM will auto-create a Person and attach the EmailAddress to it.
If required, the EmailAddress can be merged into an existing Person as a second step. Note that Person records can only be manipulated if the customer has an AdvancedContacts license.
Some automated processes use this endpoint to check if a contact should be created or not. This is done by passing `SelectiveNonCreation` as `TRUE`. This will create the contact if they're a business email address only, and not create the contact if they have a system or personal email address, for example `person@company.com` would be created but `person@gmail.com` or `no-reply@dropbox.com` would not. This allows you to request a contact to be created without filtering the quality of the email address first. If `SelectiveNonCreation` is `FALSE`a contact will be created.
If you want to pass in the Organization information, do that as a second step using PATCH to the `organizations` endpoint submitting the `organizationId` returned in the response body.
Similarly, adding an Location to the Person needs to be done using PATCH to the `/persons` endpoint submitting and `locationId` that would have been looked up using GET to the `/locations` endpoint submitting the `organizationId` returned in the response body.

Endpoint: POST /core/emailaddresses/insert
Version: 0.0.5
Security: OAuth2

## Request fields (application/json):

  - `personId` (string)
    A UUID used to link multiple EmailAddress records together because they belong to the same physical person.
There are no extra fields associated with this UUID. It serves only as a linking mechanism.
Use of `personId` to link multiple EmailAddress records together requires the TonicDM AdvancedContacts license.
    Example: 8e8aa42241794371ae9d0ed7b67a8c86

  - `status` (string)
    Whether the item is active or inactive in TonicDM. Potentially the item could be (soft) deleted.
    Enum: "active", "inactive", "deleted"

  - `emailAddress` (string, required)

  - `name` (string)
    The person's full name.

  - `title` (string)
    The person's business title.

  - `deskphoneCountryCode` (number)
    Numbers only, no spaces or `+` character

  - `deskphoneNumber` (number)
    Numbers only, no spaces or formatting

  - `deskphoneExtension` (number)
    Numbers only, no text or formatting

  - `mobilephoneCountryCode` (number)
    Numbers only, no spaces or `+` character

  - `mobilephoneNumber` (number)
    Numbers only, no spaces or formatting

  - `dateActive` (string)
    The date this email address became active. This is used to track the history of email addresses for a person.

REQUIRES the TonicDM AdvancedContacts license.

  - `dateInactive` (string)
    The date this email address became inactive. This is used to track the history of email addresses for a person. 

REQUIRES the TonicDM AdvancedContacts license.

  - `isPrime` (boolean)
    Indicates that this email address is the primary email address for this person. 
When displaying a Person, the Prime email address info will be used for their Name, etc.

REQUIRES the TonicDM AdvancedContacts license.

  - `customerDataWarehouseId` (string)
    The ID of the Person in the Customer's Data Warehouse.
FOR USE BY CUSTOMER. NOT YET IMPLEMENTED.
REQUIRES the TonicDM AdvancedMetrics license.

  - `customerErpId` (string)
    The ID of the Person in the Customer's ERP system (eg. Deltek Vantagepoint).
FOR USE BY CUSTOMER. NOT YET IMPLEMENTED.
REQUIRES the TonicDM AdvancedMetrics license.

  - `customerCrmId` (string)
    The ID of the Person in the Customer's CRM system (eg. Deltek Salesforce).
FOR USE BY CUSTOMER. NOT YET IMPLEMENTED.
REQUIRES the TonicDM AdvancedMetrics license.

  - `disciplines` (array)
    The UUIDs of the Disciplines this Person is typically involved in.

  - `certifications` (array)
    Zero or more certifications that this Person has obtained, or previously obtained. REQUIRES the TonicDM AdvancedContacts license.

  - `selectiveNonCreation` (boolean)
    Allow TonicDM to choose to not create the contact if it looks like it's not a business email address.

## Response 201 fields (application/json):

  - `status` (string, required)
    Enum: "success"

  - `data` (array, required)

  - `data.location` (object)
    The physical location (office) that is assigned to a Project or Person. 
This allows for filtering by Location, and the calcuation of metrics by Location.
Use of this feature for Contact Organizations requires the TonicDM AdvancedContacts license.

  - `data.location.id` (string)
    Example: 8e8aa42241794371ae9d0ed7b67a8c86

  - `data.location.datetimeCreated` (string)
    The date and time this Location was created.

  - `data.location.datetimeUpdated` (string)
    The date and time this Location was last updated.

  - `data.location.status` (string)
    Whether the item is active or inactive in TonicDM. Potentially the item could be (soft) deleted.
    Enum: "active", "inactive", "deleted"

  - `data.location.name` (string)
    The name given to this Location. It is used in the TonicDM app only (not put onto anything externally facing).

  - `data.location.address` (string)
    The address of the location. Use `\n` for new lines when submitting (they will be returned as `<br>`).

  - `data.location.phoneCountryCode` (string)
    Numbers only, no spaces or `+` character

  - `data.location.phoneNumber` (string)
    Numbers only, no spaces or formatting

  - `data.location.customerDataWarehouseId` (string)
    The ID of the Person in the Customer's Data Warehouse.
FOR USE BY CUSTOMER. NOT YET IMPLEMENTED.
REQUIRES the TonicDM AdvancedMetrics license.

  - `data.location.customerErpId` (string)
    The ID of the Person in the Customer's ERP system (eg. Deltek Vantagepoint).
FOR USE BY CUSTOMER. NOT YET IMPLEMENTED.
REQUIRES the TonicDM AdvancedMetrics license.

  - `data.location.customerCrmId` (string)
    The ID of the Person in the Customer's CRM system (eg. Deltek Salesforce).
FOR USE BY CUSTOMER. NOT YET IMPLEMENTED.
REQUIRES the TonicDM AdvancedMetrics license.

  - `data.disciplines` (array)
    The UUIDs of the Disciplines this Person is typically involved in.

  - `data.disciplines.initials` (string)
    1-2 letter abbreviation

  - `data.disciplines.abbreviation` (string)
    4 letter abbreviation

  - `data.disciplines.name` (string)
    Unabbreviated discipline name

  - `data.certifications` (array)
    Zero or more certifications that this Person has obtained, or previously obtained. REQUIRES the TonicDM AdvancedContacts license.

  - `data.certifications.datetimeCreated` (string)
    The date and time this Certification record was created.

  - `data.certifications.datetimeUpdated` (string)
    The date and time this Certification record was last updated.

  - `data.certifications.certificationDefinitionId` (string, required)
    The UUID of the Certification Definition record.

  - `data.certifications.appliesToId` (string)
    The UUID of the record this Certification applies to.

  - `data.certifications.appliesToType` (string)
    The type of record this Certification applies to.
    Enum: "organization", "project", "person"

  - `data.certifications.dateExpires` (string)
    The date this certification expires.

  - `metadata` (object, required)
    Present on every JSON response. For non-paginated operations, `page` will be 1, `total_pages` will be 1,
and `total_records` equal to the number of elements in `data`.

  - `metadata.timestamp` (string, required)

  - `metadata.correlation_id` (string, required)

  - `metadata.page` (integer, required)

  - `metadata.total_pages` (integer, required)

  - `metadata.total_records` (integer, required)

## Response 400 fields (application/json):

  - `status` (string, required)
    Enum: "fail", "error"

  - `error` (object, required)

  - `error.code` (string, required)
    Example: VALIDATION_ERROR

  - `error.message` (string, required)
    Example: Invalid input

  - `metadata` (object, required)
    Present on every JSON response. For non-paginated operations, `page` will be 1, `total_pages` will be 1,
and `total_records` equal to the number of elements in `data`.

  - `metadata.timestamp` (string, required)

  - `metadata.correlation_id` (string, required)

  - `metadata.page` (integer, required)

  - `metadata.total_pages` (integer, required)

  - `metadata.total_records` (integer, required)

## Response 401 fields (application/json):

  - `status` (string, required)
    Enum: "fail", "error"

  - `error` (object, required)

  - `error.code` (string, required)
    Example: VALIDATION_ERROR

  - `error.message` (string, required)
    Example: Invalid input

  - `metadata` (object, required)
    Present on every JSON response. For non-paginated operations, `page` will be 1, `total_pages` will be 1,
and `total_records` equal to the number of elements in `data`.

  - `metadata.timestamp` (string, required)

  - `metadata.correlation_id` (string, required)

  - `metadata.page` (integer, required)

  - `metadata.total_pages` (integer, required)

  - `metadata.total_records` (integer, required)

## Response 403 fields (application/json):

  - `status` (string, required)
    Enum: "fail", "error"

  - `error` (object, required)

  - `error.code` (string, required)
    Example: VALIDATION_ERROR

  - `error.message` (string, required)
    Example: Invalid input

  - `metadata` (object, required)
    Present on every JSON response. For non-paginated operations, `page` will be 1, `total_pages` will be 1,
and `total_records` equal to the number of elements in `data`.

  - `metadata.timestamp` (string, required)

  - `metadata.correlation_id` (string, required)

  - `metadata.page` (integer, required)

  - `metadata.total_pages` (integer, required)

  - `metadata.total_records` (integer, required)

## Response 404 fields (application/json):

  - `status` (string, required)
    Enum: "fail", "error"

  - `error` (object, required)

  - `error.code` (string, required)
    Example: VALIDATION_ERROR

  - `error.message` (string, required)
    Example: Invalid input

  - `metadata` (object, required)
    Present on every JSON response. For non-paginated operations, `page` will be 1, `total_pages` will be 1,
and `total_records` equal to the number of elements in `data`.

  - `metadata.timestamp` (string, required)

  - `metadata.correlation_id` (string, required)

  - `metadata.page` (integer, required)

  - `metadata.total_pages` (integer, required)

  - `metadata.total_records` (integer, required)

## Response 429 fields (application/json):

  - `status` (string, required)
    Enum: "fail", "error"

  - `error` (object, required)

  - `error.code` (string, required)
    Example: VALIDATION_ERROR

  - `error.message` (string, required)
    Example: Invalid input

  - `metadata` (object, required)
    Present on every JSON response. For non-paginated operations, `page` will be 1, `total_pages` will be 1,
and `total_records` equal to the number of elements in `data`.

  - `metadata.timestamp` (string, required)

  - `metadata.correlation_id` (string, required)

  - `metadata.page` (integer, required)

  - `metadata.total_pages` (integer, required)

  - `metadata.total_records` (integer, required)

## Response 500 fields (application/json):

  - `status` (string, required)
    Enum: "fail", "error"

  - `error` (object, required)

  - `error.code` (string, required)
    Example: VALIDATION_ERROR

  - `error.message` (string, required)
    Example: Invalid input

  - `metadata` (object, required)
    Present on every JSON response. For non-paginated operations, `page` will be 1, `total_pages` will be 1,
and `total_records` equal to the number of elements in `data`.

  - `metadata.timestamp` (string, required)

  - `metadata.correlation_id` (string, required)

  - `metadata.page` (integer, required)

  - `metadata.total_pages` (integer, required)

  - `metadata.total_records` (integer, required)

