# Subscribe Contact

Subscribes one contact email or SMS channel via an opt-in process, creating or reusing the contact. May send confirmation and start automations; the optional tag may start further automations or outbound events. Accepts an email or phone number, never both; other channels stay unchanged.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "optInProcessId": {
      "type": "integer",
      "description": "ID of the opt-in process to run",
      "minimum": 1
    },
    "approval": {
      "type": "string",
      "description": "Exactly \"subscribe-contact\": acknowledges a confirmation message, automations and a changed real recipient",
      "enum": [
        "subscribe-contact"
      ]
    },
    "email": {
      "type": [
        "null",
        "string"
      ],
      "description": "Email channel to subscribe; mutually exclusive with phoneNumber",
      "default": null,
      "maxLength": 250
    },
    "phoneNumber": {
      "type": [
        "null",
        "string"
      ],
      "description": "SMS channel to subscribe in E.164 format; mutually exclusive with email",
      "default": null,
      "maxLength": 50
    },
    "referenceId": {
      "type": "integer",
      "description": "Subscription reference context to create or reuse; a non-zero ID must exist in the account",
      "default": 0,
      "minimum": 0
    },
    "tagId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "Tag to additionally assign to the contact after a successful subscription",
      "default": null,
      "minimum": 1
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "User ID of the account; omit for the account the access token works in",
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "optInProcessId",
    "approval"
  ],
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "accountId",
    "subscriberId",
    "channel",
    "contactInfo",
    "referenceId",
    "optInProcessId",
    "subscriptionStatus",
    "contactCreated",
    "referenceCreated"
  ],
  "properties": {
    "accountId": {
      "type": "integer"
    },
    "subscriberId": {
      "type": "integer"
    },
    "channel": {
      "type": "string"
    },
    "contactInfo": {
      "type": "string"
    },
    "referenceId": {
      "type": "integer"
    },
    "optInProcessId": {
      "type": "integer"
    },
    "subscriptionStatus": {
      "type": "string"
    },
    "contactCreated": {
      "type": "boolean"
    },
    "referenceCreated": {
      "type": "boolean"
    }
  }
}
```

