Registering a source
Callregister once, at setup, and store the returned registration id:
- Idempotent — calling
register('NightlySync', ...)again returns the same id. It won’t create duplicates. - Don’t register on every invoke. Register once, keep the id, and pass it on each
Request.registrationId. - Model — must be a catalogued gateway model, or blank to use the org default. An unknown model is rejected at register time so you find out immediately, not at call time.
- Re-registering with a new model updates the source’s model; re-registering with a blank model leaves an admin-set model untouched. Registration never changes the source’s admin-managed settings.
Bot_Source__c), keyed on your source string. The registration id is that record’s Id.
Breaking change (v1.63):registrationIdis now required on everyinvoke/invokeAsynccall, and there is no fallback for unregistered callers. If you used the API before this release, add a one-timeregister(...)and pass the id it returns.
Choosing a source name
Pick a stable, descriptive name per logical caller — e.g.NightlySync, CaseClassifier, QuoteDrafter. Usage and spend are tracked per source, so a good name is one an admin will recognise when reviewing spend. Reuse the same name (and id) for all calls from that integration.
Spend limits are set by admins
Each source’s spend can be capped, and a source can be enabled or disabled, by an admin — no code required. That’s an org-management concern, so it lives in the admin console under Usage Limits, not here. Two things to know as a developer:- If a source is disabled or has hit its monthly limit, your call is refused:
invokereturns an error (a402for a limit, a503for a disabled source) andinvokeAsyncthrows. See Errors & Status Codes. - The source name you choose is what the admin sees when setting those limits, so pick it with that in mind.

