---
title: "Connecting a PIM product to assets | Customer&#x27;s Canvas Hub"
canonical: "https://customerscanvas.com/docs/hub/dev-center/api/backoffice/connecting-assets/"
---

# Connecting a PIM product to assets

> Learn how to connect designs, mockups, and documents to a PIM product in your tenant programmatically by using the BackOffice API.

After creating a PIM product, you may need to connect it to designs, mockups, and documents. This article explains how to create these connections using the BackOffice API.

## Using the API

Before you start, ensure your app has the necessary credentials to make API calls:
1. In your tenant, go to **Settings** > **External apps** and register your app.
2. Implement authentication in your app as described in the [Authorization](https://customerscanvas.com/docs/hub/dev-center/api/auth.md) article.

## C# API Client

To use the C# API client, initialize it with the required configuration:

```csharp
var httpClient = new HttpClient();
var backOfficeApiConfiguration = new Aurigma.BackOfficeApi.ApiClientConfiguration()
{
    ApiUrl = BACKOFFICE_API_URL,
    AuthorizationToken = AUTH_TOKEN
};
var assetStorageApiConfiguration = new Aurigma.AssetStorage.ApiClientConfiguration()
{
    ApiKey = ASSET_STORAGE_API_URL,
    AuthorizationToken = AUTH_TOKEN
};
var mockupsApiClient = new MockupsApiClient(assetStorageApiConfiguration, httpClient);
var designsApiClient = new DesignsApiClient(assetStorageApiConfiguration, httpClient);
var documentsApiClient = new DocumentsApiClient(assetStorageApiConfiguration, httpClient);
var productsApiClient = new ProductsManagementApiClient(backOfficeApiConfiguration, httpClient);
```

## Connecting a PIM Product to Assets

To connect a PIM product to assets:
1. Load the assets (designs, mockups, documents) from the specified folder.
2. Load the product options.
3. Create connections between the product and the assets.

### Example

```csharp
// Load assets from a specific folder
var mockups = await mockupsApiClient.GetFolderAsync(tenantId: TENANT_ID, fullPath: "/Test Product/");
var designs = await designsApiClient.GetFolderAsync(tenantId: TENANT_ID, fullPath: "/Test Product/");
var documents = await documentsApiClient.GetFolderAsync(tenantId: TENANT_ID, fullPath: "/Test Product/");

// Load product options
var options = await productsApiClient.GetProductOptionsAsync(id: PRODUCT_ID, tenantId: TENANT_ID);

// Create product designs connections
await productsApiClient.CreateDesignsConnectionsAsync(
    id: PRODUCT_ID,
    tenantId: TENANT_ID,
    body: new CreateProductDesignConnectionsDto()
    {
        Connections = designs.Entities
            .Select(design => new ProductDesignConnectionDto()
            {
                DesignId = design.Id,
                Options = options.Items
                    .Select(option => new ProductAssetConnectionOptionsDto()
                    {
                        OptionId = option.Id,
                        OptionValueIds = option.ProductOptionValues.Select(value => value.Id).ToList()
                    })
                    .ToList()
            })
            .ToList()
    });

// Create product mockups connections
await productsApiClient.CreateMockupsConnectionsAsync(
    id: PRODUCT_ID,
    tenantId: TENANT_ID,
    body: new CreateProductMockupConnectionsDto()
    {
        Connections = mockups.Entities
            .Select(mockup => new ProductMockupConnectionDto()
            {
                MockupId = mockup.Id,
                Options = options.Items
                    .Select(option => new ProductAssetConnectionOptionsDto()
                    {
                        OptionId = option.Id,
                        OptionValueIds = option.ProductOptionValues.Select(value => value.Id).ToList()
                    })
                    .ToList()
            })
            .ToList()
    });

// Create product documents connections
await productsApiClient.CreateDocumentsConnectionsAsync(
    id: PRODUCT_ID,
    tenantId: TENANT_ID,
    body: new CreateProductDocumentConnectionsDto()
    {
        Connections = documents.Entities
            .Select(document => new ProductDocumentConnectionDto()
            {
                DocumentId = document.Id,
                Options = options.Items
                    .Select(option => new ProductAssetConnectionOptionsDto()
                    {
                        OptionId = option.Id,
                        OptionValueIds = option.ProductOptionValues.Select(value => value.Id).ToList()
                    })
                    .ToList()
            })
            .ToList()
    });
```

:::note
All assets will be connected to all product variants.
:::
