# Update the Partner Program Settings

`PATCH https://api.suger.cloud/ai/org/{orgId}/prm/config`

Save this organization's partner program settings. Each top-level field of `info` is merged independently: sending one preserves the others. Supported fields: formInfo, fileSetting, partnershipProfile, standardCommissionSettings, customCommissionSettings, dealRegistrationForm (the standard deal registration fields an ISV makes required, optional, hidden, or asks of one role; the list is replaced whole and an unknown or locked field is a 400), moduleSettings, and the tier program: tiers, defaultTierId, fiscalYearStartMonth, journeyTemplates, tierProgram (renewal and Salesforce tier sync; merged key by key, so send only the keys to change) and tierActivityTypes (the marketing points catalog). A list is replaced whole (no row-level merge): call GetPrmConfig first and send every row to keep, changed or not. The server backfills server-managed fields on customCommissionSettings (id, version, since, createTime, updateTime). Saving tiers, journeyTemplates or tierProgram starts the organization's tier run, so they take effect without waiting for the nightly run. Needs partners.edit.

Organization admins only, and never a partner organization (403): `features` (`{"PRM_TRAINING": {"enabled": false}}`, or PRM_COSELL_COMMISSIONS) turns Training or Commissions on or off, and `info.moduleSettings` (`{"journeys": {"hidden": true}}`, one entry per module changed, with `hidden` and/or `displayName`) hides or renames a module: Co-Sell and Applications can be renamed but not hidden, hiding Training or Commissions turns its feature off, and an empty name restores the default. A change to either from anyone else is refused (401) and nothing in the body is saved; sending them back as stored (`info.moduleSettings` as GetPrmConfig answered it, a feature in its current state) is no change, from anyone. A body without `info.moduleSettings` keeps the stored module settings. A `features` switch and a `moduleSettings` hidden switch that disagree are refused (400).

Changing `info.partnershipProfile.auth0LogoUrl` or the profile's `primaryColor` pushes the login branding to this organization's Auth0 Organization after the save, as does `syncAuth0LoginBranding: true` (a re-sync with the stored URL, refused with 400 when no URL is stored or sent). `auth0Sync` in the answer says whether the push worked; a failed push never loses the save. `auth0OrganizationId` is set by the server, never from the body. Answers the settings as GetPrmConfig does.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgId` | path | string | yes | Organization ID |

## Request Body

Required.

Content-Type: `application/json` · Schema: `UpdatePrmConfigRequest`

**`UpdatePrmConfigRequest`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `features` | object | no | PRM_TRAINING or PRM_COSELL_COMMISSIONS, each {enabled}: turns Training or Commissions on or off for this program. Only an organization admin may change one; a switch sent in its current state is no change. |
| `id` | string | no | The config row's ID, used only when the organization has none yet |
| `info` | PartnershipConfigInfo | no |  |
| `syncAuth0LoginBranding` | boolean | no | true to push the stored (or sent) partnershipProfile.auth0LogoUrl to Auth0 again |

**`PartnershipConfigInfo`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `moduleSettings` | object | no | Each module hidden or renamed by this ISV, by module id (journeys, tasks, files, events, broadcasts, training, commissions, cosell, applications); Training's and Commissions' hidden switch is their feature, not kept here. On a save only an organization admin may change it; sent back as read it is no change, and left out it is kept. |
| `allowEmbedDomains` | array<string> | no | AllowEmbedDomains is the org-wide allowlist of origins permitted to embed the public partner sign-up forms in an <iframe>. Each entry is an origin (e.g. "https://partners.acme.com"; a bare host is treated as https). It is surfaced to the unauthenticated public-form endpoint and rendered into the page's Content-Security-Policy `frame-ancestors` directive. Empty means embedding is blocked (frame-ancestors 'none'); the direct/redirect link still works regardless. |
| `autoAcceptReferrals` | AutoAcceptReferralsConfig | no |  |
| `cosellOwnerRules` | CosellOwnerRules | no |  |
| `cosellRegistration` | CosellRegistrationConfig | no |  |
| `crmPartnerDiscovery` | CrmPartnerDiscoveryConfig | no |  |
| `crmPartnerManagerSync` | CrmPartnerManagerSyncConfig | no |  |
| `customCommissionSettings` | array<CustomCommissionPlan> | no | CustomCommissionSettings holds the org's named override plans. Each plan carries its own id, version, since-date, and a per-type settings array listing only the types that plan overrides. Status=Archived plans are retained but excluded from name-uniqueness checks. |
| `dealRegistrationForm` | DealRegistrationFormConfig | no |  |
| `defaultOnboardingJourneyTemplateId` | string | no | DefaultOnboardingJourneyTemplateID is the journey template auto-assigned to a partnership when it first becomes ACTIVE — the onboarding playbook every newly approved partner starts on, with no manual step. It names a template in JourneyTemplates above; that template must be ACTIVE to actually assign. Exactly one per org by construction — a single id, not a per-template flag, so the list cannot represent "zero or many defaults" (same shape as DefaultTierID). Pointer/merge-independent, unlike DefaultTierID which rides with its array: nil means "caller didn't send it" so the merge preserves it, and an empty string explicitly clears it. Unset (nil or empty) means no auto-assignment at all — the manual-only flow that predates, unchanged. |
| `defaultSignupFormId` | string | no | DefaultSignupFormID names the partner-application form in FormInfo above that new partners land on — the destination of "Sign up to be a partner" on the branded login page, and the answer to "where does a partner apply to this company?" for any surface that needs one. Structurally identical to DefaultOnboardingJourneyTemplateID: a single pointer rather than a per-form flag, so the list cannot represent "zero or many defaults", and merge-independent so flipping it does not require resending every form. ONE DELIBERATE DIFFERENCE from that precedent, and it is the whole point of the field: the journey default MAY be empty (it means auto-assignment off), this one MAY NOT. There must always be something on the other end of "Sign up to be a partner". So the server rejects empty, whitespace, and any id absent from FormInfo — and because FormInfo overwrites whole, that same post-merge invariant is what blocks deleting the form that is currently default. A constraint with a back door is a decoration. Seeded orgs start with the "Partner Sign Up" form here; nil only for an org the seeding never reached (no PRM, a PARTNER-type org, or a row written before). |
| `defaultTierId` | string | no | DefaultTierID is the ID of the tier brand-new partners start at (and the effective tier for partners with no explicit assignment). Exactly one default by construction — it is a single id, not a per-tier flag, so the list cannot represent "zero or many defaults". The server normalizes an empty or dangling value to the first tier. |
| `documentSync` | DocumentSyncConfig | no |  |
| `externalLms` | ExternalLmsConfig | no |  |
| `fileSetting` | PartnershipFileSetting | no |  |
| `formInfo` | array<InvitationFormInfo> | no | FormInfo holds the partner signup form configurations. |
| `journeyTemplates` | array<JourneyTemplate> | no | JourneyTemplates holds the org's ISV-defined partner journey playbooks — Settings → Partner Program → Journeys. Stored here (like formInfo / partner tiers) rather than in a dedicated table; managed via UpdatePrmConfig (PATCH /prm/config) and validated by validateAndNormalizePartnerJourneyTemplates. Arrays-overwrite-whole: a non-nil slice (including empty = clear all) overwrites; nil means the caller didn't send it. |
| `partnerViews` | PartnerViews | no |  |
| `partnershipCapabilities` | PartnershipCapabilities | no |  |
| `partnershipProfile` | PartnershipProfile | no |  |
| `relationshipType` | RelationshipType | no |  |
| `slackConfig` | SlackConfig | no |  |
| `standardCommissionSettings` | array<CommissionSetting> | no | StandardCommissionSettings holds the org's default per-commission-type configuration. At most one entry per CommissionType. Used as the fallback when a custom plan does not override a given type. |
| `tiers` | array<PartnerTier> | no | Tiers holds the org's ISV-defined partner tier hierarchy. At most 6 entries; the slice order IS the hierarchy (index 0 = lowest). A partnership references a tier by its ID via PartnershipInfo.PartnerTier. Sending this array overwrites the whole list (see merge contract above). |
| `fiscalYearStartMonth` | integer | no | — 1-12; unset means January. |
| `tierProgram` | TierProgramConfig | no |  |
| `tierActivityTypes` | array<TierActivityType> | no | — the marketing activities partners claim points for. |

**`AutoAcceptReferralsConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `allPartners` | boolean | no | AllPartners, when true, auto-accepts from every partner and PartnerIDs is ignored. |
| `defaultOwner` | AiSugerTeamMember | no | DefaultOwner is the owner/team contact used two ways: it is the fixed owner when OwnerAssignmentRule is SPECIFIC_PERSON (the original meaning), AND the FALLBACK owner when the rule is PARTNER_MANAGER but the partnership has no usable partner manager (unset or deactivated) —. Required to auto-accept (non-empty name + valid email); when neither a partner manager nor this fallback resolves, auto-accept still proceeds with an empty owner flagged "Owner needed" (never blocked). The json key stays `defaultOwner` so existing stored blobs need no migration. |
| `enabled` | boolean | no | Enabled is the master toggle. |
| `ownerAssignmentRule` | string | no | OwnerAssignmentRule selects how a co-sell's deal owner is resolved: OwnerAssignmentRulePartnerManager resolves it per-referral from the sending partnership's partner manager, OwnerAssignmentRuleSpecificPerson uses the fixed DefaultOwner below. EMPTY means SPECIFIC_PERSON — this is the migration default so every pre- config keeps its exact behavior (see ResolveOwnerAssignmentRule). The UI defaults new configs to PARTNER_MANAGER. This rule governs auto-accept, manual-accept prefill, and outbound-share prefill alike. |
| `partnerIds` | array<string> | no | PartnerIDs is the allowlist of THIS org's partnership IDs to auto-accept from — matched against the inbound copy's PartnerID (the reciprocal partnership). Ignored when AllPartners. Arrays overwrite whole. |

**`CosellOwnerRules`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `addCrmOwnerOnLink` | boolean | no | AddCrmOwnerOnLink, when true, appends the linked CRM record's owner as a deal owner contact when a Salesforce Opportunity / HubSpot Deal is linked. |
| `prefillOwnerOnAccept` | boolean | no | PrefillOwnerOnAccept, when true, prefills the deal owner from the owner assignment rule in BOTH the manual-accept modal and the outbound-share wizard (the prefill is editable/removable — display only). |

**`CosellRegistrationConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | no | Enabled is the master toggle for the public link. When false the public form renders a branded closed state — never a 404, so a link a partner already holds reads as "closed, here's a way forward" — and the submit endpoint refuses. |
| `submitterPolicy` | string | no | SubmitterPolicy is CosellRegistrationPolicy{AnyCompany,ConnectedOnly}. Empty means ANY_COMPANY. See ResolveCosellRegistrationSubmitterPolicy. |

**`CrmPartnerDiscoveryConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `emailField` | string | no | EmailField maps to the primary contact email used for the invite. |
| `filterField` | string | no | FilterField is the field whose value marks a record as a partner (e.g. "Type", "Partner_Flag__c"). |
| `filterValue` | string | no | FilterValue is the value of FilterField that identifies a partner (e.g. "Partner", "true", "Channel"). |
| `nameField` | string | no | NameField maps to the partner's company name (e.g. "Name"). |
| `objectType` | string | no | ObjectType is the Salesforce object API name to query — "Account" or a custom object (e.g. "Partner__c"). |

**`CrmPartnerManagerSyncConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `championField` | string | no | ChampionField is the API name of a Lookup(Contact) field on Account whose contact becomes the Partner Champion. Empty leaves the champion to be picked by hand. |
| `enabled` | boolean | no | Enabled turns the scheduled sync (every two hours) on and locks the Partner Manager of every partnership whose Account has an owner. |
| `ownerField` | string | no | OwnerField is the API name of a Lookup(User) field on Account. Empty means "OwnerId", the Account owner. |

**`CustomCommissionPlan`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `createTime` | string | no |  |
| `description` | string | no |  |
| `id` | string | no |  |
| `name` | string | no |  |
| `settings` | array<CommissionSetting> | no |  |
| `since` | string | no |  |
| `status` | CustomCommissionPlanStatus | no |  |
| `updateTime` | string | no |  |
| `version` | integer | no |  |

**`DealRegistrationFormConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `builtInFields` | array<DealRegistrationFieldOverride> | no |  |

**`DocumentSyncConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | no | Enabled turns the daily file sync on for this org. When false the sync activity is a no-op (no CRM calls). |
| `fileTypeFilter` | array<string> | no | FileTypeFilter optionally restricts which file types are synced, by extension (e.g. ["pdf", "docx"]). Empty = all supported types. Applied as a SOQL filter on ContentVersion to avoid downloading unwanted files. |
| `namePattern` | string | no | NamePattern optionally restricts synced files to those whose CRM title matches this pattern (SOQL Title LIKE). Empty = no name filter. |

**`ExternalLmsConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `acsUrl` | string | no |  |
| `allowedTierIds` | array<string> | no | AllowedTierIDs optionally narrows access to partners sitting in specific tiers. EMPTY MEANS EVERY ACTIVE PARTNER, not "nobody" -- the common case is an org that wants all its partners in training, and a filter that had to be populated to work would silently lock everyone out on the day it ships. |
| `apiKeyConfigured` | boolean | no | ApiKeyConfigured reports whether a credential exists in the secret store. It is DERIVED on read and never persisted — the key itself never enters this struct, because this struct is returned wholesale by the config GET and lives in every database backup and export. |
| `completionSyncEnabled` | boolean | no | CompletionSyncEnabled is its own gate, separate from Enabled. Reusing Enabled would mean switching sync off also stops signing partners in when they open a course, which is a much larger blast radius than the operator asked for. |
| `displayName` | string | no | DisplayName is what the UI shows, taking over the branding job Provider used to do. A white-labelled academy reads "Harness University" while Provider stays "skilljar". Empty falls back to the provider's own name. |
| `enabled` | boolean | no | Enabled gates the whole SSO path. Default false: an org that has never configured an external LMS denies every assertion request. It ALSO gates the launch-URL rewrite in OpenExternalCourse, so it is already doing two jobs. Completion sync deliberately does not become a third — see CompletionSyncEnabled. |
| `entityId` | string | no |  |
| `lastCompletionSyncAt` | string | no | LastCompletionSyncAt is the reconciling poll's watermark. |
| `metadataUrl` | string | no |  |
| `provider` | string | no | Provider selects the completion adapter and decides which settings sections may render: one of the ExternalLmsProvider* constants. Empty is read as ExternalLmsProviderOther — SSO works, completion sync is unavailable — so an org configured before the enum existed keeps working untouched. |
| `signInUrl` | string | no | --- Given TO the LMS (issued by Auth0; read-only in the UI) --- |
| `sloUrl` | string | no |  |
| `spEntityId` | string | no | --- Received FROM the LMS (typed in from their SP metadata) --- |
| `trainingDomain` | string | no | TrainingDomain is the LMS domain completions are read from, e.g. "courses.acme.com". Required whenever an API credential is present: Skilljar's API is scoped per training domain, and one org-wide key spans every domain in the account, so THIS FIELD is the isolation boundary — not the credential. It is never defaulted or inferred. |
| `webhookId` | string | no | WebhookID is the id the LMS returned when we registered our receiver, kept so the registration can be found, replaced or deleted later. |

**`PartnershipFileSetting`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `defaultRules` | object | no |  |

## Responses

### 200 — OK

Content-Type: `application/json` · Schema: `PrmConfig`

**`PrmConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `auth0Sync` | PrmAuth0Sync | no |  |
| `createTime` | string | yes | Creation timestamp; null when the organization has saved no settings |
| `id` | string | yes | The config row's ID; null when the organization has saved no settings |
| `info` | PartnershipConfigInfo | yes |  |
| `isvs` | object | yes | For a partner organization, each ISV it has an active partnership with, by ISV organization ID: that ISV's module names and hidden switches. Empty for an ISV. |
| `lastUpdateTime` | string | yes | Last update timestamp; null when the organization has saved no settings |
| `modules` | object | yes | This organization's modules, by module id (a partner organization's are the defaults) |
| `organizationId` | string | yes | The org that owns these settings |

**`PrmAuth0Sync`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | string | no | Why a FAILED push failed |
| `status` | string | yes |  |

**`PartnershipConfigInfo`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `moduleSettings` | object | no | Each module hidden or renamed by this ISV, by module id (journeys, tasks, files, events, broadcasts, training, commissions, cosell, applications); Training's and Commissions' hidden switch is their feature, not kept here. On a save only an organization admin may change it; sent back as read it is no change, and left out it is kept. |
| `allowEmbedDomains` | array<string> | no | AllowEmbedDomains is the org-wide allowlist of origins permitted to embed the public partner sign-up forms in an <iframe>. Each entry is an origin (e.g. "https://partners.acme.com"; a bare host is treated as https). It is surfaced to the unauthenticated public-form endpoint and rendered into the page's Content-Security-Policy `frame-ancestors` directive. Empty means embedding is blocked (frame-ancestors 'none'); the direct/redirect link still works regardless. |
| `autoAcceptReferrals` | AutoAcceptReferralsConfig | no |  |
| `cosellOwnerRules` | CosellOwnerRules | no |  |
| `cosellRegistration` | CosellRegistrationConfig | no |  |
| `crmPartnerDiscovery` | CrmPartnerDiscoveryConfig | no |  |
| `crmPartnerManagerSync` | CrmPartnerManagerSyncConfig | no |  |
| `customCommissionSettings` | array<CustomCommissionPlan> | no | CustomCommissionSettings holds the org's named override plans. Each plan carries its own id, version, since-date, and a per-type settings array listing only the types that plan overrides. Status=Archived plans are retained but excluded from name-uniqueness checks. |
| `dealRegistrationForm` | DealRegistrationFormConfig | no |  |
| `defaultOnboardingJourneyTemplateId` | string | no | DefaultOnboardingJourneyTemplateID is the journey template auto-assigned to a partnership when it first becomes ACTIVE — the onboarding playbook every newly approved partner starts on, with no manual step. It names a template in JourneyTemplates above; that template must be ACTIVE to actually assign. Exactly one per org by construction — a single id, not a per-template flag, so the list cannot represent "zero or many defaults" (same shape as DefaultTierID). Pointer/merge-independent, unlike DefaultTierID which rides with its array: nil means "caller didn't send it" so the merge preserves it, and an empty string explicitly clears it. Unset (nil or empty) means no auto-assignment at all — the manual-only flow that predates, unchanged. |
| `defaultSignupFormId` | string | no | DefaultSignupFormID names the partner-application form in FormInfo above that new partners land on — the destination of "Sign up to be a partner" on the branded login page, and the answer to "where does a partner apply to this company?" for any surface that needs one. Structurally identical to DefaultOnboardingJourneyTemplateID: a single pointer rather than a per-form flag, so the list cannot represent "zero or many defaults", and merge-independent so flipping it does not require resending every form. ONE DELIBERATE DIFFERENCE from that precedent, and it is the whole point of the field: the journey default MAY be empty (it means auto-assignment off), this one MAY NOT. There must always be something on the other end of "Sign up to be a partner". So the server rejects empty, whitespace, and any id absent from FormInfo — and because FormInfo overwrites whole, that same post-merge invariant is what blocks deleting the form that is currently default. A constraint with a back door is a decoration. Seeded orgs start with the "Partner Sign Up" form here; nil only for an org the seeding never reached (no PRM, a PARTNER-type org, or a row written before). |
| `defaultTierId` | string | no | DefaultTierID is the ID of the tier brand-new partners start at (and the effective tier for partners with no explicit assignment). Exactly one default by construction — it is a single id, not a per-tier flag, so the list cannot represent "zero or many defaults". The server normalizes an empty or dangling value to the first tier. |
| `documentSync` | DocumentSyncConfig | no |  |
| `externalLms` | ExternalLmsConfig | no |  |
| `fileSetting` | PartnershipFileSetting | no |  |
| `formInfo` | array<InvitationFormInfo> | no | FormInfo holds the partner signup form configurations. |
| `journeyTemplates` | array<JourneyTemplate> | no | JourneyTemplates holds the org's ISV-defined partner journey playbooks — Settings → Partner Program → Journeys. Stored here (like formInfo / partner tiers) rather than in a dedicated table; managed via UpdatePrmConfig (PATCH /prm/config) and validated by validateAndNormalizePartnerJourneyTemplates. Arrays-overwrite-whole: a non-nil slice (including empty = clear all) overwrites; nil means the caller didn't send it. |
| `partnerViews` | PartnerViews | no |  |
| `partnershipCapabilities` | PartnershipCapabilities | no |  |
| `partnershipProfile` | PartnershipProfile | no |  |
| `relationshipType` | RelationshipType | no |  |
| `slackConfig` | SlackConfig | no |  |
| `standardCommissionSettings` | array<CommissionSetting> | no | StandardCommissionSettings holds the org's default per-commission-type configuration. At most one entry per CommissionType. Used as the fallback when a custom plan does not override a given type. |
| `tiers` | array<PartnerTier> | no | Tiers holds the org's ISV-defined partner tier hierarchy. At most 6 entries; the slice order IS the hierarchy (index 0 = lowest). A partnership references a tier by its ID via PartnershipInfo.PartnerTier. Sending this array overwrites the whole list (see merge contract above). |
| `fiscalYearStartMonth` | integer | no | — 1-12; unset means January. |
| `tierProgram` | TierProgramConfig | no |  |
| `tierActivityTypes` | array<TierActivityType> | no | — the marketing activities partners claim points for. |

**`AutoAcceptReferralsConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `allPartners` | boolean | no | AllPartners, when true, auto-accepts from every partner and PartnerIDs is ignored. |
| `defaultOwner` | AiSugerTeamMember | no | DefaultOwner is the owner/team contact used two ways: it is the fixed owner when OwnerAssignmentRule is SPECIFIC_PERSON (the original meaning), AND the FALLBACK owner when the rule is PARTNER_MANAGER but the partnership has no usable partner manager (unset or deactivated) —. Required to auto-accept (non-empty name + valid email); when neither a partner manager nor this fallback resolves, auto-accept still proceeds with an empty owner flagged "Owner needed" (never blocked). The json key stays `defaultOwner` so existing stored blobs need no migration. |
| `enabled` | boolean | no | Enabled is the master toggle. |
| `ownerAssignmentRule` | string | no | OwnerAssignmentRule selects how a co-sell's deal owner is resolved: OwnerAssignmentRulePartnerManager resolves it per-referral from the sending partnership's partner manager, OwnerAssignmentRuleSpecificPerson uses the fixed DefaultOwner below. EMPTY means SPECIFIC_PERSON — this is the migration default so every pre- config keeps its exact behavior (see ResolveOwnerAssignmentRule). The UI defaults new configs to PARTNER_MANAGER. This rule governs auto-accept, manual-accept prefill, and outbound-share prefill alike. |
| `partnerIds` | array<string> | no | PartnerIDs is the allowlist of THIS org's partnership IDs to auto-accept from — matched against the inbound copy's PartnerID (the reciprocal partnership). Ignored when AllPartners. Arrays overwrite whole. |

**`CosellOwnerRules`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `addCrmOwnerOnLink` | boolean | no | AddCrmOwnerOnLink, when true, appends the linked CRM record's owner as a deal owner contact when a Salesforce Opportunity / HubSpot Deal is linked. |
| `prefillOwnerOnAccept` | boolean | no | PrefillOwnerOnAccept, when true, prefills the deal owner from the owner assignment rule in BOTH the manual-accept modal and the outbound-share wizard (the prefill is editable/removable — display only). |

**`CosellRegistrationConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | no | Enabled is the master toggle for the public link. When false the public form renders a branded closed state — never a 404, so a link a partner already holds reads as "closed, here's a way forward" — and the submit endpoint refuses. |
| `submitterPolicy` | string | no | SubmitterPolicy is CosellRegistrationPolicy{AnyCompany,ConnectedOnly}. Empty means ANY_COMPANY. See ResolveCosellRegistrationSubmitterPolicy. |

**`CrmPartnerDiscoveryConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `emailField` | string | no | EmailField maps to the primary contact email used for the invite. |
| `filterField` | string | no | FilterField is the field whose value marks a record as a partner (e.g. "Type", "Partner_Flag__c"). |
| `filterValue` | string | no | FilterValue is the value of FilterField that identifies a partner (e.g. "Partner", "true", "Channel"). |
| `nameField` | string | no | NameField maps to the partner's company name (e.g. "Name"). |
| `objectType` | string | no | ObjectType is the Salesforce object API name to query — "Account" or a custom object (e.g. "Partner__c"). |

**`CrmPartnerManagerSyncConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `championField` | string | no | ChampionField is the API name of a Lookup(Contact) field on Account whose contact becomes the Partner Champion. Empty leaves the champion to be picked by hand. |
| `enabled` | boolean | no | Enabled turns the scheduled sync (every two hours) on and locks the Partner Manager of every partnership whose Account has an owner. |
| `ownerField` | string | no | OwnerField is the API name of a Lookup(User) field on Account. Empty means "OwnerId", the Account owner. |

**`CustomCommissionPlan`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `createTime` | string | no |  |
| `description` | string | no |  |
| `id` | string | no |  |
| `name` | string | no |  |
| `settings` | array<CommissionSetting> | no |  |
| `since` | string | no |  |
| `status` | CustomCommissionPlanStatus | no |  |
| `updateTime` | string | no |  |
| `version` | integer | no |  |

**`DealRegistrationFormConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `builtInFields` | array<DealRegistrationFieldOverride> | no |  |

**`DocumentSyncConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | no | Enabled turns the daily file sync on for this org. When false the sync activity is a no-op (no CRM calls). |
| `fileTypeFilter` | array<string> | no | FileTypeFilter optionally restricts which file types are synced, by extension (e.g. ["pdf", "docx"]). Empty = all supported types. Applied as a SOQL filter on ContentVersion to avoid downloading unwanted files. |
| `namePattern` | string | no | NamePattern optionally restricts synced files to those whose CRM title matches this pattern (SOQL Title LIKE). Empty = no name filter. |

**`ExternalLmsConfig`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `acsUrl` | string | no |  |
| `allowedTierIds` | array<string> | no | AllowedTierIDs optionally narrows access to partners sitting in specific tiers. EMPTY MEANS EVERY ACTIVE PARTNER, not "nobody" -- the common case is an org that wants all its partners in training, and a filter that had to be populated to work would silently lock everyone out on the day it ships. |
| `apiKeyConfigured` | boolean | no | ApiKeyConfigured reports whether a credential exists in the secret store. It is DERIVED on read and never persisted — the key itself never enters this struct, because this struct is returned wholesale by the config GET and lives in every database backup and export. |
| `completionSyncEnabled` | boolean | no | CompletionSyncEnabled is its own gate, separate from Enabled. Reusing Enabled would mean switching sync off also stops signing partners in when they open a course, which is a much larger blast radius than the operator asked for. |
| `displayName` | string | no | DisplayName is what the UI shows, taking over the branding job Provider used to do. A white-labelled academy reads "Harness University" while Provider stays "skilljar". Empty falls back to the provider's own name. |
| `enabled` | boolean | no | Enabled gates the whole SSO path. Default false: an org that has never configured an external LMS denies every assertion request. It ALSO gates the launch-URL rewrite in OpenExternalCourse, so it is already doing two jobs. Completion sync deliberately does not become a third — see CompletionSyncEnabled. |
| `entityId` | string | no |  |
| `lastCompletionSyncAt` | string | no | LastCompletionSyncAt is the reconciling poll's watermark. |
| `metadataUrl` | string | no |  |
| `provider` | string | no | Provider selects the completion adapter and decides which settings sections may render: one of the ExternalLmsProvider* constants. Empty is read as ExternalLmsProviderOther — SSO works, completion sync is unavailable — so an org configured before the enum existed keeps working untouched. |
| `signInUrl` | string | no | --- Given TO the LMS (issued by Auth0; read-only in the UI) --- |
| `sloUrl` | string | no |  |
| `spEntityId` | string | no | --- Received FROM the LMS (typed in from their SP metadata) --- |
| `trainingDomain` | string | no | TrainingDomain is the LMS domain completions are read from, e.g. "courses.acme.com". Required whenever an API credential is present: Skilljar's API is scoped per training domain, and one org-wide key spans every domain in the account, so THIS FIELD is the isolation boundary — not the credential. It is never defaulted or inferred. |
| `webhookId` | string | no | WebhookID is the id the LMS returned when we registered our receiver, kept so the registration can be found, replaced or deleted later. |

### 400 — An invalid setting, an unknown feature or module, or a re-sync with no logo URL

Content-Type: `application/json` · Schema: `PrmErrorResponse`

**`PrmErrorResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | AiErrorCode | no |  |
| `info` | object | no |  |
| `message` | string | no |  |

### 401 — The caller lacks partners.edit, or sends features or moduleSettings without being an organization admin

Content-Type: `text/plain`

### 403 — A partner organization sets a program owner's setting, a feature or a module

Content-Type: `application/json` · Schema: `PrmErrorResponse`

**`PrmErrorResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | AiErrorCode | no |  |
| `info` | object | no |  |
| `message` | string | no |  |

### 404 — PRM is not enabled for this organization

Content-Type: `application/json` · Schema: `PrmErrorResponse`

**`PrmErrorResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | AiErrorCode | no |  |
| `info` | object | no |  |
| `message` | string | no |  |

### 409 — The portal slug is another organization's

Content-Type: `application/json` · Schema: `PrmErrorResponse`

**`PrmErrorResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | AiErrorCode | no |  |
| `info` | object | no |  |
| `message` | string | no |  |

## Example

_The request bodies are this operation's documented examples; the response and error bodies are generated from its schema. Substitute your own ids, and set `SUGER_TOKEN` to a bearer token from the [OAuth client-credentials exchange](https://doc.fours.com/settings/oauth-app/)._

### Request

```bash
curl -X PATCH 'https://api.suger.cloud/ai/org/{orgId}/prm/config' \
  -H "Authorization: Bearer $SUGER_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "info": {
    "tierProgram": {
      "renewalEnabled": true,
      "renewalDays": 60,
      "demotion": "AT_RESET"
    }
  }
}'
```

### Response — 200

```json
{
  "createTime": "2026-01-31T12:00:00Z",
  "id": "01H0000000000000000000",
  "info": {
    "moduleSettings": {},
    "allowEmbedDomains": [
      "string"
    ],
    "autoAcceptReferrals": {
      "allPartners": true,
      "defaultOwner": {
        "email": "buyer@example.com",
        "name": "Acme Corp",
        "role": "string",
        "title": "string"
      },
      "enabled": true,
      "ownerAssignmentRule": "string",
      "partnerIds": [
        "01H0000000000000000000"
      ]
    },
    "cosellOwnerRules": {
      "addCrmOwnerOnLink": true,
      "prefillOwnerOnAccept": true
    },
    "cosellRegistration": {
      "enabled": true,
      "submitterPolicy": "string"
    },
    "crmPartnerDiscovery": {
      "emailField": "buyer@example.com",
      "filterField": "string",
      "filterValue": "string",
      "nameField": "Acme Corp",
      "objectType": "string"
    },
    "crmPartnerManagerSync": {
      "championField": "string",
      "enabled": true,
      "ownerField": "string"
    },
    "customCommissionSettings": [
      {
        "createTime": "2026-01-31T12:00:00Z",
        "description": "string",
        "id": "01H0000000000000000000",
        "name": "Acme Corp",
        "settings": [
          {}
        ],
        "since": "string",
        "status": "Active",
        "updateTime": "2026-01-31T12:00:00Z",
        "version": 1
      }
    ],
    "dealRegistrationForm": {
      "builtInFields": [
        {
          "hidden": true,
          "path": "customerInfo.website",
          "required": true,
          "roles": []
        }
      ]
    },
    "defaultOnboardingJourneyTemplateId": "01H0000000000000000000",
    "defaultSignupFormId": "01H0000000000000000000",
    "defaultTierId": "01H0000000000000000000"
  },
  "isvs": {},
  "lastUpdateTime": "2026-01-31T12:00:00Z",
  "modules": {},
  "organizationId": "01H0000000000000000000",
  "auth0Sync": {
    "status": "SYNCED",
    "message": "string"
  }
}
```

### Error — 400

```json
{
  "code": "InternalServerError",
  "message": "string"
}
```

---

API reference: https://doc.fours.com/api/
