Get Collection Assets

How to retrieve a collection's NFTs from the Wayup Marketplace

Retrieve assets from a specific NFT collection with rich filtering and pagination capabilities.

Endpoint (API): GET marketplace/api/get-collection-assets

Introduction

This guide shows how to fetch listed NFTs of a collection on the Wayup Marketplace. You can use it to build collection pages, price dashboards, or rarity-based explorers.

Requirements

  • A collection policyId

API Request Structure

Configuration

// API endpoint for Wayup Marketplace
const BASE_URL = "https://prod.api.ada-anvil.app/marketplace/api";

// Collection policy ID to query assets for
const POLICY_ID = "6fb0ce0d80bce539333b0b16f4a29a0d40c786249f86850d3a36fa01";

Type Definitions

interface CollectionAssetsRequest {
  policyId: string;
  limit?: number;
  cursor?: string;
  saleType?: 'all' | 'listedOnly' | 'bundles';
  orderBy?: 'priceAsc' | 'priceDesc' | 'newest' | 'oldest';
}

// AssetResult type omitted for brevity (see Response Schema below)

interface CollectionAssetsResponse {
  results: AssetResult[];
  pageState: string | null;
}

Query Parameters

Parameter
Type
Required
Description

policyId

string

Yes

Collection policy ID

limit

number

No

Max items per page. Default 10.

cursor

string

No

Pagination cursor from a previous response. Use it only when requesting additional pages; omit it for the first page or if you only need one page.

minPrice

string

No

Minimum listing price (lovelace).

maxPrice

string

No

Maximum listing price (lovelace).

minRarity

string

No

Minimum rarity rank.

maxRarity

string

No

Maximum rarity rank.

orderBy

string

No

One of: priceAsc, priceDesc, nameAsc, idxAsc, recentlyListed, rarityAsc, recentlyMinted. Default priceAsc.

term

string

No

Full-text search term (name / attributes).

listingType

string

No

Filter by marketplace source: jpgstore, wayup, spacebudz.

saleType

string

No

all, listedOnly, bundles. Use listedOnly to return only actively listed assets.

properties

Array<{ key: string; value: string }>

No

Attribute filters (exact match).

Response Schema

{
  "pageState": "string | null",   // pass as `cursor` to fetch the next page
  "count": 20,
  "results": [
    /* AssetResult */
  ]
}

AssetResult structure:

interface AssetResult {
  unit: string;            // policyId.assetName (hex)
  policyId: string;
  assetName: string;       // hex
  name: string;            // readable
  image?: string;
  media?: { src: string; blur?: string };
  quantity: number;
  attributes?: Record<string, string>;
  rarity?: number | null;
  listing?: Listing | null;   // present if listed
  collection?: Collection;    // parent collection meta
}

interface Listing {
  txHashIndex: string;
  price: number;             // lovelace
  priceCurrency: string | null;
  bundleSize: number | null;
  isProcessing: boolean;
  type: 'jpgstore' | 'wayup' | 'spacebudz';
  version: 'v2' | 'v3';
  scriptHash: string;
}

interface Collection {
  policyId: string;
  name: string;
  handle?: string;
  verified: boolean;
  image?: string;
  banner?: string | null;
  description?: string | null;
  royaltyAddress?: string;
  royaltyPct?: number;
  socials?: Record<string, string>;
}

Implementation

Step 1: Build the Request URL

// Optional parameters
const PAGE_LIMIT = 5; // Number of results to return
const PAGE_CURSOR = null; // Pagination cursor (leave as null for first page)

const requestUrl = `${BASE_URL}/get-collection-assets?policyId=${POLICY_ID}&saleType=listedOnly&orderBy=priceAsc&limit=${PAGE_LIMIT}`;
// If you need the next page:
// const requestUrl = `${BASE_URL}/get-collection-assets?policyId=${POLICY_ID}&saleType=listedOnly&orderBy=priceAsc&limit=${PAGE_LIMIT}&cursor=${PAGE_CURSOR}`;

Step 2: Execute the Request

console.log("Querying assets for policy ID:", POLICY_ID);
const response = await fetch(requestUrl);

Step 3: Process the Response

const result = await response.json();
const { results, pageState } = result;

Step 4: Display the Results

console.log(`Found ${results.length} assets:`);
results.forEach((asset, idx) => {
  console.log(`\nAsset #${idx + 1}:`);
  console.log(`  Policy ID: ${asset.policyId}`);
  console.log(`  Asset Name: ${asset.assetName}`);
  if (asset.listing) {
    console.log(`  Listed Price: ${Number(asset.listing.price) / 1_000_000} ADA`);
    console.log(`  Listing ID: ${asset.listing.txHashIndex}`);
  }
});

Step 5: Handle Pagination

if (pageState) {
  console.log(`\nMore results available. Use this cursor for the next page: ${pageState}`);
}

Running the Example

deno run --allow-net get-collection-assets.ts

Example Output

Querying assets for policy ID: 6fb0ce0d80bce539333b0b16f4a29a0d40c786249f86850d3a36fa01
Found 5 assets:

Asset #1:
  Policy ID: 6fb0ce0d80bce539333b0b16f4a29a0d40c786249f86850d3a36fa01
  Asset Name: 4646506f776572436f7265733437
  Listed Price: 5 ADA
  Listing ID: 4baa167631a62343cc4f37f9313ee05d6149b1fda39fd563e12832c8dd49fac9#0

Asset #2:
  Policy ID: 6fb0ce0d80bce539333b0b16f4a29a0d40c786249f86850d3a36fa01
  Asset Name: 4646506f776572436f726573373338
  Listed Price: 5 ADA
  Listing ID: b808df86c4bb38072dac95bddb65121c30f2e1cf6190514ddac63eadfe1f7c97#0

Asset #3:
  Policy ID: 6fb0ce0d80bce539333b0b16f4a29a0d40c786249f86850d3a36fa01
  Asset Name: 4646506f776572436f72657331333239
  Listed Price: 10 ADA
  Listing ID: f4a54134caf96b0cdc0f6843e781a6ab4b8d60a3c85adbcabdfd005a2bf7af39#0

Asset #4:
  Policy ID: 6fb0ce0d80bce539333b0b16f4a29a0d40c786249f86850d3a36fa01
  Asset Name: 4646506f776572436f726573393533
  Listed Price: 10 ADA
  Listing ID: c2f6a8ab662fe06596dfa630b0a6d289acde68af9a8b49fb725a367c4f7140c4#0

Asset #5:
  Policy ID: 6fb0ce0d80bce539333b0b16f4a29a0d40c786249f86850d3a36fa01
  Asset Name: 4646506f776572436f72657331363835
  Listed Price: 11 ADA
  Listing ID: cb1d799ec0d9f611594a596c930b1710a7311462246a1b4ed605b333cdbe5b41#0

The Complete File

get-collection-assets.ts
// API endpoint for Wayup Marketplace
const BASE_URL = "https://prod.api.ada-anvil.app/marketplace/api";

// NFT Collection to query
const POLICY_ID = "6fb0ce0d80bce539333b0b16f4a29a0d40c786249f86850d3a36fa01";

// Step 1: Define the query parameters
console.log(`Querying assets for policy ID: ${POLICY_ID}`);

// Step 2: Construct the URL with encoded parameters
const url = `${BASE_URL}/get-collection-assets?policyId=${POLICY_ID}&saleType=listedOnly&orderBy=priceAsc&limit=5`;

// Step 3: Fetch the assets
const response = await fetch(url);
const result = await response.json();

// Step 4: Process and display results
const assets = result.results || [];
console.log(`Found ${assets.length} assets:`);

// Step 5: Display asset details
assets.forEach((asset, index) => {
  console.log(`\nAsset #${index + 1}:`);
  console.log(`  Policy ID: ${asset.policyId}`);
  console.log(`  Asset Name: ${asset.assetName}`);
  
  if (asset.listing) {

    // 1 ADA = 1_000_000 lovelace
    console.log(`  Listed Price: ${asset.listing.price / 1_000_000} ADA`);
    console.log(`  Listing ID: ${asset.listing.txHashIndex}`);
  } else {
    console.log(`  Not listed for sale`);
  }
  
  // If metadata is available
  if (asset.metadata) {
    console.log(`  Name: ${asset.metadata.name || "N/A"}`);
    
    if (asset.metadata.traits) {
      console.log(`  Traits:`);
      Object.entries(asset.metadata.traits).forEach(([key, value]) => {
        console.log(`    ${key}: ${value}`);
      });
    }
  }
});

// Run this with: deno run --allow-net get-collection-assets.ts

Last updated

Was this helpful?