# Create allow/block rule

## Create Allow/Block Rule

> Allow/Block rules are an abuse prevention mechanism that allows you to define an allow-list and a block-list indicating whether a conversation can be start for a given contact.<br>

```json
{"openapi":"3.0.3","info":{"title":"Conversations","version":"v1"},"tags":[{"name":"email_allowblock_rules","description":"Manage Allow/Block rules for your inbox"}],"servers":[{"url":"https://api.bird.com","description":"Production API"}],"security":[{"accessKey":[]}],"components":{"securitySchemes":{"accessKey":{"description":"Uses the Authorization header: 'AccessKey ' followed by your access key token","scheme":"AccessKey","type":"http"}},"schemas":{"conversations.allowblock.rule.create":{"additionalProperties":false,"properties":{"category":{"$ref":"#/components/schemas/conversations.allowblock.rule.category"},"type":{"$ref":"#/components/schemas/conversations.allowblock.rule.type"},"value":{"type":"string"}},"required":["category","value","type"],"type":"object"},"conversations.allowblock.rule.category":{"description":"The category of the AllowBlockRule.","enum":["all","domain","domain_suffix","email"],"type":"string"},"conversations.allowblock.rule.type":{"description":"The type of the AllowBlockRule.","enum":["allow","reject","suspend"],"type":"string"},"conversations.allowblock.rule":{"description":"An AllowBlockRule is a rule that allows or blocks a specific value in a specific category.","properties":{"category":{"$ref":"#/components/schemas/conversations.allowblock.rule.category"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"format":"uuid","type":"string"},"id":{"format":"uuid","type":"string"},"type":{"$ref":"#/components/schemas/conversations.allowblock.rule.type"},"updatedAt":{"format":"date-time","type":"string"},"updatedBy":{"format":"uuid","type":"string"},"value":{"type":"string"},"workspaceId":{"format":"uuid","type":"string"}},"required":["id","workspaceId","category","value","type","createdBy","createdAt","updatedBy","updatedAt"],"type":"object"},"error.detailed":{"additionalProperties":false,"description":"An error returned from the API that includes additional details about the error. The `details` property can contain any additional information about the error that may be helpful for debugging or understanding the error.\n","properties":{"code":{"description":"A unique code that identifies the error. This code can be used to programmatically identify the error.","minLength":3,"type":"string"},"details":{"additionalProperties":true,"description":"Any additional information about the error that may be helpful for debugging or understanding the error.","type":"object"},"message":{"description":"A human-readable message that describes the error.","minLength":1,"type":"string"}},"required":["code","message"],"title":"DetailedError","type":"object"},"error.validation":{"additionalProperties":false,"description":"A validation error returned from the API. The `details` map keys are JSON paths\npointing into the request body / parameters; values are arrays of human-readable\nmessages describing each problem with that path.\n","properties":{"code":{"description":"A unique code that identifies the error. This code can be used to programmatically identify the error.","minLength":3,"type":"string"},"details":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"description":"Per-field validation messages keyed by JSON path.","type":"object"},"message":{"description":"A human-readable message that describes the error.","minLength":1,"type":"string"}},"required":["code","message"],"title":"ValidationError","type":"object"}},"responses":{"conversations.response.allowblock.rule":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conversations.allowblock.rule"}}},"description":"The Allow/Block rule."},"duplicate":{"$ref":"#/components/responses/error.response.conflict"},"error.response.conflict":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.detailed"}}},"description":"The request conflicts with the current state of the resource."},"validationFailed":{"$ref":"#/components/responses/error.response.invalid_request"},"error.response.invalid_request":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.validation"}}},"description":"The request contains invalid parameters or body fields."}}},"paths":{"/workspaces/{workspaceId}/conversation-allowblock-rules":{"post":{"summary":"Create Allow/Block Rule","operationId":"createAllowBlockRule","description":"Allow/Block rules are an abuse prevention mechanism that allows you to define an allow-list and a block-list indicating whether a conversation can be start for a given contact.\n","tags":["email_allowblock_rules"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/conversations.allowblock.rule.create"}}}},"responses":{"201":{"$ref":"#/components/responses/conversations.response.allowblock.rule"},"409":{"$ref":"#/components/responses/duplicate"},"422":{"$ref":"#/components/responses/validationFailed"}}}}}}
```

## Examples

{% tabs %}
{% tab title="Request" %}

```bash
curl -X POST "https://api.bird.com/workspaces/a1405560-c8d3-4b1a-877d-3f449ad95352/conversation-allowblock-rules" \
-H "Content-Type: application/json" \
-H "Authorization: AccessKey abcd" \
-d '{
  "category": "domain",
  "value": "test.com",
  "type": "reject"
}'
```

{% endtab %}

{% tab title="Response (201 - Created)" %}

```json
{
  "id": "01937888-e7c4-79dd-af1f-c00d91a0f3a6",
  "workspaceId": "6b1908bd-2bc7-409e-bab4-ccfcd3ec69b9",
  "category": "domain",
  "value": "test.com",
  "type": "reject",
  "createdBy": "00000000-0000-0000-0000-000000000000",
  "createdAt": "2024-11-29T15:27:38.436082756Z",
  "updatedBy": "00000000-0000-0000-0000-000000000000",
  "updatedAt": "2024-11-29T15:27:38.436082756Z"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bird.com/api/conversations-api/api-reference/workspace-settings/create-allow-block-rule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
