# Create Referral Program

Creates a referral program; refused for accounts without referral program access. Contacts can then recommend the account through their personal link, and contacts reaching the threshold are tagged, which may start automations. The counter field is set only here and cannot be changed later; change the rest with update-referral-program.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Name of the program in KlickTipp",
      "minLength": 1,
      "maxLength": 250
    },
    "targetUrl": {
      "type": "string",
      "description": "Absolute URL of the page a recommended person is sent to",
      "minLength": 1,
      "maxLength": 2000
    },
    "threshold": {
      "type": "integer",
      "description": "Successful recommendations a contact needs before the program tags them",
      "minimum": 1,
      "maximum": 1000000000
    },
    "counterCustomFieldId": {
      "type": [
        "null",
        "string"
      ],
      "description": "ID of a number custom field, not multi-value, that counts a contact's successful recommendations; cannot be changed later",
      "default": null,
      "minLength": 1,
      "maxLength": 64
    },
    "metaLabels": {
      "type": "array",
      "description": "Labels of the program",
      "default": null,
      "items": {
        "type": "string",
        "maxLength": 250
      }
    },
    "notes": {
      "type": [
        "null",
        "string"
      ],
      "description": "Internal note",
      "default": null,
      "maxLength": 1000
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "User ID of the account; omit for the account of the access token",
      "default": null,
      "minimum": 1
    }
  },
  "required": [
    "name",
    "targetUrl",
    "threshold"
  ],
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "accountId",
    "id",
    "name",
    "notes",
    "metaLabels",
    "targetUrl",
    "threshold",
    "counterCustomFieldId",
    "editUrl"
  ],
  "properties": {
    "accountId": {
      "type": "integer"
    },
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "notes": {
      "type": "string"
    },
    "metaLabels": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "targetUrl": {
      "type": "string"
    },
    "threshold": {
      "type": "integer"
    },
    "counterCustomFieldId": {
      "type": "string"
    },
    "editUrl": {
      "type": "string"
    }
  },
  "additionalProperties": false
}
```

