# Change many contacts at once

`POST /crm/bulk` · Rivier · contacts

Change many contacts at once: tag, record consent on the ledger, add to a list, share with the organisation, archive, or move to another project. Starts as a dry run that changes nothing; set dryRun to false to apply. Consent changes need the consent permission; moves are a person's decision.

- Scope: contacts:write
- Graphql: Mutation.contactsBulkRun
- Sdk: contacts.bulk.run
- Cli: contacts bulk run

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "select": {
      "type": "object",
      "properties": {
        "ids": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "minItems": 1,
          "maxItems": 1000
        },
        "segmentId": {
          "type": "string",
          "format": "uuid"
        },
        "tag": {
          "type": "string",
          "minLength": 1,
          "maxLength": 40
        },
        "search": {
          "type": "string",
          "maxLength": 200
        }
      },
      "additionalProperties": false
    },
    "action": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "tag_add"
            },
            "tags": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              "minItems": 1,
              "maxItems": 10
            }
          },
          "required": [
            "type",
            "tags"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "tag_remove"
            },
            "tags": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              "minItems": 1,
              "maxItems": 10
            }
          },
          "required": [
            "type",
            "tags"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "consent"
            },
            "channel": {
              "type": "string",
              "enum": [
                "email",
                "sms",
                "whatsapp",
                "phone"
              ]
            },
            "purpose": {
              "type": "string",
              "enum": [
                "marketing",
                "service",
                "transactional"
              ],
              "default": "marketing"
            },
            "state": {
              "type": "string",
              "enum": [
                "granted",
                "withdrawn",
                "denied",
                "pending"
              ]
            },
            "source": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            },
            "proof": {
              "type": "object",
              "additionalProperties": {}
            }
          },
          "required": [
            "type",
            "channel",
            "state",
            "source"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "list_add"
            },
            "list": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            }
          },
          "required": [
            "type",
            "list"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "list_remove"
            },
            "list": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            }
          },
          "required": [
            "type",
            "list"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "share"
            },
            "shared": {
              "type": "boolean"
            }
          },
          "required": [
            "type",
            "shared"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "archive"
            }
          },
          "required": [
            "type"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "move_to_project"
            },
            "toProject": {
              "type": "string",
              "format": "uuid"
            },
            "consent": {
              "type": "string",
              "enum": [
                "rerequest",
                "carry"
              ],
              "default": "rerequest"
            }
          },
          "required": [
            "type",
            "toProject"
          ],
          "additionalProperties": false
        }
      ]
    },
    "dryRun": {
      "type": "boolean",
      "default": true
    }
  },
  "required": [
    "select",
    "action"
  ],
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X POST 'https://api.rivier.ai/crm/bulk' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "select": {
    "ids": [
      "string"
    ],
    "segmentId": "string",
    "tag": "string",
    "search": "string"
  },
  "action": {
    "type": "tag_add",
    "tags": [
      "string"
    ]
  }
}'
```
