ExternalServiceRegistration defines an org's registered API specification and its External Services configuration. It brings together the schema, provider identity, credential references, operation activation, and request and response serialization settings used to consume the service in Salesforce.
The registration is not the remote service or the credential itself. Its readiness status describes registration of the API specification, not live connectivity or successful authentication. Its internal systemVersion is also separate from both the Metadata API version and the version of an externally cataloged API.
Key Elements
| Element | What the Element Controls |
|---|---|
label |
Required. The service name displayed in the External Services wizard. |
status |
Required. complete means the API specification is valid and the registration is ready to use. incomplete means registration has not completed. |
operations |
Contains ExternalServiceOperation entries. Each entry requires a name and an active flag: true for active or false for inactive. |
namedCredential |
Identifies the NamedCredential by name. |
namedCredentialReferenceId |
Identifies the named credential by ID. When used, it supersedes namedCredential. Do not treat the ID as a credential developer name. |
registrationProviderType |
Identifies the source of the registered specification. Values distinguish manually configured specifications, HTTP Callout configuration, Apex classes, external connectors, catalog sources, and other providers. Some values are reserved for internal use. |
registrationProvider |
Contains the connector name for ExternalConnector or a HerokuAppLink ID for Heroku. For other provider types, it is documented as blank and reserved for future use. |
registrationProviderAsset |
Identifies a related asset whose kind depends on the provider. It contains a named query API name for a named-query registration or an Apex class name for an Apex-derived registration. |
schema |
Contains an OpenAPI 2.0.x or OpenAPI 3.0.x specification in JSON or YAML. |
schemaType |
The documented value is OpenAPI. If omitted, the format is derived from the schema content. |
schemaUrl |
A schema-location path relative to the named credential endpoint. It must begin with /; it is not an absolute URL. |
schemaAbsoluteUrl |
The full schema URL, populated when Absolute URL is selected during registration. |
serviceBinding |
A JSON-encoded string that maps unsupported media types to supported body-serialization types through compatibleMediaTypes. |
systemVersion |
The read-only internal External Services version used to register the specification. The current value is 9. An existing registration cannot be upgraded in place. |
catalogedApiVersion |
The version of an externally sourced API brought into API Catalog and managed for Salesforce consumption. It does not identify the External Services runtime version. |
Behavior and Constraints
Registration readiness and operation activation are separate. A registration with status set to complete can still contain inactive operations. Check each operation's active flag independently. A complete registration does not establish that the endpoint is reachable or that authentication succeeds.
Credential selection has precedence. The documented namedCredentialReferenceId selects a credential by ID and overrides namedCredential when used. The differently named namedCredentialReference element exposed by some metadata tooling has a naming ambiguity described below; do not automatically apply the documented ID behavior to it.
The schema location is not an operation path. For example, /accounts/schema can identify the schema relative to the named credential endpoint. Paths inside the OpenAPI specification identify the service operations instead. When registration uses a local upload, schemaUploadFileName records the file name without its extension, and schemaUploadFileExtension records the extension.
Media-type mapping separates header handling from body serialization. Serialization converts request and response data to and from the format used for transmission. For example, this serviceBinding value maps a custom media type to JSON serialization:
{"compatibleMediaTypes":{"application/x-acme-json":"application/json"}}
The runtime continues to use application/x-acme-json for request and response header processing, but serializes the bodies as application/json. The mapping does not simply replace the advertised media type.
The current internal runtime version affects the generated contract. A registration using systemVersion 9 supports:
- OpenAPI enums, discriminator mapping, and property names beginning with a number.
- Automatically derived developer names that fit within 80 characters.
- Asynchronous callouts with callbacks from Apex.
- Encoding the invocable-action input keyword
connectionasreconnection. - Callouts without an automatically added default character set. If the service requires a character set, specify it in the OpenAPI specification, for example
contentType: application/xml; charset=utf-8.
These behaviors matter when comparing the OpenAPI contract with generated developer names, invocable-action inputs, and callout content handling.
Provider type describes the specification's origin, not just a server location. The provider values distinguish these sources:
-
SchemaInferred: a specification supplied during HTTP Callout configuration. -
ApexRestandAuraEnabled: specifications created from an Apex REST class or an Apex class with Aura-enabled methods, respectively. -
NamedQuery: a named query REST endpoint. -
AgentToAgent: external service schemas for communication between AI agents. -
ContextDef: a specification used to create dynamic Apex classes for a related context definition structure. -
Anypoint: a specification managed in the MuleSoft Anypoint Platform. UseAnypoint, rather thanMuleSoft, for MuleSoft for Agentforce: API Catalog MuleSoft sources. -
Custom: a manually configured specification.Standardidentifies a specification defined when an external service was created. -
ExternalConnector,CustomExternalConnector, andHeroku: an external connection, a custom partner-created external connection, or a Heroku app, respectively.
AgentActionOutputs, AnypointPublic, CodeExtension, and DocumentProcessing are reserved for internal use, not ordinary provider choices.
Interpret registrationProvider together with registrationProviderType. An ExternalConnector registration stores the external connector name there; a Heroku registration stores a HerokuAppLink ID, not an app developer name. For other provider types, the field is documented as blank and reserved for future use.
registrationProviderAsset is polymorphic, meaning that it can identify different kinds of assets. It contains the named query API name for a named-query registration. For a registration created from an Apex REST class or an Apex class with Aura-enabled methods, it contains the Apex class name. It is therefore only conditionally an ApexClass reference.
Deployment and Retrieval
ExternalServiceRegistration components use the suffix .externalServiceRegistration and are stored in the externalServiceRegistrations folder. Operation entries are contained within the registration as ExternalServiceOperation structures, rather than separate deployable operation components.
Changing a version number does not upgrade an existing registration. systemVersion is read-only and independent of the Metadata API version and catalogedApiVersion. To obtain functionality from a newer internal system version:
- Create another external service using the same OpenAPI specification.
- Replace consumer references that point to the old external service with references to the new registration.
This is replacement of the registration and its consumer references, not an editable version-number change.
When preparing the replacement, distinguish outgoing credential and provider-asset references from incoming consumer references. Bots and cataloged APIs can point to the registration. The possible dependency paths do not identify every consumer in an org, and they do not make every related type a required member of a deployment.
Relationships
The registration connects a specification to its named credential and, conditionally, an Apex class. Bot configurations and cataloged APIs can consume the registration. This permits paths such as CatalogedApi to ExternalServiceRegistration to NamedCredential, or a bot configuration to a registration associated with an ApexClass.
References
-
NamedCredential:namedCredential,namedCredentialReference; Salesforce also documents the ID-based elementnamedCredentialReferenceId. The naming distinction and its effect on interpretation are described below. -
ApexClass:registrationProviderAsset, only when the registration was created from an Apex REST class or an Apex class with Aura-enabled methods.
Referenced By
-
Bot:invocationActionName. -
BotVersion:invocationActionName. -
BotBlock:invocationActionName. -
BotTemplate:invocationActionName. -
CatalogedApi:serviceRegistration.
Documentation Inconsistencies
-
Credential reference naming differs. Salesforce's field documentation uses
namedCredentialReferenceIdand specifies an ID reference that supersedesnamedCredential. Some metadata tooling exposesnamedCredentialReferenceand recognizes it as aNamedCredentialreference. The documented ID serialization and precedence must not automatically be assigned to that differently named element. -
The example uses different casing from the field definitions. The field definitions specify
schemaTypeasOpenAPIandstatusascompleteorincomplete. The example instead usesOpenApiandComplete. The example does not establish those alternate spellings as accepted values.
Reported Issues
-
Direct Apex queries may not be an available way to inspect registrations. A 2021 community answer listed
ExternalServiceRegistrationamong Tooling API objects that were unavailable in the ApexSchemanamespace and could not be queried directly in Apex. Treat this as a dated report about Apex query access, not a restriction on Metadata API retrieval. See the discussion of Tooling API objects queryable in Apex.
Common Questions
Can I upgrade an ExternalServiceRegistration by changing systemVersion?
No. systemVersion is read-only, and an existing registration cannot be upgraded in place. Create another external service using the same OpenAPI specification, then replace references to the old registration.
Does status complete mean every operation is active and authentication works?
No. complete means the specification is valid and registration is ready to use. Each operation has its own active flag, and registration status is not a live connectivity or authentication test.
Can schemaUrl contain an absolute URL?
No. schemaUrl must begin with / and be relative to the named credential endpoint. schemaAbsoluteUrl records the full schema URL when Absolute URL is selected during registration.
Which named credential reference takes precedence?
The documented namedCredentialReferenceId supersedes namedCredential when used. It contains an ID, not a developer name. Do not assume that the differently named namedCredentialReference element has the same ID serialization or precedence.
How do I use a custom JSON media type with External Services?
Use the compatibleMediaTypes mapping inside the JSON-encoded serviceBinding string to map the custom media type to application/json. The runtime uses the custom media type for header processing and the mapped JSON type for body serialization.