> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# BlockMember

# Package: membersV2

# Namespace: MemberToMemberBlocks

# Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/members/members-v2/member-to-member-block-v1/block-member.md

## Permission Scopes:
Manage Members: SCOPE.DC-MEMBERS.MANAGE-MEMBERS

## Introduction

Blocks a member on behalf of the current member.

After the block is created, the 2 members no longer see each other on the site. The blocked member isn't notified about the block and can't remove it.

This method must be called with a site member identity. The member who creates the block is identified from the call's identity.

A member can't block themselves, and a block can't involve the site owner or a site contributor. Each pair of members can have a single block, so a member can't block a member who has already blocked them.

To remove a block, call [Unblock Member](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/members-v2/member-to-member-block-v1/unblock-member.md).

---

## REST API

### Schema

```
 Method: blockMember
 Description: Blocks a member on behalf of the current member.  After the block is created, the 2 members no longer see each other on the site. The blocked member isn't notified about the block and can't remove it.  This method must be called with a site member identity. The member who creates the block is identified from the call's identity.  A member can't block themselves, and a block can't involve the site owner or a site contributor. Each pair of members can have a single block, so a member can't block a member who has already blocked them.  To remove a block, call [Unblock Member](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/members-v2/member-to-member-block-v1/unblock-member.md).
 URL: https://www.wixapis.com/members/v1/member-to-member-blocks/members/my
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  memberId
 Method parameters: 
   param name: memberId | type: memberId | description: GUID of the member to block. | required: true | validation: format GUID
 Return type: BlockMemberResponse
  EMPTY-OBJECT {}

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: ADMIN_BLOCKING_FORBIDDEN | Description: The current member or the specified member is the site owner or a site contributor. Blocks can't involve the site owner or site contributors.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: SELF_BLOCKING_FORBIDDEN | Description: The current member can't block themselves.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: MEMBER_ALREADY_BLOCKED | Description: A block already exists between the current member and the specified member. Either the current member already blocked this member, or this member already blocked the current member.


```

### Examples

### Block a member
Blocks a member on behalf of the current member.

```curl
curl -X POST \
'https://www.wixapis.com/members/v1/member-to-member-blocks/members/my' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "memberId": "e411fe13-9794-42b6-ad62-72c9917f1bac"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.members.memberToMemberBlock.blockMember(memberId)
 Description: Blocks a member on behalf of the current member.  After the block is created, the 2 members no longer see each other on the site. The blocked member isn't notified about the block and can't remove it.  This method must be called with a site member identity. The member who creates the block is identified from the call's identity.  A member can't block themselves, and a block can't involve the site owner or a site contributor. Each pair of members can have a single block, so a member can't block a member who has already blocked them.  To remove a block, call [Unblock Member](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/members-v2/member-to-member-block-v1/unblock-member.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  memberId
 Method parameters: 
   param name: memberId | type: string | description: GUID of the member to block. | required: true | validation: format GUID
 Return type: PROMISE<BlockMemberResponse>
  EMPTY-OBJECT {}

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: ADMIN_BLOCKING_FORBIDDEN | Description: The current member or the specified member is the site owner or a site contributor. Blocks can't involve the site owner or site contributors.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: SELF_BLOCKING_FORBIDDEN | Description: The current member can't block themselves.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: MEMBER_ALREADY_BLOCKED | Description: A block already exists between the current member and the specified member. Either the current member already blocked this member, or this member already blocked the current member.


```

### Examples

### Block a member
Blocks a member on behalf of the current member.

```javascript
import { memberToMemberBlock } from "@wix/members";

async function blockMember() {
  const response = await memberToMemberBlock.blockMember("e411fe13-9794-42b6-ad62-72c9917f1bac");
}

```

### blockMember (self-managed)
Self-managed 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 { memberToMemberBlock } from '@wix/members';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { memberToMemberBlock },
  // Include the auth strategy and host as relevant
});


async function blockMember(memberId) {
  const response = await myWixClient.memberToMemberBlock.blockMember(memberId);
};
```

---