X Enterprises
fastify-xhubspot

deals.list

Page through all HubSpot deals with optional limit and cursor-based pagination.

deals.list

Retrieve a paginated list of HubSpot deals.

Signature

fastify.deals.list(options?: {
  limit?: number;
  after?: string;
}): Promise<{
  deals: Array<{ id: string; properties: Record<string, string> }>;
  paging?: { next?: { after: string } };
}>

Params

NameTypeRequiredDescription
options.limitnumberNoMax deals per page. Default: 100.
options.afterstringNoCursor from paging.next.after for the next page.

Returns

{ deals, paging }.

Throws

Re-throws HubSpot API errors.

Examples

Basic

const { deals } = await fastify.deals.list({ limit: 50 });

Paginate all deals

async function getAllDeals(fastify) {
  const all = [];
  let after;
  do {
    const result = await fastify.deals.list({ limit: 100, after });
    all.push(...result.deals);
    after = result.paging?.next?.after;
  } while (after);
  return all;
}

See also

AI Context

package: "@xenterprises/fastify-xhubspot"
method: fastify.deals.list(options?)
use-when: Page through all HubSpot deals
returns: { results, paging }
Copyright © 2026