Skip to main content

Create Invite Code

POST 

/api/admin/portal/invite-codes

Create a portal invite code. Returns 201 with the code.

Required scope: customers:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Body fields

  • code (string, optional, 4-40 characters): letters, numbers and dashes. It is trimmed and uppercased, and spaces become -. Blank or omitted generates a random XXXX-XXXX code (no 0, O, 1, I or L). Must not match any other code, archived ones included.
  • name (string, required, max 255): internal label.
  • target (required): new_account or existing_customer.
  • customer_id (integer): required when target is existing_customer; a non-archived customer.
  • joiner_role (optional): buyer (default), approver or viewer. Used only for existing_customer codes.
  • product_pricing_tier_id, payment_term_id, default_sales_rep_id, store_id (integer, optional, nullable): what a new_account code provisions; store_id must be a non-archived store.
  • credit_limit (number >= 0, optional, nullable).
  • portal_catalog_ids (array of catalog ids, optional, nullable).
  • allowed_email_domains (array of up to 50 domains, optional): e.g. acme.com or @acme.com. Stored lowercase without @.
  • approval_mode (optional): instant (default) or review.
  • expires_on (Y-m-d, optional, nullable): the code works until the end of this day in the tenant's timezone.
  • max_uses (integer >= 1, optional, nullable): null = unlimited.
  • welcome_message (string, optional, max 280): shown to the buyer when the code is accepted.
  • is_active (boolean, optional, default true).

For an existing_customer code the provisioning fields (product_pricing_tier_id, payment_term_id, credit_limit, portal_catalog_ids, default_sales_rep_id, store_id) are ignored and stored empty. For a new_account code, customer_id and joiner_role are ignored.

Invite code fields

  • code: what buyers type, stored uppercase (letters, numbers and dashes). Unique across archived codes too, so a retired code is never reissued.
  • name: internal label, never shown to buyers.
  • target: new_account (each sign-up becomes a new customer with the code's settings) or existing_customer (each sign-up becomes an extra login on customer, with joiner_role).
  • customer (id, name, archived): the customer people join, for an existing_customer code; null otherwise. customer_unavailable is true when that customer was deleted or archived; the code then refuses every sign-up until another customer is chosen.
  • joiner_role: the role of logins created by an existing_customer code: buyer, approver or viewer (never company admin). Null for new_account codes.
  • pricing_tier, payment_term, credit_limit, catalogs, sales_rep, store: what a new_account code provisions. A null or empty value falls back to the tenant's approval default (see Get Approval Defaults). Always empty for existing_customer codes, which never change the customer's settings.
  • allowed_email_domains: lowercase domains without @; empty = any email.
  • approval_mode: instant (the account is approved at sign-up and the invitation emailed) or review (the application waits for a reviewer, prefilled from the code).
  • expires_at (UTC) / expires_on (the tenant-local date it expires at the end of), max_uses (null = unlimited), uses_count (uses not later rejected), last_used_at.
  • welcome_message: shown to the buyer when the code is accepted.
  • is_active: false = paused by hand.
  • status: derived, in precedence order archived > disabled > expired > used_up > active.
  • signup_url: the buyer-facing sign-up link with the code filled in, on the tenant's portal host and carrying the store brand.

Request​

Responses​

Created

Response Headers
    Content-Type