> 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 # Method name: createBadge(badgeInfo: BadgeInfo) # Method package: wixMembersBackend # Method menu location: wixMembersBackend --> Badges --> createBadge # Method Link: https://dev.wix.com/docs/velo/apis/wix-members-backend/badges/create-badge.md # Method Description: Creates a badge. The `createBadge()` function returns a Promise that resolves to the newly created badge. New badges do not have any badge permissions by default. You can [set badge permissions](https://support.wix.com/en/article/site-members-creating-and-managing-member-badges) from the [Badges page](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fbadge-definitions) in the Dashboard. If `backgroundColor` or `textColor` are not specified, they default to `"#796EFF"` (purple) and `"#FFFFFF"` (white) respectively. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Create a badge ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { badges } from 'wix-members-backend'; export const myCreateBadgeFunction = webMethod(Permissions.Anyone, () => { const badgeInfo = { title: "Rising Star", description: "Contributed 5 posts this month", backgroundColor: "#FED8B1", textColor: "#000000", icon: "https://static.wixstatic.com/shapes/132b9a3d51884000acaf705eeeb0e296.svg" }; return badges.createBadge(badgeInfo) .then((badge) => { const badgeTitle = badge.title; const badgeSlug = badge.slug; return badge; }) .catch((error) => { console.error(error); }); }); /* * Promise resolves to: * { * "_id": "571495e9-98af-4ec9-b854-16c0293c9312", * "_createdDate": "2021-05-20T00:02:18.794Z", * "_updatedDate": "2021-05-20T00:02:18.794Z", * "title": "Rising Star", * "slug": "rising-star", * "description": "Contributed 5 posts this month", * "backgroundColor": "#FED8B1", * "textColor": "#000000", * "icon": "https://static.wixstatic.com/shapes/132b9a3d51884000acaf705eeeb0e296.svg", * "roleId": "571495e9-98af-4ec9-b854-16c0293c9312" * } */ ``` ## Create a badge using only a title ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { badges } from 'wix-members-backend'; export const myCreateBadgeFunction = webMethod(Permissions.Anyone, () => { const badgeInfo = { title: "Community Mod" }; return badges.createBadge(badgeInfo) .then((badge) => { const badgeTitle = badge.title; const badgeSlug = badge.slug; return badge; }) .catch((error) => { console.error(error); }); }); /* * Promise resolves to: * { * "_id": "236ee192-004b-4a14-a189-1ca2d08fea5d", * "_createdDate": "2021-05-19T23:54:30.862Z", * "_updatedDate": "2021-05-19T23:54:30.862Z", * "title": "Community Mod", * "slug": "community-mod", * "description": "", * "backgroundColor": "#796EFF", * "textColor": "#FFFFFF", * "icon": "", * "roleId": "236ee192-004b-4a14-a189-1ca2d08fea5d" * } */ ``` ---