# Program setup

Sign-up questions, custom domains, in-portal notifications and a few program fields, from the API.

These are the setup jobs you do once and then change now and then. Each one has an API operation,
an SDK method, a CLI command and an MCP tool. They follow the same rules as the dashboard.

## Sign-up questions

A **custom field** is an extra question on the partner sign-up form.

- `GET /v1/custom-fields?program_id=` lists them in order.
- `POST /v1/custom-fields` adds one at the end. `kind` is `single` (free text), `select` (pick one)
  or `multiple` (pick several). The last two need at least two options.
- `POST /v1/custom-fields/{id}` changes one. Only what you send changes.
- `POST /v1/custom-fields/{id}/move` moves one place up or down.
- `DELETE /v1/custom-fields/{id}` removes it. New applicants are no longer asked.

Send an `Idempotency-Key` when you add one, so a retry can't add it twice.

## Domains

You add the DNS records yourself, at your own DNS host. A domain call returns the records to add
and whether the domain is live. It never touches your DNS.

There are four kinds. `portal` is where partners sign in. `tracker` is a host on your own domain
that counts clicks. `email` is the sending domain for partner email. Link domains are short-link
hosts like `refer.acme.com`, and you can have several.

- `GET /v1/domains?program_id=` shows all of them, each with `live`, `pending` and `records`.
- `POST /v1/domains/{kind}` attaches a hostname as `portal`, `tracker` or `email`, replacing the
  current one. Pass `program_id` and `hostname`.
- `POST /v1/domains/{kind}/verify` asks the host to re-check now. A new record can take a few
  minutes, so `live: false` straight after adding it is normal.
- `DELETE /v1/domains/{kind}?program_id=` detaches it.
- `POST /v1/link-domains`, `POST /v1/link-domains/{id}/verify` and `DELETE /v1/link-domains/{id}`
  do the same for a link domain.

Removing a domain is destructive. Partners lose the custom address, and links on a removed link
domain stop working. None of these are limited by plan.

If a server can't reach the domain host, the call fails with `domains_unavailable` and tells you to
add the domain in the dashboard. It never says a domain is set up when it isn't.

## In-portal notifications

A **notification** is an announcement partners see in their portal, in the bell or as a floating
card.

- `GET /v1/notifications?program_id=` lists them. `phase` is `scheduled`, `live` or `ended`.
- `POST /v1/notifications` publishes one. It reaches real partners as soon as it's live. Send an
  `Idempotency-Key` so a retry can't publish it twice.
- `POST /v1/notifications/{id}` changes one.
- `POST /v1/notifications/{id}/end` takes it down now and keeps its seen and dismissed numbers.
- `DELETE /v1/notifications/{id}` removes it and those numbers.
- `GET` and `POST /v1/notification-centre` read and set the one switch for the bell.

## Program fields

Three setup choices are plain fields on `POST /v1/programs/{id}`:

- `payout_methods`: which methods partners may pick, from `paypal`, `wise`, `bank_transfer`,
  `wire`, `crypto` and `payoneer`. It moves no money. Payouts still run over your own PayPal or
  Wise connection.
- `default_landing_url`: where referral links send visitors. `null` clears it, and links go to
  `website_url`.
- `auto_enrol_customers`: when true, every customer who converts from then on is invited to be a
  partner. Customers you already have aren't contacted.

`GET /v1/programs/{id}` returns `default_landing_url` and `auto_enrol_customers`.
