Get Promotions
whmcs_get_promotionsGet a list of promotions or coupons from WHMCS, optionally filtered by a specific promotion code.
Instructions
Get list of promotions/coupons
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Specific promotion code |
Implementation Reference
- src/index.ts:1204-1219 (registration)Tool registration for 'whmcs_get_promotions' via server.registerTool(). Defines input schema with optional 'code' parameter and delegates to whmcsClient.getPromotions().
server.registerTool( 'whmcs_get_promotions', { title: 'Get Promotions', description: 'Get list of promotions/coupons', inputSchema: { code: z.string().optional().describe('Specific promotion code'), }, }, async (params) => { const result = await whmcsClient.getPromotions(params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); - src/whmcs-client.ts:1384-1412 (handler)Handler method getPromotions() in the WhmcsApiClient class. Calls the WHMCS API action 'GetPromotions' with an optional 'code' parameter and returns typed response data including promotion details like id, code, type, value, cycles, dates, usage limits, etc.
async getPromotions(params: { code?: string } = {}) { return this.call<WhmcsApiResponse & { totalresults: number; promotions: { promotion: Array<{ id: number; code: string; type: string; recurring: number; value: string; cycles: string; appliesto: string; requires: string; requiresexisting: number; startdate: string; expirationdate: string; maxuses: number; uses: number; lifetimepromo: number; applyonce: number; newsignups: number; existingclient: number; onceperclient: number; recurfor: number; upgrades: number; upgradeconfig: string; notes: string; }> }; }>('GetPromotions', params); }