Create Invite Code
POST/api/admin/portal/invite-codes
Create a portal invite code. Returns 201 with the code.
customers:writeGrant 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 randomXXXX-XXXXcode (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_accountorexisting_customer.customer_id(integer): required whentargetisexisting_customer; a non-archived customer.joiner_role(optional):buyer(default),approverorviewer. Used only forexisting_customercodes.product_pricing_tier_id,payment_term_id,default_sales_rep_id,store_id(integer, optional, nullable): what anew_accountcode provisions;store_idmust 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.comor@acme.com. Stored lowercase without@.approval_mode(optional):instant(default) orreview.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) orexisting_customer(each sign-up becomes an extra login oncustomer, withjoiner_role).customer(id,name,archived): the customer people join, for anexisting_customercode; null otherwise.customer_unavailableis 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 anexisting_customercode:buyer,approverorviewer(never company admin). Null fornew_accountcodes.pricing_tier,payment_term,credit_limit,catalogs,sales_rep,store: what anew_accountcode provisions. A null or empty value falls back to the tenant's approval default (see Get Approval Defaults). Always empty forexisting_customercodes, 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) orreview(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 orderarchived>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
- 201
- 401
- 403
- 422
- 429
Created
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.