> ## 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: Listing

[resources/listings](../modules/resources_listings).ListingClient

The ListingClient is used to manage listings on the Spaceport marketplace.
A listing is an offer made by a licensor to license one or more assets under specific terms,
such as price, duration, and royalties. This client handles creating and querying these listings.

## Table of contents

#### Methods

* [getAll](#getall)
* [getById](#getbyid)
* [create](#create)

### constructor

• **new ListingClient**(`client`): [`ListingClient`](./listing)

#### Parameters

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

#### Returns

[`ListingClient`](./listing)

## Methods

### getAll

▸ **getAll**(`params?`): `Promise`\<[`CoreListing`](../types/core-listing)\[]>

Gets all listings with optional filtering parameters.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `params?` | `Object` | Optional filtering parameters. |
| `params.status?` | `string` | - |
| `params.id?` | `string` \| `string`\[] | - |
| `params.listingAddress?` | `string` | - |
| `params.listingId?` | `string` | - |
| `params.organization?` | `string` | - |

#### Returns

`Promise`\<[`CoreListing`](../types/core-listing)\[]>

Array of listings or empty array if none found.

### getById

▸ **getById**(`id`): `Promise`\<[`CoreListing`](../types/core-listing)>

Gets a single listing by ID.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `id` | `string` | The ID of the listing to retrieve. |

#### Returns

`Promise`\<[`CoreListing`](../types/core-listing)>

The listing data or throws error if not found.

### create

▸ **create**(`params`): `Promise`\<\{ `success`: `boolean` ; `message`: `string` ; `jobId`: `string` ; `listingId`: `string`  }>

Creates a listing using the server-side API endpoint.
This method delegates the listing creation to the backend API which handles
the necessary processing and platform interactions via a job queue system.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `params` | [`CreateListingApiParams`](../types/create-listing-api-params) & \{ `assetIds`: `string`\[] ; `userId`: `string` ; `organizationId?`: `string`  } | Parameters for creating the listing. |

#### Returns

`Promise`\<\{ `success`: `boolean` ; `message`: `string` ; `jobId`: `string` ; `listingId`: `string`  }>

Object containing success status, job ID, and listing ID.

**`Example`**

```typescript theme={null}
const result = await sdk.listings.create({
  licensorAddress: '0x...',
  price: 1000n,
  smartLicenseHash: '0x...',
  duration: 31536000n,
  licenseRoyalties: 100000000000000000n,
  resellRoyalties: 50000000000000000n,
  assetIds: ['asset-uuid-1', 'asset-uuid-2'],
  userId: 'user-uuid',
  title: 'My Listing',
  description: 'A great listing',
  category: 'digital-asset'
})
console.log('Created listing with ID:', result.listingId);
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.