> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spaceport.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Class: Asset

[resources/assets](../modules/resources_assets).AssetClient

The AssetClient is used to manage digital assets within the Spaceport ecosystem.
Assets are the core digital items, such as 3D models, audio files, or other creative works,
that can be licensed and monetized. This client handles creating and managing the metadata
and files associated with these assets.

## Table of contents

#### Methods

* [create](#create)
* [batchCreate](#batchcreate)

### constructor

• **new AssetClient**(`client`): [`AssetClient`](./asset)

#### Parameters

| Name     | Type                               |
| :------- | :--------------------------------- |
| `client` | [`SpaceportSDK`](../spaceport-sdk) |

#### Returns

[`AssetClient`](./asset)

## Methods

### create

▸ **create**(`params`): `Promise`\<[`CreateAssetResponse`](../types/create-asset-response)>

Creates an asset record.
This method creates the asset metadata and returns the full asset data
that can be used for listings and other operations.

#### Parameters

| Name     | Type                                                | Description                               |
| :------- | :-------------------------------------------------- | :---------------------------------------- |
| `params` | [`CreateAssetParams`](../types/create-asset-params) | Parameters for creating the asset record. |

#### Returns

`Promise`\<[`CreateAssetResponse`](../types/create-asset-response)>

Object containing success status, the created asset ID, and full asset data.

**`Example`**

```typescript theme={null}
// Create asset record with file uploads
const mediaFile = new File([...], 'artwork.jpg', { type: 'image/jpeg' });
const thumbnailFile = new File([...], 'thumbnail.jpg', { type: 'image/jpeg' });

const result = await sdk.assets.create({
  name: 'Digital Artwork #1',
  title: 'Digital Artwork #1',
  userId: 'user-uuid',
  storageAccess: 'public',
  description: 'A beautiful digital artwork',
  tags: ['art', 'digital', 'nft'],
  mediaFile: mediaFile,
  thumbnailFile: thumbnailFile
});

if (result.success) {
  console.log('Asset created with ID:', result.assetId);
  console.log('Full asset data:', result.asset);
}
```

### batchCreate

▸ **batchCreate**(`params`): `Promise`\<[`BatchCreateAssetsResponse`](../types/batch-create-assets-response)>

Creates multiple asset records.
This method creates multiple asset metadata records and returns the full asset data
for each successfully created asset.

Supports both JSON-only requests and file uploads.

#### Parameters

| Name     | Type                                                             | Description                                  |
| :------- | :--------------------------------------------------------------- | :------------------------------------------- |
| `params` | [`BatchCreateAssetsParams`](../types/batch-create-assets-params) | Parameters for batch creating asset records. |

#### Returns

`Promise`\<[`BatchCreateAssetsResponse`](../types/batch-create-assets-response)>

Object containing success status, created assets data, and any errors.

**`Example`**

```typescript theme={null}
// JSON-only batch creation (no files)
const result = await sdk.assets.batchCreate({
  assets: [
    {
      name: 'Digital Artwork #1',
      title: 'Digital Artwork #1',
      userId: 'user-uuid',
      description: 'First artwork',
      tags: ['art', 'digital']
    },
    {
      name: 'Digital Artwork #2',
      title: 'Digital Artwork #2',
      userId: 'user-uuid',
      description: 'Second artwork',
      tags: ['art', 'digital']
    }
  ]
});

// Batch creation with files
const mediaFile1 = new File([...], 'artwork1.jpg', { type: 'image/jpeg' });
const mediaFile2 = new File([...], 'artwork2.jpg', { type: 'image/jpeg' });

const resultWithFiles = await sdk.assets.batchCreate({
  assets: [
    {
      name: 'Digital Artwork #1',
      title: 'Digital Artwork #1',
      userId: 'user-uuid',
      description: 'First artwork',
      mediaFile: mediaFile1
    },
    {
      name: 'Digital Artwork #2',
      title: 'Digital Artwork #2',
      userId: 'user-uuid',
      description: 'Second artwork',
      mediaFile: mediaFile2
    }
  ]
});

if (result.success) {
  console.log(`Created ${result.assets.length} assets`);
  result.assets.forEach(asset => {
    console.log('Asset:', asset.assetId, asset.asset.name);
  });
}
```
