> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # DeleteAutomationEarningRule # Package: loyaltyProgramManagement # Namespace: LoyaltyEarningRules # Method link: https://dev.wix.com/docs/api-reference/crm/loyalty-program/loyalty-program-management/earning-rules/delete-automation-earning-rule.md ## Permission Scopes: Manage Loyalty: SCOPE.DC-LOYALTY.MANAGE-LOYALTY ## Introduction Deletes a custom automated earning rule. Pre-installed automated rules can only be paused, not deleted. To update an earning rule's status instead of deleting it, call Update Loyalty Earning Rule. To delete a non-automated earning rule, call Delete Loyalty Earning Rule. --- ## REST API ### Schema ``` Method: deleteAutomationEarningRule Description: Deletes a custom automated earning rule. Pre-installed automated rules can only be paused, not deleted. To update an earning rule's status instead of deleting it, call Update Loyalty Earning Rule. To delete a non-automated earning rule, call Delete Loyalty Earning Rule. URL: https://www.wixapis.com/v1/automation-earning-rules/{id} Method: DELETE # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: id Method parameters: param name: id | type: none | required: true Return type: DeleteAutomationEarningRuleResponse EMPTY-OBJECT {} ``` ### Examples ### Delete automation earning rule ```curl curl -X DELETE \ 'https://www.wixapis.com/loyalty-earning-rules/v1/automation-earning-rules/61f971c4-b33b-4f39-8ebe-2677bce55789' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.loyaltyProgramManagement.LoyaltyEarningRules.deleteAutomationEarningRule(_id) Description: Deletes a custom automated earning rule. Pre-installed automated rules can only be paused, not deleted. To update an earning rule's status instead of deleting it, call Update Loyalty Earning Rule. To delete a non-automated earning rule, call Delete Loyalty Earning Rule. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: _id Method parameters: param name: _id | type: string | description: GUID of the earning rule to delete. | required: true Return type: PROMISE EMPTY-OBJECT {} ``` ### Examples ### deleteAutomationEarningRule ```javascript import { earningRules } from '@wix/loyalty'; async function deleteAutomationEarningRule(_id) { const response = await earningRules.deleteAutomationEarningRule(_id); }; ``` ### deleteAutomationEarningRule (with elevated permissions) ```javascript import { earningRules } from '@wix/loyalty'; import { auth } from '@wix/essentials'; async function myDeleteAutomationEarningRuleMethod(_id) { const elevatedDeleteAutomationEarningRule = auth.elevate(earningRules.deleteAutomationEarningRule); const response = await elevatedDeleteAutomationEarningRule(_id); } ``` ### deleteAutomationEarningRule (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { earningRules } from '@wix/loyalty'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { earningRules }, // Include the auth strategy and host as relevant }); async function deleteAutomationEarningRule(_id) { const response = await myWixClient.earningRules.deleteAutomationEarningRule(_id); }; ``` ---