# Add or Update Contact

Adds a new contact. If a contact with the same email already exists, it will be updated.

Endpoint: POST /subscriber
Version: 1.0.0

## Request fields (application/json):

  - `email` (string)
    Valid email address and must contain `@`.
Either `email` or `smsnumber` is required.
Email address must be unique per contact.
    Example: alex.example@klicktipp.example

  - `smsnumber` (string)
    Phone number in international format.
Either `email` or `smsnumber` is required.
SMS number must be unique per contact.
Accepted input:
- `+4912345678`
- `004912345678`

Stored format:
- `004912345678`
    Example: +491701234567

  - `listid` (integer)
    Opt-in process ID.
If provided, this opt-in process is used.
If omitted, the predefined double opt-in process is triggered automatically, which may trigger an email to the contact.
Retrieve available opt-in process IDs via `GET /list`.
    Example: 12345

  - `tagid` (integer)
    Tag ID assigned to the contact.
Used for segmentation and automation triggers.
Retrieve available tag IDs via `GET /tag`.
    Example: 56789

  - `time_value_mode` (string)
    Controls raw `Time` field values for this request only.
Omit or use `legacy` to preserve zero-clearing: a value that becomes exactly `"0"` after scalar conversion clears the field.
Use `seconds` to store `0` or `"0"` as midnight, including values read from GET responses.
An empty string clears in both modes; other field types are unchanged.
Only the exact strings `legacy` and `seconds` are accepted; supplied null or any other value returns HTTP 406 before writing.
Enable `seconds` in clients only after upgrading the server.
    Enum: "legacy", "seconds"

  - `fields` (object)
    Additional custom fields for the subscriber.
Keys must match the field names configured in KlickTipp.
Each field expects a specific data format depending on its field type.
For raw `Time` fields, an empty string, JSON `false`, or JSON `null` clears in either mode.
PHP's `http_build_query()` encodes `false` as `0` (clears in `legacy`, stores midnight in `seconds`) and omits `null`.
- `Line`
: Single-line text without line breaks.

Example:
`Alex Example`
- `Paragraph`
: Text with paragraphs. Use
`\n`
 to separate paragraphs.

Example:
`Dies ist ein Text.\nMit Absatz.`
- `Number`
: Integer value. No dot, no comma.

Example:
`42`
- `Decimal Number`
: Decimal value. Output always uses a dot as decimal separator.

Example: Input
`1999`
 → Output
`19.99`
- `URL`
: Valid web address. Must start with
`http://`
 or
`https://`
.

Example:
`https://klicktipp.com`
- `Time`
: Seconds since midnight between
`0`
 and
`86399`
.
`0`
 clears by default; set top-level
`time_value_mode`
 to
`seconds`
 to store midnight. Raw clock strings such as
`00:00`
 are not accepted.

Example:
`52200`
 (14:30 GMT)
- `Date`
: Unix timestamp in seconds. Date formats like
`DD.MM.YYYY`
 are not supported.

Example:
`1715126400`
 (08.05.2024 GMT)
- `Date & Time`
: Unix timestamp in seconds. Do not send formatted date strings or values with spaces.

Example:
`1715603400`
 (13.05.2024 12:30:00 GMT)
- `HTML`
: HTML-formatted content. Only use this type if the field explicitly allows HTML.

Example:
`<strong>Hello World</strong>`
    Example: {"fieldFirstName":"Alex","fieldLastName":"Example","fieldCompanyName":"Example Corp","fieldStreet1":"Example Street 1","fieldStreet2":"","fieldCity":"Berlin","fieldState":"Berlin","fieldZip":"10115","…

## Response 200:

  - `200` (unknown)
    Success Response.

## Response 200 fields (application/json):

  - `id` (string, required)
    Unique internal identifier of the contact
    Example: 987654321

  - `email` (string, required)
    Primary email address of the contact
    Example: alex.example@klicktipp.example

  - `status` (string, required)
    Current email subscription status of the contact (state, legacy string value)
    Example: Subscribed

  - `bounce` (string, required)
    Bounce status of the contact email address (state, legacy string value)
    Example: Not Bounced

  - `listid` (string, required)
    ID of the opt-in process (list) the contact belongs to at the time of subscription
    Example: 12345

  - `optin` (string, required)
    Time when the opt-in process for email communication was initiated (legacy formatted datetime string)
    Example: 01.01.2025 12:00:00

  - `optin_ip` (string, required)
    IP address associated with initiating the opt-in process for email communication. Legacy behavior: For API-based subscriptions, this field may contain additional descriptive text and does not represent a pure IP address.
    Example: 0.0.0.0

  - `date` (string, required)
    Time when the opt-in process for email communication was successfully confirmed (legacy formatted datetime string)
    Example: 01.01.2025 13:00:00

  - `ip` (string, required)
    IP address associated with confirming the opt-in process for email communication. Legacy behavior: For API-based subscriptions, this field may contain additional descriptive text and does not represent a pure IP address.
    Example: 0.0.0.0

  - `unsubscription` (string, required)
    Time when the contact unsubscribed from email communication (legacy formatted datetime string). Empty if the contact is subscribed.

  - `unsubscription_ip` (string, required)
    IP address associated with the unsubscription from email communication. Legacy behavior: For API-based unsubscriptions, this field may contain additional descriptive text. Empty if the contact is subscribed.

  - `referrer` (string, required)
    Optional referrer indicating the website where the email subscription form was embedded at the time of opt-in initiation. Legacy best-effort field and often empty.
    Example: https://integration.example.com/webhooks/payment/ipn

  - `sms_phone` (string, required)
    Phone number used for SMS communication
    Example: 00491701234567

  - `sms_status` (string, required)
    Current SMS subscription status of the phone number (state, legacy string value)
    Example: Subscribed

  - `sms_bounce` (string, required)
    SMS bounce status of the phone number (state, legacy string value)
    Example: Not Bounced

  - `sms_date` (string, required)
    Time when the SMS subscription became active (legacy formatted datetime string)
    Example: 01.02.2025 12:00:00

  - `sms_unsubscription` (string, required)
    Time when the contact unsubscribed from SMS communication (legacy formatted datetime string). Empty if subscribed.

  - `sms_referrer` (string, required)
    Optional referrer indicating the website where the SMS subscription form was embedded at the time of opt-in initiation. Legacy best-effort field and often empty.
    Example: https://signup.example.com/sms-form

  - `fieldFirstName` (string, required)
    Global data field: first name of the contact
    Example: Alex

  - `fieldLastName` (string, required)
    Global data field: last name of the contact
    Example: Example

  - `fieldCompanyName` (string, required)
    Global data field: company name of the contact
    Example: Example Corp

  - `fieldStreet1` (string, required)
    Global data field: primary street address
    Example: Example Street 1

  - `fieldStreet2` (string, required)
    Global data field: additional address information

  - `fieldCity` (string, required)
    Global data field: city
    Example: Berlin

  - `fieldState` (string, required)
    Global data field: state or region
    Example: Berlin

  - `fieldZip` (string, required)
    Global data field: postal or ZIP code
    Example: 10115

  - `fieldCountry` (string, required)
    Global data field: country code
    Example: DE

  - `fieldPrivatePhone` (string, required)
    Global data field: private phone number
    Example: 00491701234567

  - `fieldMobilePhone` (string, required)
    Global data field: mobile phone number
    Example: 00491707654321

  - `fieldPhone` (string, required)
    Global data field: business phone number
    Example: 00492207654321

  - `fieldFax` (string, required)
    Global data field: fax number
    Example: 00492201234567

  - `fieldWebsite` (string, required)
    Global data field: website URL
    Example: https://www.klicktipp.example

  - `fieldBirthday` (string, required)
    Global data field: birthday stored as Unix timestamp (seconds)
    Example: 755222400

  - `fieldLeadValue` (string, required)
    Global data field: lead score or lead value
    Example: 100

  - `tags` (array, required)
    List of all tag IDs currently assigned to the contact, including manual and smart tags
    Example: ["17","18","19","20"]

  - `smart_tags` (object, required)
    Smart tag IDs mapped to the Unix timestamp when they were applied (subset of assigned tags)
    Example: {"17":"1758821945","18":"1758822131"}

  - `manual_tags` (object, required)
    Manually assigned tag IDs mapped to the Unix timestamp when they were applied (subset of assigned tags)
    Example: {"19":"1759753677","20":"1758822131"}

  - `notification_emails_sent` (object, required)
    Notification email IDs mapped to the Unix timestamp when they were sent
    Example: {"45":"1758821945"}

  - `notification_emails_opened` (object, required)
    Notification email IDs mapped to the Unix timestamp when they were opened
    Example: {"45":"1758822131"}

  - `notification_emails_clicked` (object, required)
    Notification email IDs mapped to the Unix timestamp when they were clicked
    Example: {"45":"1758822131"}

  - `emails_sent` (object, required)
    Email IDs mapped to the Unix timestamp when they were sent
    Example: {"1":"1758822606","2":"1758822769"}

  - `emails_opened` (object, required)
    Email IDs mapped to the Unix timestamp when they were opened
    Example: {"1":"1758822610","2":"1758884682"}

  - `emails_clicked` (object, required)
    Email IDs mapped to the Unix timestamp when they were clicked
    Example: {"1":"1758822733"}

  - `campaigns_started` (object, required)
    Campaign IDs mapped to the Unix timestamp when they were started
    Example: {"6":"1759753673"}

  - `campaigns_finished` (object, required)
    Campaign IDs mapped to the Unix timestamp when they were finished
    Example: {"6":"1759753677"}

## Response 403:

  - `403` (unknown)
    Access Denied Response (403).

Your account does not have the required permissions to access this resource.

## Response 406:

  - `406` (unknown)
    Not Acceptable Response (406).
Check the response content for further error details.
In some cases, a detail error code may be returned:
- `4`
 - Subscription not found
- `5`
 - Email address validation failed
- `7`
 - Subscriber email not found
- `8`
 - Field validation failed
- `9`
 - Subscriber not subscribed
- `10`
 - Subscriber update failed
- `30`
 - Email address change not allowed
- `31`
 - Untag smarttag not allowed
- `32`
 - Email address SMS number required
- `100`
 - Invalid API key
- `401`
 - User not found
- `402`
 - List not found
- `403`
 - Tag not found
- `404`
 - User group not found
- `405`
 - Campaign not found
- `406`
 - Tier not found
- `501`
 - Email address required
- `502`
 - Username required
- `503`
 - Password required
- `504`
 - First name required
- `505`
 - Last name required
- `506`
 - Username exists
- `507`
 - Email address exists
- `508`
 - User update failed

