Kenso MCP tools

Domain Orders domain_orders

Call it from an MCP client connected to https://mcp.ken.so/mcp: reads go through domain_orders_read and changes through domain_orders_write. Each takes operation plus that operation's parameters, and your workspace role decides which operations you see.

Each operation with a route calls the Kenso API at https://api.ken.so with Authorization: Bearer <Kenso API key>, Ken-Version: 1.1 and X-Ken-Workspace-Id: <workspace id>. You can call that route directly with the same headers.

Operations: cancel, claim, domain-imports-create, domain-orders-create, get, domain-imports-list, domain-orders-list, domain-imports-preview, domain-orders-search, domain_import-capacity, purchase-capacity, check_nameservers, import, orders_get, orders_list

cancel

Write. POST https://api.ken.so/v1/domain-orders/{orderId}/cancel

Path: orderId

Cancel an unpaid domain order. Internal. Requires Delivery edit and the `billing` permission (admins by default).

POST /api/v1/domain-orders/{orderId}/cancel. Internal. Sends Ken-Version 1.1.

claim

Write. POST https://api.ken.so/v1/domain-imports/claims

Body (json): domain string

Get the TXT record that proves this workspace controls a domain another workspace's pending import holds. Internal. Requires the Delivery page at edit access, as the import does.

POST /api/v1/domain-imports/claims. Internal. Sends Ken-Version 1.1.
Returns domain, recordName (_ken-verify.<domain>) and recordValue (ken-verify=<token>).
Idempotent: the same workspace and domain always get the same record; the token is
per workspace, so another workspace's record never proves control for this one.
Publish it as a TXT record at the domain's own DNS, then import the domain again with
domain_imports_create: when create answers DomainPendingElsewhere it carries the same
record as claim. Once the record resolves, the import takes the pending row over.
DNS caches can hide a new record for a while, so a retry right after adding it may still
answer DomainPendingElsewhere. ClaimLookupFailed means the TXT lookup failed: retry later.

domain-imports-create

Write. POST https://api.ken.so/v1/domain-imports

Body (json): domains array, forwardingUrl string, websiteMode string

Import bring-your-own domains. With domain pages on, website_mode is required: ask the person "What should people see when they open these domains? A rebuild of your website (recommended) or a redirect to your website?", pass page or redirect, and never choose for them. Internal. Requires Delivery edit access. risk_confirmed defaults to false.

POST /api/v1/domain-imports. Internal. Sends Ken-Version 1.1.
Remaining daily send capacity is GET /api/v1/sending-capacity.
A name another workspace holds, a Kenso main domain, or a name whose Kenso
DNS zone is already active returns DomainTaken. A name another
workspace's import is still waiting to move nameservers for returns
DomainPendingElsewhere with a claim (recordName, recordValue): publish that TXT
record at the domain's DNS and import again to take it over (domain_imports_claim).
Only a Kenso staff caller converts Ken Master or clientless inventory (DEV-2570);
a workspace converts only its own Kenso-bought domains.
A name Spamhaus DBL or SURBL lists returns DomainBlocklisted (DEV-3697): a burned
domain never joins Kenso's warmup pool, and risk_confirmed does not lift it.
website_mode: page (Kenso rebuilds the client's home page on these domains) or redirect, written onto
each domain the import creates or claims. A domain taken over from another workspace never keeps that
workspace's answer. Required in a workspace with domain pages on (the call is refused without it);
optional elsewhere.

domain-orders-create

Write. POST https://api.ken.so/v1/domain-orders

Body (json): domains array, forwardingUrl string, targetWorkspaceId integer, websiteMode string

Create a domain order. With domain pages on, website_mode is required: ask the person "What should people see when they open these domains? A rebuild of your website (recommended) or a redirect to your website?", pass page or redirect, and never choose for them. Credit plans pay with credits; exempt workspaces get a Stripe checkout URL; staff Performance orders can be free (paidByKenso). registrar_price is usd minor units. Internal.

POST /api/v1/domain-orders. Internal. Sends Ken-Version 1.1. Take each registrar_price from domain-orders-search.
Money: each domain's price and the answer's amount are US cents (1040 is $10.40): quote amount / 100 as dollars,
never the amount itself.
Requires Delivery edit and the `billing` permission (admins by default) and a numeric user id. Returns 201.
Credits (DEV-1544 B07): the response has paidWithCredits (bool) and
chargedMillicredits (null for Stripe orders). A credit-paid order has
checkoutUrl null; exempt workspaces (bypass, VIP) still get a Stripe
checkout URL. Performance (DEV-8458 BE-36), only while the backend's
DomainOrders:PerformancePaidByKenso switch is on (off by default, and then a
Performance order gets a Stripe checkout URL like any exempt workspace): a Kenso
staff order for an active Performance workspace, bought for that workspace
itself, is paid by Kenso: no checkout URL, no credit charge, amount 0 and
paidByKenso true, and the domains go straight to purchase. A Kenso-paid item
whose registrar price is above its quote is not bought and fails, as on
any staff order. The client is charged nothing for those inboxes later either.
A non-staff caller on a Performance workspace still gets a Stripe checkout URL.
paidByKenso is false on every other order.
The preflight needs the registration plus the first month of the order's inboxes in credits, else 402 with refusal INSUFFICIENT_CREDITS, or
FREE_CREDITS_NOT_ELIGIBLE when only free or bonus credits would cover it (they can't pay for
domains or inboxes).
Free workspaces cannot buy Kenso domains. Before B07 is deployed every order
still returns a checkout URL.
target_workspace_id (white-label masters only, Kenso staff only on MCP) must be a child of client_id
and have domain and mailbox cap room. Billing stays with client_id. The
domains and mailboxes land in the child. It is refused until the server
sets KEN_WHITE_LABEL_CHILD_ORDERS=1, which happens after ken-backend
DEV-1216 is deployed; an older backend would silently deliver to client_id.
website_mode: page (Kenso rebuilds the client's home page on these domains) or redirect (they keep
redirecting to the website). Stored on the order and copied onto each domain it creates.
Required in a workspace with domain pages on (the call is refused without it); optional elsewhere.
Each domain's platform: GOOGLE or MICROSOFT (1 to 5 mailboxes) or AZURE (1 to 50). SMTP needs the
smtp_inbox_orders feature: 1 to 20 mailboxes on a domain, priced per domain a month.
idempotency_key (1 to 200 characters) is sent as Idempotency-Key; omitted, the call gets a new one, which
you cannot reuse, so pass your own (a uuid) to make a retry safe. The tool retries only a 429, with the same
key. After a timeout or a 5xx, retry with the same key and the same request: within 24 hours, from the same
member, it returns the first order (same id, Idempotent-Replayed: true) and places nothing new. Then read
domain_orders(operation="get", order_id=...) for its current state; a replayed checkoutUrl may have expired,
and domain_orders(operation="resume-checkout", order_id=...) returns a fresh one. A refusal (credits not in
yet) is not kept: a retry with the key tries the order again. 503 means the first call with the key is still
running: retry in a second. The same key with another request is 409 idempotency_key_reused. After a cancel,
use a new key.

get

Read. GET https://api.ken.so/v1/domain-orders/{orderId}

Path: orderId

Return one domain order in the current workspace. A missing or cross-workspace id is not_found.

GET /api/v1/domain-orders/{orderId}. Internal. Sends Ken-Version 1.1.
Requires Delivery view. Items include mailDomainId and replacementSuggestions.
Each item has progress {step, steps} (DEV-9276): step is one of ordered,
registering, dns, inboxes, warming, ready; a failed or cancelled item keeps
the step it reached, and status is unchanged beside it.
items[].sendingProvider is served to staff callers only.

domain-imports-list

Read. GET https://api.ken.so/v1/domain-imports

Query: cursor string, limit integer

List imported domains in the current workspace. Internal. Requires Delivery view.

GET /api/v1/domain-imports. Internal. Sends Ken-Version 1.1.
client_id is sent as X-Ken-Workspace-Id.

domain-orders-list

Read. GET https://api.ken.so/v1/domain-orders

Query: activeOnly boolean, cursor string, limit integer

List domain orders in the current workspace. Internal. active_only defaults to true when omitted.

GET /api/v1/domain-orders. Internal. Sends Ken-Version 1.1.
client_id is sent as X-Ken-Workspace-Id. Requires Delivery view.
Items include mailDomainId and replacementSuggestions.
Each item has progress {step, steps} (DEV-9276): step is where the domain
is in its setup, one of steps, always ordered, registering, dns, inboxes,
warming, ready. A failed or cancelled item keeps the step it reached;
status is unchanged beside it.
Daily send capacity for checkout is triggers(operation="sending-capacity-get").

domain-imports-preview

Read. POST https://api.ken.so/v1/domain-imports/preview

Body (json): domains array

Preview a bring-your-own-domain import. Nothing is persisted. Internal. Requires Delivery edit access.

POST /api/v1/domain-imports/preview. Internal. Sends Ken-Version 1.1.
Each domain has name and platform. A row with errorCode DomainBlocklisted is on
Spamhaus DBL or SURBL: the import refuses it, so pick another domain.
Each row also carries registrar {name, ianaId, guide} from public RDAP,
currentNameservers (the nameservers the domain has now) and
nameserversChangeable. guide is the key of that registrar's nameserver steps
(other when there are none); describe_tools lists the keys.
nameserversChangeable false means Cloudflare Registrar: such a domain must keep
Cloudflare's nameservers, so it cannot connect; offer a new domain from Kenso.
All three are null when the lookup failed; the preview still answers. Nothing is
transferred: the domain stays at its registrar.

Read. POST https://api.ken.so/v1/domain-orders/search

Body (json): cursor string, domain string, keyword string, limit integer, tlds array

Search purchasable domains. Prices are Kenso charges in minor units: each amount is US cents (1200 is $12.00), so quote amount / 100 as dollars, never the amount itself. Internal. Requires Delivery edit access.

POST /api/v1/domain-orders/search. Internal. Sends Ken-Version 1.1.
After DEV-1544 B07 each hit also has priceMillicredits (the domain's first
year in credits), renewalPrice
(minor units, nullable) and renewalPriceMillicredits (nullable).

domain_import-capacity

Read.

Import customer-owned domains onto Kenso DNS nameservers.

Bring-your-own-domain import. Kenso creates the DNS zone and returns
Kenso DNS nameservers. The user changes NS at their registrar. Kenso
owns the zone. Customer DNS API tokens are not supported.

Gate on remaining daily send (capacity.remaining) and paid-plan errors
from Kenso. Mailbox count is remaining / per-inbox daily (Google/Outlook
25, Azure 5). kenMailboxSlots does not cap imports, so never clamp to
it. Only a white-label child (billing managedByWorkspace set) is also
held to its parent's caps.mailboxes and caps.domains, which count every
inbox and domain in the workspace. Otherwise domain count is not a
blocker. Max 50 domains per import. Forwarding URL is required on
import.

Backend auth: capacity needs Delivery view access. import and check_nameservers need Delivery edit access (owners, admins and editors by default).
GET/POST only.

Operations:
-----------
capacity:
    GET /v1/domains/imports/capacity. Remaining daily send for the cart.
    data: emailLimit, planDaily, existingCapacity, remaining,
    existingGoogleCount, existingMicrosoftCount, existingAzureCount.
    planDaily is emails/day. Do not derive it as emailLimit/30.
    planDailyEnforced (DEV-1544 B06) says whether it is a hard cap: true for
    Premium (VIP), false for credit plans (Free, Starter, Growth, Core,
    Platform, Dfy) and bypass workspaces. When false, planDaily is a
    planning figure: checkout and import are not refused above it; each
    Kenso inbox costs 200 credits ($4) a month instead. A white-label child
    stays held to caps.mailboxes. When the field is missing (before B06),
    treat it as true.
    Google/Outlook mailboxes use 25/day; Azure uses 5/day. Mailbox count
    is remaining / that per-inbox daily.
    kenMailboxSlots does not cap it; only a white-label child is also
    held to caps.mailboxes.
    Example: operation="capacity", client_id=42

import:
    POST /v1/domains/imports. Submit a confirmed cart. Requires
    forwarding_url (http/https) and domains with at least one mailbox
    each. Per domain: domain, platform, risk_confirmed (true when the
    user continued on MX / live-site warnings), mailboxes:
    {first_name, last_name, username, profile_pic_url?}.
    username is the local-part only. profile_pic_url is optional for
    Google/Outlook; omit for Azure. Packing: Google/Outlook 1-5
    mailboxes per domain, Azure 1-50.
    Paid plan required (Platform, Dfy, VIP, or a grandfathered Starter /
    Growth / Core plan, billing Active or Trialing; Free cannot import onto
    Kenso inboxes).
    Successful items return Kenso DNS nameservers to copy at the
    registrar. userFacingStatus starts as settingUp.
    website_mode: page (Kenso rebuilds the client's home page on these domains) or redirect. In a
    workspace with domain pages on it is required (the call is refused without it): ask the person
    "What should people see when they open these domains? A rebuild of your website (recommended) or a redirect to your website?", pass page or redirect, and never choose for them. After the
    import, the answer is written to every imported domain with domains(operation="bulk-update");
    the result's websiteMode says which domains got it. If that write fails, the domains stay
    imported and websiteMode.error names the bulk-update call to send again.
    Example: operation="import", forwarding_url="https://acme.com", website_mode="page",
        domains=[{"domain": "acme.io", "platform": "GOOGLE",
        "risk_confirmed": False, "mailboxes": [{"first_name": "Ada",
        "last_name": "Lovelace", "username": "ada"}]}]

check_nameservers:
    POST /v1/domains/{domain_id}/nameservers/check. One-shot Kenso
    DNS zone read; activates if the zone is live. Requires
    domain_id. Call after the user says they updated registrar NS.
    Example: operation="check_nameservers", domain_id=101, client_id=42

purchase-capacity

Read.

Read remaining send capacity, list orders, and open Stripe checkout for new domains (the workspace is charged), plus staff domain operations.

Paid workspaces can read remaining daily send capacity and open a Stripe
Checkout session to register domains. The
self-serve paid plan is Platform (billing planType Platform); Dfy, VIP
(Premium) and the grandfathered Starter / Growth / Core plans can buy too.
Free cannot buy Kenso domains or inboxes.

The Kenso charge is `chargeUsd`, a whole-dollar price per domain (DEV-6031). Checkout
creates a Stripe session. The
workspace pays `chargeUsd` per domain for one year of registration. Do
not tell the user they will not be charged.

Domain create / purchase-orders / search-available / allowance / provider
provisioning were removed. Import of domains the user already owns is
`domain_orders(operation="import")`. Do not send configuration_id.

Auto-renew is domains(operation="update", domain_id=..., changes={"autoRenew": true|false})
(it needs the billing permission). A domain's tags are on domains(operation="get", ...),
and tracking DNS is checked with domains(operation="verify-dns", ...) (DEV-15).

Operations:
-----------
provision_tracking_redirect:
    *** MUTATING (operator-only) *** Provision one domain as an edge-served
    click-tracking domain. Requires domain_id and
    confirm_provision_tracking_redirect=True; accepts optional client_id for
    tenancy scoping. Enables click-rate tracking, allocates the pooled
    link.<domain> serving hostname, creates the edge custom
    hostname, publishes the CNAME plus certificate-validation TXT records into
    the domain's zone, and flips the hostname to Ready once the edge reports
    both the hostname and its certificate active.

    Idempotent - re-running against an already-serving hostname is a no-op
    success. Spends edge custom-hostname quota and writes DNS, hence the
    confirmation flag.

    data.outcome: Skipped=0, Pending=1, Ready=2, Retrying=3, Failed=4.
    Pending is normal (DV certificates take minutes); the background sweep
    finishes the job. Skipped means the domain is not eligible.
    Example: operation="provision_tracking_redirect", domain_id=123,
        client_id=42, confirm_provision_tracking_redirect=True

capacity:
    Remaining daily send capacity for this workspace.
    GET /api/v1/domains/capacity.
    data: emailLimit, planDaily, existingCapacity, remaining,
    existingGoogleCount, existingMicrosoftCount, existingAzureCount.
    planDaily is emails/day. Do not derive it as emailLimit/30.
    planDailyEnforced (DEV-1544 B06) says whether it is a hard cap: true for
    Premium (VIP), false for credit plans (Free, Starter, Growth, Core,
    Platform, Dfy) and bypass workspaces. When false, planDaily is a
    planning figure: checkout and import are not refused above it; each
    Kenso inbox costs 200 credits ($4) a month instead. A white-label child
    stays held to caps.mailboxes. When the field is missing (before B06),
    treat it as true.
    Mailbox count is remaining / per-inbox daily (Google/Microsoft 25,
    Azure 5). kenMailboxSlots does not cap buys, so never clamp to it.
    Only a white-label child (billing managedByWorkspace set) is also held
    to its parent's caps.mailboxes and caps.domains, which count every
    inbox and domain in the workspace.
    Gate new orders on remaining > 0 only when planDailyEnforced is not
    false, and on a paid plan (Platform, Dfy, VIP or a grandfathered
    Starter / Growth / Core plan; Free cannot buy Kenso domains or inboxes),
    not DOMAIN_LIMIT_REACHED.
    Example: operation="capacity", client_id=42

checkout:
    Create a Stripe Checkout session for a cart of domains + mailboxes.
    POST /api/v1/domains/orders/checkout. Requires forwarding_url (http/https)
    and domains. Each domain: name, platform (GOOGLE|MICROSOFT|AZURE),
    registrar_price_usd (the registrar quote from the domain search result;
    a search result's own price field wins when the line carries both). Do not send
    chargeUsd as the registrar quote: if the posted quote equals that
    object's chargeUsd, checkout is rejected (the name would be priced too high).
    chargeUsd-only carts are rejected. Mailboxes [{first_name, last_name,
    username, profile_picture_url?}]. Mailboxes are required.
    Google/Microsoft: 1-5 per domain. Azure: 1-50.
    Returns data.url, data.sessionId, data.orderId (also stripeCheckoutUrl /
    stripeCheckoutSessionId from the Kenso DTO). Give the user the url. Stripe
    charges chargeUsd per domain for 1 year. Mailboxes are not on this
    invoice: on credit plans each Google/Microsoft inbox costs 200 credits
    ($4) a month and each Azure domain 2,500 credits ($50) a month. When the
    result has paidWithCredits true (DEV-1544 B07), the order was paid from
    credits and there is no url.
    In a workspace with domain pages on, checkout is refused because it cannot carry the
    website answer: ask the person "What should people see when they open these domains? A rebuild of your website (recommended) or a redirect to your website?" and order with domain_orders(operation="domain-orders-create", ..., website_mode=...).
    Example: operation="checkout", forwarding_url="https://acme.com",
        domains=[{"name": "tryacme.com", "platform": "GOOGLE",
        "registrar_price_usd": 12.50, "mailboxes": [{"first_name": "Jane",
        "last_name": "Doe", "username": "jane"}]}], client_id=42

orders_list:
    List domain orders. GET /api/v1/domains/orders.
    active_only defaults to True.
    Example: operation="orders_list", client_id=42

orders_get:
    Get one domain order. GET /api/v1/domains/orders/{order_id}.
    Requires order_id. Order status (DomainPurchaseOrderStatus):
    1=Processing, 2=Completed, 3=CompletedWithIssues, 4=ActionRequired.
    Item userFacingStatus lives on items[] (not on the order):
    pending | settingUp | awaitingClientApproval | actionRequired | active | failed.
    awaitingClientApproval: paid, waiting for the client to approve in
    External approvals; the sweep skips it.
    Example: operation="orders_get", order_id=99, client_id=42

set_catch_all:
    *** MUTATING (Kenso super-admin / staff only) *** Set domain catch-all.
    PUT /api/v1/domains/{domain_id}/catch-all. Requires domain_id.
    Pass catch_all_email, or omit it to apply the setup default (provider
    admin email, else a mailbox on that domain).
    Example: operation="set_catch_all", domain_id=123, client_id=42,
        catch_all_email="hello@send.acme.com"
    Example: operation="set_catch_all", domain_id=123, client_id=42

set_masking:
    *** MUTATING (Kenso super-admin / staff only) *** Toggle mailbox-provider
    URL-cloaked masking for one domain. PATCH /api/v1/domains/{domain_id}/masking.
    Requires domain_id and enabled (bool). When ON, the mailbox provider keeps the
    burner domain in the URL bar and proxies the brand site instead of a 301.
    Enabling requires a forwarding URL (workspace website or domain
    forwarding URL). Response data includes maskingEnabled and forwardingUrl.
    Domain reads already expose maskingEnabled for verification.
    Example: operation="set_masking", domain_id=123, enabled=True, client_id=42
    Example: operation="set_masking", domain_id=123, enabled=False, client_id=42

enable_all_masking:
    *** MUTATING (Kenso super-admin / staff only) *** Enable mailbox-provider masking
    on domains connected to the mailbox provider. POST /api/v1/domains/masking/enable-all.
    Optional client_id pins one workspace. Omitting client_id writes every
    tenant and requires confirm_enable_all_masking=True. Optional after_id
    pages past already-processed rows (pass data.nextAfterId). Each request
    writes at most 50 domains. Envelope success is not "all masked": read
    data.attempted, enabled, skippedNoUrl, skippedAlreadyEnabled, failed,
    truncated, writeLimit, nextAfterId, fleetLimit, and failures[]. Rerun
    with after_id=data.nextAfterId until truncated is false.
    Example: operation="enable_all_masking", client_id=42
    Example: operation="enable_all_masking", confirm_enable_all_masking=True
    Example: operation="enable_all_masking", confirm_enable_all_masking=True,
        after_id=1200

move_workspace:
    *** MUTATING (Kenso super-admin / staff only) *** Move Kenso-native domains
    between workspaces. POST /api/v1/domains/move-workspace. Requires
    source_client_id, target_client_id, and domain_ids (or domain_id).
    dry_run=True reports impact without writing. SuperAdmin only; clients
    are blocked. Do not UPDATE inboxes.client_id by hand.
    Example: operation="move_workspace", source_client_id=1002, target_client_id=42, domain_ids=[10,11], dry_run=True

Promoting a Ken Master pre-warmup domain to Google is not an operation
here. Use admin_mail(operation="promote-pre-warmup", workspace_id=1002).

Parameters:
-----------
client : KenAPIClient
    API client instance
operation : str
    The operation to perform
domain_id : int, optional
    Domain ID (required for provision_tracking_redirect, set_catch_all,
    set_masking; alias for a
    single-id move_workspace)
client_id : int, optional
    Client/tenant ID (forwarded as clientId query scope when provided)
source_client_id : int, optional
    Source workspace for move_workspace.
target_client_id : int, optional
    Target workspace for move_workspace.
domain_ids : list[int], optional
    Domain IDs for move_workspace. Falls back to domain_id when omitted.
dry_run : bool, default=False
    When True, move_workspace reports impact without writing. The other
    operations have no preview and refuse dry_run=True.
enabled : bool, optional
    Masking on/off for set_masking.
    False is a valid value (do not omit the field to disable).
catch_all_email : str, optional
    Catch-all address for set_catch_all. Omit to apply the provider admin
    email default.
confirm_provision_tracking_redirect : bool, default=False
    Required explicit confirmation for provision_tracking_redirect. This
    mutation spends edge custom-hostname quota and writes DNS records
    into the domain's zone.
confirm_enable_all_masking : bool, default=False
    Required when enable_all_masking omits client_id (cross-tenant fleet
    write to the mailbox provider). Not required when client_id pins one workspace.
after_id : int, optional
    Enable-all cursor. Pass data.nextAfterId from the previous page.
forwarding_url : str, optional
    Required for checkout. Destination URL for the purchased domains.
domains : list[dict], optional
    Required for checkout. Cart lines (see checkout op).
order_id : int, optional
    Required for orders_get.
active_only : bool, default=True
    For orders_list.

Returns:
--------
dict
    API response. checkout data includes url, sessionId, and orderId.
    capacity data includes remaining daily sends.

Examples:
---------
Capacity then checkout:
    >>> await domain_manage(operation="capacity", client_id=42)
    >>> await domain_manage(
    ...     operation="checkout",
    ...     client_id=42,
    ...     forwarding_url="https://acme.com",
    ...     domains=[...],
    ... )

check_nameservers

Read.

Import customer-owned domains onto Kenso DNS nameservers.

Bring-your-own-domain import. Kenso creates the DNS zone and returns
Kenso DNS nameservers. The user changes NS at their registrar. Kenso
owns the zone. Customer DNS API tokens are not supported.

Gate on remaining daily send (capacity.remaining) and paid-plan errors
from Kenso. Mailbox count is remaining / per-inbox daily (Google/Outlook
25, Azure 5). kenMailboxSlots does not cap imports, so never clamp to
it. Only a white-label child (billing managedByWorkspace set) is also
held to its parent's caps.mailboxes and caps.domains, which count every
inbox and domain in the workspace. Otherwise domain count is not a
blocker. Max 50 domains per import. Forwarding URL is required on
import.

Backend auth: capacity needs Delivery view access. import and check_nameservers need Delivery edit access (owners, admins and editors by default).
GET/POST only.

Operations:
-----------
capacity:
    GET /v1/domains/imports/capacity. Remaining daily send for the cart.
    data: emailLimit, planDaily, existingCapacity, remaining,
    existingGoogleCount, existingMicrosoftCount, existingAzureCount.
    planDaily is emails/day. Do not derive it as emailLimit/30.
    planDailyEnforced (DEV-1544 B06) says whether it is a hard cap: true for
    Premium (VIP), false for credit plans (Free, Starter, Growth, Core,
    Platform, Dfy) and bypass workspaces. When false, planDaily is a
    planning figure: checkout and import are not refused above it; each
    Kenso inbox costs 200 credits ($4) a month instead. A white-label child
    stays held to caps.mailboxes. When the field is missing (before B06),
    treat it as true.
    Google/Outlook mailboxes use 25/day; Azure uses 5/day. Mailbox count
    is remaining / that per-inbox daily.
    kenMailboxSlots does not cap it; only a white-label child is also
    held to caps.mailboxes.
    Example: operation="capacity", client_id=42

import:
    POST /v1/domains/imports. Submit a confirmed cart. Requires
    forwarding_url (http/https) and domains with at least one mailbox
    each. Per domain: domain, platform, risk_confirmed (true when the
    user continued on MX / live-site warnings), mailboxes:
    {first_name, last_name, username, profile_pic_url?}.
    username is the local-part only. profile_pic_url is optional for
    Google/Outlook; omit for Azure. Packing: Google/Outlook 1-5
    mailboxes per domain, Azure 1-50.
    Paid plan required (Platform, Dfy, VIP, or a grandfathered Starter /
    Growth / Core plan, billing Active or Trialing; Free cannot import onto
    Kenso inboxes).
    Successful items return Kenso DNS nameservers to copy at the
    registrar. userFacingStatus starts as settingUp.
    website_mode: page (Kenso rebuilds the client's home page on these domains) or redirect. In a
    workspace with domain pages on it is required (the call is refused without it): ask the person
    "What should people see when they open these domains? A rebuild of your website (recommended) or a redirect to your website?", pass page or redirect, and never choose for them. After the
    import, the answer is written to every imported domain with domains(operation="bulk-update");
    the result's websiteMode says which domains got it. If that write fails, the domains stay
    imported and websiteMode.error names the bulk-update call to send again.
    Example: operation="import", forwarding_url="https://acme.com", website_mode="page",
        domains=[{"domain": "acme.io", "platform": "GOOGLE",
        "risk_confirmed": False, "mailboxes": [{"first_name": "Ada",
        "last_name": "Lovelace", "username": "ada"}]}]

check_nameservers:
    POST /v1/domains/{domain_id}/nameservers/check. One-shot Kenso
    DNS zone read; activates if the zone is live. Requires
    domain_id. Call after the user says they updated registrar NS.
    Example: operation="check_nameservers", domain_id=101, client_id=42

import

Write.

Import customer-owned domains onto Kenso DNS nameservers.

Bring-your-own-domain import. Kenso creates the DNS zone and returns
Kenso DNS nameservers. The user changes NS at their registrar. Kenso
owns the zone. Customer DNS API tokens are not supported.

Gate on remaining daily send (capacity.remaining) and paid-plan errors
from Kenso. Mailbox count is remaining / per-inbox daily (Google/Outlook
25, Azure 5). kenMailboxSlots does not cap imports, so never clamp to
it. Only a white-label child (billing managedByWorkspace set) is also
held to its parent's caps.mailboxes and caps.domains, which count every
inbox and domain in the workspace. Otherwise domain count is not a
blocker. Max 50 domains per import. Forwarding URL is required on
import.

Backend auth: capacity needs Delivery view access. import and check_nameservers need Delivery edit access (owners, admins and editors by default).
GET/POST only.

Operations:
-----------
capacity:
    GET /v1/domains/imports/capacity. Remaining daily send for the cart.
    data: emailLimit, planDaily, existingCapacity, remaining,
    existingGoogleCount, existingMicrosoftCount, existingAzureCount.
    planDaily is emails/day. Do not derive it as emailLimit/30.
    planDailyEnforced (DEV-1544 B06) says whether it is a hard cap: true for
    Premium (VIP), false for credit plans (Free, Starter, Growth, Core,
    Platform, Dfy) and bypass workspaces. When false, planDaily is a
    planning figure: checkout and import are not refused above it; each
    Kenso inbox costs 200 credits ($4) a month instead. A white-label child
    stays held to caps.mailboxes. When the field is missing (before B06),
    treat it as true.
    Google/Outlook mailboxes use 25/day; Azure uses 5/day. Mailbox count
    is remaining / that per-inbox daily.
    kenMailboxSlots does not cap it; only a white-label child is also
    held to caps.mailboxes.
    Example: operation="capacity", client_id=42

import:
    POST /v1/domains/imports. Submit a confirmed cart. Requires
    forwarding_url (http/https) and domains with at least one mailbox
    each. Per domain: domain, platform, risk_confirmed (true when the
    user continued on MX / live-site warnings), mailboxes:
    {first_name, last_name, username, profile_pic_url?}.
    username is the local-part only. profile_pic_url is optional for
    Google/Outlook; omit for Azure. Packing: Google/Outlook 1-5
    mailboxes per domain, Azure 1-50.
    Paid plan required (Platform, Dfy, VIP, or a grandfathered Starter /
    Growth / Core plan, billing Active or Trialing; Free cannot import onto
    Kenso inboxes).
    Successful items return Kenso DNS nameservers to copy at the
    registrar. userFacingStatus starts as settingUp.
    website_mode: page (Kenso rebuilds the client's home page on these domains) or redirect. In a
    workspace with domain pages on it is required (the call is refused without it): ask the person
    "What should people see when they open these domains? A rebuild of your website (recommended) or a redirect to your website?", pass page or redirect, and never choose for them. After the
    import, the answer is written to every imported domain with domains(operation="bulk-update");
    the result's websiteMode says which domains got it. If that write fails, the domains stay
    imported and websiteMode.error names the bulk-update call to send again.
    Example: operation="import", forwarding_url="https://acme.com", website_mode="page",
        domains=[{"domain": "acme.io", "platform": "GOOGLE",
        "risk_confirmed": False, "mailboxes": [{"first_name": "Ada",
        "last_name": "Lovelace", "username": "ada"}]}]

check_nameservers:
    POST /v1/domains/{domain_id}/nameservers/check. One-shot Kenso
    DNS zone read; activates if the zone is live. Requires
    domain_id. Call after the user says they updated registrar NS.
    Example: operation="check_nameservers", domain_id=101, client_id=42

orders_get

Read.

Read remaining send capacity, list orders, and open Stripe checkout for new domains (the workspace is charged), plus staff domain operations.

Paid workspaces can read remaining daily send capacity and open a Stripe
Checkout session to register domains. The
self-serve paid plan is Platform (billing planType Platform); Dfy, VIP
(Premium) and the grandfathered Starter / Growth / Core plans can buy too.
Free cannot buy Kenso domains or inboxes.

The Kenso charge is `chargeUsd`, a whole-dollar price per domain (DEV-6031). Checkout
creates a Stripe session. The
workspace pays `chargeUsd` per domain for one year of registration. Do
not tell the user they will not be charged.

Domain create / purchase-orders / search-available / allowance / provider
provisioning were removed. Import of domains the user already owns is
`domain_orders(operation="import")`. Do not send configuration_id.

Auto-renew is domains(operation="update", domain_id=..., changes={"autoRenew": true|false})
(it needs the billing permission). A domain's tags are on domains(operation="get", ...),
and tracking DNS is checked with domains(operation="verify-dns", ...) (DEV-15).

Operations:
-----------
provision_tracking_redirect:
    *** MUTATING (operator-only) *** Provision one domain as an edge-served
    click-tracking domain. Requires domain_id and
    confirm_provision_tracking_redirect=True; accepts optional client_id for
    tenancy scoping. Enables click-rate tracking, allocates the pooled
    link.<domain> serving hostname, creates the edge custom
    hostname, publishes the CNAME plus certificate-validation TXT records into
    the domain's zone, and flips the hostname to Ready once the edge reports
    both the hostname and its certificate active.

    Idempotent - re-running against an already-serving hostname is a no-op
    success. Spends edge custom-hostname quota and writes DNS, hence the
    confirmation flag.

    data.outcome: Skipped=0, Pending=1, Ready=2, Retrying=3, Failed=4.
    Pending is normal (DV certificates take minutes); the background sweep
    finishes the job. Skipped means the domain is not eligible.
    Example: operation="provision_tracking_redirect", domain_id=123,
        client_id=42, confirm_provision_tracking_redirect=True

capacity:
    Remaining daily send capacity for this workspace.
    GET /api/v1/domains/capacity.
    data: emailLimit, planDaily, existingCapacity, remaining,
    existingGoogleCount, existingMicrosoftCount, existingAzureCount.
    planDaily is emails/day. Do not derive it as emailLimit/30.
    planDailyEnforced (DEV-1544 B06) says whether it is a hard cap: true for
    Premium (VIP), false for credit plans (Free, Starter, Growth, Core,
    Platform, Dfy) and bypass workspaces. When false, planDaily is a
    planning figure: checkout and import are not refused above it; each
    Kenso inbox costs 200 credits ($4) a month instead. A white-label child
    stays held to caps.mailboxes. When the field is missing (before B06),
    treat it as true.
    Mailbox count is remaining / per-inbox daily (Google/Microsoft 25,
    Azure 5). kenMailboxSlots does not cap buys, so never clamp to it.
    Only a white-label child (billing managedByWorkspace set) is also held
    to its parent's caps.mailboxes and caps.domains, which count every
    inbox and domain in the workspace.
    Gate new orders on remaining > 0 only when planDailyEnforced is not
    false, and on a paid plan (Platform, Dfy, VIP or a grandfathered
    Starter / Growth / Core plan; Free cannot buy Kenso domains or inboxes),
    not DOMAIN_LIMIT_REACHED.
    Example: operation="capacity", client_id=42

checkout:
    Create a Stripe Checkout session for a cart of domains + mailboxes.
    POST /api/v1/domains/orders/checkout. Requires forwarding_url (http/https)
    and domains. Each domain: name, platform (GOOGLE|MICROSOFT|AZURE),
    registrar_price_usd (the registrar quote from the domain search result;
    a search result's own price field wins when the line carries both). Do not send
    chargeUsd as the registrar quote: if the posted quote equals that
    object's chargeUsd, checkout is rejected (the name would be priced too high).
    chargeUsd-only carts are rejected. Mailboxes [{first_name, last_name,
    username, profile_picture_url?}]. Mailboxes are required.
    Google/Microsoft: 1-5 per domain. Azure: 1-50.
    Returns data.url, data.sessionId, data.orderId (also stripeCheckoutUrl /
    stripeCheckoutSessionId from the Kenso DTO). Give the user the url. Stripe
    charges chargeUsd per domain for 1 year. Mailboxes are not on this
    invoice: on credit plans each Google/Microsoft inbox costs 200 credits
    ($4) a month and each Azure domain 2,500 credits ($50) a month. When the
    result has paidWithCredits true (DEV-1544 B07), the order was paid from
    credits and there is no url.
    In a workspace with domain pages on, checkout is refused because it cannot carry the
    website answer: ask the person "What should people see when they open these domains? A rebuild of your website (recommended) or a redirect to your website?" and order with domain_orders(operation="domain-orders-create", ..., website_mode=...).
    Example: operation="checkout", forwarding_url="https://acme.com",
        domains=[{"name": "tryacme.com", "platform": "GOOGLE",
        "registrar_price_usd": 12.50, "mailboxes": [{"first_name": "Jane",
        "last_name": "Doe", "username": "jane"}]}], client_id=42

orders_list:
    List domain orders. GET /api/v1/domains/orders.
    active_only defaults to True.
    Example: operation="orders_list", client_id=42

orders_get:
    Get one domain order. GET /api/v1/domains/orders/{order_id}.
    Requires order_id. Order status (DomainPurchaseOrderStatus):
    1=Processing, 2=Completed, 3=CompletedWithIssues, 4=ActionRequired.
    Item userFacingStatus lives on items[] (not on the order):
    pending | settingUp | awaitingClientApproval | actionRequired | active | failed.
    awaitingClientApproval: paid, waiting for the client to approve in
    External approvals; the sweep skips it.
    Example: operation="orders_get", order_id=99, client_id=42

set_catch_all:
    *** MUTATING (Kenso super-admin / staff only) *** Set domain catch-all.
    PUT /api/v1/domains/{domain_id}/catch-all. Requires domain_id.
    Pass catch_all_email, or omit it to apply the setup default (provider
    admin email, else a mailbox on that domain).
    Example: operation="set_catch_all", domain_id=123, client_id=42,
        catch_all_email="hello@send.acme.com"
    Example: operation="set_catch_all", domain_id=123, client_id=42

set_masking:
    *** MUTATING (Kenso super-admin / staff only) *** Toggle mailbox-provider
    URL-cloaked masking for one domain. PATCH /api/v1/domains/{domain_id}/masking.
    Requires domain_id and enabled (bool). When ON, the mailbox provider keeps the
    burner domain in the URL bar and proxies the brand site instead of a 301.
    Enabling requires a forwarding URL (workspace website or domain
    forwarding URL). Response data includes maskingEnabled and forwardingUrl.
    Domain reads already expose maskingEnabled for verification.
    Example: operation="set_masking", domain_id=123, enabled=True, client_id=42
    Example: operation="set_masking", domain_id=123, enabled=False, client_id=42

enable_all_masking:
    *** MUTATING (Kenso super-admin / staff only) *** Enable mailbox-provider masking
    on domains connected to the mailbox provider. POST /api/v1/domains/masking/enable-all.
    Optional client_id pins one workspace. Omitting client_id writes every
    tenant and requires confirm_enable_all_masking=True. Optional after_id
    pages past already-processed rows (pass data.nextAfterId). Each request
    writes at most 50 domains. Envelope success is not "all masked": read
    data.attempted, enabled, skippedNoUrl, skippedAlreadyEnabled, failed,
    truncated, writeLimit, nextAfterId, fleetLimit, and failures[]. Rerun
    with after_id=data.nextAfterId until truncated is false.
    Example: operation="enable_all_masking", client_id=42
    Example: operation="enable_all_masking", confirm_enable_all_masking=True
    Example: operation="enable_all_masking", confirm_enable_all_masking=True,
        after_id=1200

move_workspace:
    *** MUTATING (Kenso super-admin / staff only) *** Move Kenso-native domains
    between workspaces. POST /api/v1/domains/move-workspace. Requires
    source_client_id, target_client_id, and domain_ids (or domain_id).
    dry_run=True reports impact without writing. SuperAdmin only; clients
    are blocked. Do not UPDATE inboxes.client_id by hand.
    Example: operation="move_workspace", source_client_id=1002, target_client_id=42, domain_ids=[10,11], dry_run=True

Promoting a Ken Master pre-warmup domain to Google is not an operation
here. Use admin_mail(operation="promote-pre-warmup", workspace_id=1002).

Parameters:
-----------
client : KenAPIClient
    API client instance
operation : str
    The operation to perform
domain_id : int, optional
    Domain ID (required for provision_tracking_redirect, set_catch_all,
    set_masking; alias for a
    single-id move_workspace)
client_id : int, optional
    Client/tenant ID (forwarded as clientId query scope when provided)
source_client_id : int, optional
    Source workspace for move_workspace.
target_client_id : int, optional
    Target workspace for move_workspace.
domain_ids : list[int], optional
    Domain IDs for move_workspace. Falls back to domain_id when omitted.
dry_run : bool, default=False
    When True, move_workspace reports impact without writing. The other
    operations have no preview and refuse dry_run=True.
enabled : bool, optional
    Masking on/off for set_masking.
    False is a valid value (do not omit the field to disable).
catch_all_email : str, optional
    Catch-all address for set_catch_all. Omit to apply the provider admin
    email default.
confirm_provision_tracking_redirect : bool, default=False
    Required explicit confirmation for provision_tracking_redirect. This
    mutation spends edge custom-hostname quota and writes DNS records
    into the domain's zone.
confirm_enable_all_masking : bool, default=False
    Required when enable_all_masking omits client_id (cross-tenant fleet
    write to the mailbox provider). Not required when client_id pins one workspace.
after_id : int, optional
    Enable-all cursor. Pass data.nextAfterId from the previous page.
forwarding_url : str, optional
    Required for checkout. Destination URL for the purchased domains.
domains : list[dict], optional
    Required for checkout. Cart lines (see checkout op).
order_id : int, optional
    Required for orders_get.
active_only : bool, default=True
    For orders_list.

Returns:
--------
dict
    API response. checkout data includes url, sessionId, and orderId.
    capacity data includes remaining daily sends.

Examples:
---------
Capacity then checkout:
    >>> await domain_manage(operation="capacity", client_id=42)
    >>> await domain_manage(
    ...     operation="checkout",
    ...     client_id=42,
    ...     forwarding_url="https://acme.com",
    ...     domains=[...],
    ... )

orders_list

Read.

Read remaining send capacity, list orders, and open Stripe checkout for new domains (the workspace is charged), plus staff domain operations.

Paid workspaces can read remaining daily send capacity and open a Stripe
Checkout session to register domains. The
self-serve paid plan is Platform (billing planType Platform); Dfy, VIP
(Premium) and the grandfathered Starter / Growth / Core plans can buy too.
Free cannot buy Kenso domains or inboxes.

The Kenso charge is `chargeUsd`, a whole-dollar price per domain (DEV-6031). Checkout
creates a Stripe session. The
workspace pays `chargeUsd` per domain for one year of registration. Do
not tell the user they will not be charged.

Domain create / purchase-orders / search-available / allowance / provider
provisioning were removed. Import of domains the user already owns is
`domain_orders(operation="import")`. Do not send configuration_id.

Auto-renew is domains(operation="update", domain_id=..., changes={"autoRenew": true|false})
(it needs the billing permission). A domain's tags are on domains(operation="get", ...),
and tracking DNS is checked with domains(operation="verify-dns", ...) (DEV-15).

Operations:
-----------
provision_tracking_redirect:
    *** MUTATING (operator-only) *** Provision one domain as an edge-served
    click-tracking domain. Requires domain_id and
    confirm_provision_tracking_redirect=True; accepts optional client_id for
    tenancy scoping. Enables click-rate tracking, allocates the pooled
    link.<domain> serving hostname, creates the edge custom
    hostname, publishes the CNAME plus certificate-validation TXT records into
    the domain's zone, and flips the hostname to Ready once the edge reports
    both the hostname and its certificate active.

    Idempotent - re-running against an already-serving hostname is a no-op
    success. Spends edge custom-hostname quota and writes DNS, hence the
    confirmation flag.

    data.outcome: Skipped=0, Pending=1, Ready=2, Retrying=3, Failed=4.
    Pending is normal (DV certificates take minutes); the background sweep
    finishes the job. Skipped means the domain is not eligible.
    Example: operation="provision_tracking_redirect", domain_id=123,
        client_id=42, confirm_provision_tracking_redirect=True

capacity:
    Remaining daily send capacity for this workspace.
    GET /api/v1/domains/capacity.
    data: emailLimit, planDaily, existingCapacity, remaining,
    existingGoogleCount, existingMicrosoftCount, existingAzureCount.
    planDaily is emails/day. Do not derive it as emailLimit/30.
    planDailyEnforced (DEV-1544 B06) says whether it is a hard cap: true for
    Premium (VIP), false for credit plans (Free, Starter, Growth, Core,
    Platform, Dfy) and bypass workspaces. When false, planDaily is a
    planning figure: checkout and import are not refused above it; each
    Kenso inbox costs 200 credits ($4) a month instead. A white-label child
    stays held to caps.mailboxes. When the field is missing (before B06),
    treat it as true.
    Mailbox count is remaining / per-inbox daily (Google/Microsoft 25,
    Azure 5). kenMailboxSlots does not cap buys, so never clamp to it.
    Only a white-label child (billing managedByWorkspace set) is also held
    to its parent's caps.mailboxes and caps.domains, which count every
    inbox and domain in the workspace.
    Gate new orders on remaining > 0 only when planDailyEnforced is not
    false, and on a paid plan (Platform, Dfy, VIP or a grandfathered
    Starter / Growth / Core plan; Free cannot buy Kenso domains or inboxes),
    not DOMAIN_LIMIT_REACHED.
    Example: operation="capacity", client_id=42

checkout:
    Create a Stripe Checkout session for a cart of domains + mailboxes.
    POST /api/v1/domains/orders/checkout. Requires forwarding_url (http/https)
    and domains. Each domain: name, platform (GOOGLE|MICROSOFT|AZURE),
    registrar_price_usd (the registrar quote from the domain search result;
    a search result's own price field wins when the line carries both). Do not send
    chargeUsd as the registrar quote: if the posted quote equals that
    object's chargeUsd, checkout is rejected (the name would be priced too high).
    chargeUsd-only carts are rejected. Mailboxes [{first_name, last_name,
    username, profile_picture_url?}]. Mailboxes are required.
    Google/Microsoft: 1-5 per domain. Azure: 1-50.
    Returns data.url, data.sessionId, data.orderId (also stripeCheckoutUrl /
    stripeCheckoutSessionId from the Kenso DTO). Give the user the url. Stripe
    charges chargeUsd per domain for 1 year. Mailboxes are not on this
    invoice: on credit plans each Google/Microsoft inbox costs 200 credits
    ($4) a month and each Azure domain 2,500 credits ($50) a month. When the
    result has paidWithCredits true (DEV-1544 B07), the order was paid from
    credits and there is no url.
    In a workspace with domain pages on, checkout is refused because it cannot carry the
    website answer: ask the person "What should people see when they open these domains? A rebuild of your website (recommended) or a redirect to your website?" and order with domain_orders(operation="domain-orders-create", ..., website_mode=...).
    Example: operation="checkout", forwarding_url="https://acme.com",
        domains=[{"name": "tryacme.com", "platform": "GOOGLE",
        "registrar_price_usd": 12.50, "mailboxes": [{"first_name": "Jane",
        "last_name": "Doe", "username": "jane"}]}], client_id=42

orders_list:
    List domain orders. GET /api/v1/domains/orders.
    active_only defaults to True.
    Example: operation="orders_list", client_id=42

orders_get:
    Get one domain order. GET /api/v1/domains/orders/{order_id}.
    Requires order_id. Order status (DomainPurchaseOrderStatus):
    1=Processing, 2=Completed, 3=CompletedWithIssues, 4=ActionRequired.
    Item userFacingStatus lives on items[] (not on the order):
    pending | settingUp | awaitingClientApproval | actionRequired | active | failed.
    awaitingClientApproval: paid, waiting for the client to approve in
    External approvals; the sweep skips it.
    Example: operation="orders_get", order_id=99, client_id=42

set_catch_all:
    *** MUTATING (Kenso super-admin / staff only) *** Set domain catch-all.
    PUT /api/v1/domains/{domain_id}/catch-all. Requires domain_id.
    Pass catch_all_email, or omit it to apply the setup default (provider
    admin email, else a mailbox on that domain).
    Example: operation="set_catch_all", domain_id=123, client_id=42,
        catch_all_email="hello@send.acme.com"
    Example: operation="set_catch_all", domain_id=123, client_id=42

set_masking:
    *** MUTATING (Kenso super-admin / staff only) *** Toggle mailbox-provider
    URL-cloaked masking for one domain. PATCH /api/v1/domains/{domain_id}/masking.
    Requires domain_id and enabled (bool). When ON, the mailbox provider keeps the
    burner domain in the URL bar and proxies the brand site instead of a 301.
    Enabling requires a forwarding URL (workspace website or domain
    forwarding URL). Response data includes maskingEnabled and forwardingUrl.
    Domain reads already expose maskingEnabled for verification.
    Example: operation="set_masking", domain_id=123, enabled=True, client_id=42
    Example: operation="set_masking", domain_id=123, enabled=False, client_id=42

enable_all_masking:
    *** MUTATING (Kenso super-admin / staff only) *** Enable mailbox-provider masking
    on domains connected to the mailbox provider. POST /api/v1/domains/masking/enable-all.
    Optional client_id pins one workspace. Omitting client_id writes every
    tenant and requires confirm_enable_all_masking=True. Optional after_id
    pages past already-processed rows (pass data.nextAfterId). Each request
    writes at most 50 domains. Envelope success is not "all masked": read
    data.attempted, enabled, skippedNoUrl, skippedAlreadyEnabled, failed,
    truncated, writeLimit, nextAfterId, fleetLimit, and failures[]. Rerun
    with after_id=data.nextAfterId until truncated is false.
    Example: operation="enable_all_masking", client_id=42
    Example: operation="enable_all_masking", confirm_enable_all_masking=True
    Example: operation="enable_all_masking", confirm_enable_all_masking=True,
        after_id=1200

move_workspace:
    *** MUTATING (Kenso super-admin / staff only) *** Move Kenso-native domains
    between workspaces. POST /api/v1/domains/move-workspace. Requires
    source_client_id, target_client_id, and domain_ids (or domain_id).
    dry_run=True reports impact without writing. SuperAdmin only; clients
    are blocked. Do not UPDATE inboxes.client_id by hand.
    Example: operation="move_workspace", source_client_id=1002, target_client_id=42, domain_ids=[10,11], dry_run=True

Promoting a Ken Master pre-warmup domain to Google is not an operation
here. Use admin_mail(operation="promote-pre-warmup", workspace_id=1002).

Parameters:
-----------
client : KenAPIClient
    API client instance
operation : str
    The operation to perform
domain_id : int, optional
    Domain ID (required for provision_tracking_redirect, set_catch_all,
    set_masking; alias for a
    single-id move_workspace)
client_id : int, optional
    Client/tenant ID (forwarded as clientId query scope when provided)
source_client_id : int, optional
    Source workspace for move_workspace.
target_client_id : int, optional
    Target workspace for move_workspace.
domain_ids : list[int], optional
    Domain IDs for move_workspace. Falls back to domain_id when omitted.
dry_run : bool, default=False
    When True, move_workspace reports impact without writing. The other
    operations have no preview and refuse dry_run=True.
enabled : bool, optional
    Masking on/off for set_masking.
    False is a valid value (do not omit the field to disable).
catch_all_email : str, optional
    Catch-all address for set_catch_all. Omit to apply the provider admin
    email default.
confirm_provision_tracking_redirect : bool, default=False
    Required explicit confirmation for provision_tracking_redirect. This
    mutation spends edge custom-hostname quota and writes DNS records
    into the domain's zone.
confirm_enable_all_masking : bool, default=False
    Required when enable_all_masking omits client_id (cross-tenant fleet
    write to the mailbox provider). Not required when client_id pins one workspace.
after_id : int, optional
    Enable-all cursor. Pass data.nextAfterId from the previous page.
forwarding_url : str, optional
    Required for checkout. Destination URL for the purchased domains.
domains : list[dict], optional
    Required for checkout. Cart lines (see checkout op).
order_id : int, optional
    Required for orders_get.
active_only : bool, default=True
    For orders_list.

Returns:
--------
dict
    API response. checkout data includes url, sessionId, and orderId.
    capacity data includes remaining daily sends.

Examples:
---------
Capacity then checkout:
    >>> await domain_manage(operation="capacity", client_id=42)
    >>> await domain_manage(
    ...     operation="checkout",
    ...     client_id=42,
    ...     forwarding_url="https://acme.com",
    ...     domains=[...],
    ... )