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

[@salesforce/b2c-tooling-sdk](../../modules.md) / [clients](../index.md) / OcapiClient

# Type Alias: OcapiClient

> **OcapiClient** = `Client`\<`paths`\>

Defined in: [packages/b2c-tooling-sdk/src/clients/ocapi.ts:57](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/ocapi.ts#L57)

The typed OCAPI client - this is the openapi-fetch Client with full type safety.

**Note:** This client is typically accessed via `B2CInstance.ocapi` rather
than created directly. The `B2CInstance` class handles authentication setup.

## Common Endpoints

| Method | Path | Description |
|--------|------|-------------|
| GET | `/sites` | List all sites |
| GET | `/code_versions` | List code versions |
| PATCH | `/code_versions/{code_version_id}` | Activate a code version |
| GET | `/jobs/{job_id}/executions` | Get job execution history |
| POST | `/jobs/{job_id}/executions` | Start a job execution |

## Example

```typescript
import { resolveConfig } from '@salesforce/b2c-tooling-sdk/config';

const config = resolveConfig();
const instance = config.createB2CInstance();

// List all sites
const { data, error } = await instance.ocapi.GET('/sites', {});
```

## See

 - [createOcapiClient](../functions/createOcapiClient.md) for direct instantiation
 - [OCAPI Data API Reference](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-commerce-ocapi/b2c-api-doc.html)
