# Block

Source: https://docs.gocardless.com/docs/api-reference/block

## Create a block

`POST /blocks`

Creates a new Block of a given type. By default it will be active.

### Request body

Wrap request body attributes in a `blocks` object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `block_type` | string | No | Type of entity we will seek to match against when blocking the mandate. This can currently be one of 'email', 'email_domain', 'bank_account', or 'bank_name'. |
| `reason_type` | string | No | The reason you wish to block this payer, can currently be one of 'identity_fraud', 'no_intent_to_pay', 'unfair_chargeback'. If the reason isn't captured by one of the above then 'other' can be selected but you must provide a reason description. |
| `reason_description` | string | No | This field is required if the reason_type is other. It should be a description of the reason for why you wish to block this payer and why it does not align with the given reason_types. This is intended to help us improve our knowledge of types of fraud. |
| `resource_reference` | string | No | This field is a reference to the value you wish to block. This may be the raw value (in the case of emails or email domains) or the ID of the resource (in the case of bank accounts and bank names). This means in order to block a specific bank account (even if you wish to block generically by name) it must already have been created as a resource. |
| `active` | boolean | No | Shows if the block is active or disabled. Only active blocks will be used when deciding if a mandate should be blocked. |

### Responses

| Status | Description |
| --- | --- |
| 201 | Resource created successfully |
| 400 | Bad Request |
| 401 | Unauthorised |
| 404 | Not found |
| 422 | Validation Error |
| 500 | Internal Error |

---

## List multiple blocks

`GET /blocks`

Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your blocks.

### Responses

| Status | Description |
| --- | --- |
| 200 | Successful response |
| 400 | Bad Request |
| 401 | Unauthorised |
| 404 | Not found |
| 422 | Validation Error |
| 500 | Internal Error |

---

## Get a single block

`GET /blocks/{block_id}`

Retrieves the details of an existing block.

### Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `block_id` | path | string | Yes | The block id |

### Responses

| Status | Description |
| --- | --- |
| 200 | Successful response |
| 400 | Bad Request |
| 401 | Unauthorised |
| 404 | Not found |
| 422 | Validation Error |
| 500 | Internal Error |

---

## Disable a block

`POST /blocks/{block_id}/actions/disable`

Disables a block so that it no longer will prevent mandate creation.

### Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `block_id` | path | string | Yes | The block id |

### Responses

| Status | Description |
| --- | --- |
| 200 | Action completed successfully |
| 400 | Bad Request |
| 401 | Unauthorised |
| 404 | Not found |
| 422 | Validation Error |
| 500 | Internal Error |

---

## Enable a block

`POST /blocks/{block_id}/actions/enable`

Enables a previously disabled block so that it will prevent mandate creation

### Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `block_id` | path | string | Yes | The block id |

### Responses

| Status | Description |
| --- | --- |
| 200 | Action completed successfully |
| 400 | Bad Request |
| 401 | Unauthorised |
| 404 | Not found |
| 422 | Validation Error |
| 500 | Internal Error |

---

## Create blocks by reference

`POST /blocks/block_by_ref`

Creates new blocks for a given reference. By default blocks will be active.
Returns 201 if at least one block was created. Returns 200 if there were no new
blocks created.

### Request body

Wrap request body attributes in a `blocks` object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `reference_type` | string | No | Type of entity we will seek to get the associated emails and bank accounts to create blocks from. This can currently be one of 'customer' or 'mandate'. |
| `reference_value` | string | No | This field is a reference to the entity you wish to block based on its emails and bank accounts. This may be the ID of a customer or a mandate. This means in order to block by reference the entity must have already been created as a resource. |
| `reason_type` | string | No | The reason you wish to block this payer, can currently be one of 'identity_fraud', 'no_intent_to_pay', 'unfair_chargeback'. If the reason isn't captured by one of the above then 'other' can be selected but you must provide a reason description. |
| `reason_description` | string | No | This field is required if the reason_type is other. It should be a description of the reason for why you wish to block this payer and why it does not align with the given reason_types. This is intended to help us improve our knowledge of types of fraud. |
| `active` | boolean | No | Shows if the block is active or disabled. Only active blocks will be used when deciding if a mandate should be blocked. |

### Responses

| Status | Description |
| --- | --- |
| 201 | Resource created successfully |
| 400 | Bad Request |
| 401 | Unauthorised |
| 404 | Not found |
| 422 | Validation Error |
| 500 | Internal Error |
