---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [scapi](../index.md) / fetchScapiSchemaWithFallback

# Function: fetchScapiSchemaWithFallback()

> **fetchScapiSchemaWithFallback**(`identity`, `fetchLive`, `signal?`): `Promise`\<[`ScapiSchemaFetchResult`](../interfaces/ScapiSchemaFetchResult.md)\>

Defined in: [packages/b2c-tooling-sdk/src/scapi/schema-source.ts:171](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/bceb8da43dd8bc63d57932bbd905d36a1b40c949/packages/b2c-tooling-sdk/src/scapi/schema-source.ts#L171)

Fetch one contract live, falling back to the bundled corpus when the live fetch fails (missing
configuration or credentials, no access, network or server errors).

The bundled contract always carries the full prose and examples, regardless of the requested expansion.
Custom APIs exist only on the tenant, so their failure is rethrown. Abort errors are never swallowed.

## Parameters

### identity

[`ScapiSchemaIdentity`](../interfaces/ScapiSchemaIdentity.md)

API family, name and version

### fetchLive

() => `Promise`\<[`ApiDocument`](../type-aliases/ApiDocument.md)\>

Fetches the contract, building the client lazily so configuration errors fall back too

### signal?

`AbortSignal`

Abort signal; an aborted request throws instead of falling back

## Returns

`Promise`\<[`ScapiSchemaFetchResult`](../interfaces/ScapiSchemaFetchResult.md)\>
