# Export contacts as CSV

`POST /crm/export` · Rivier · contacts

Export contacts as CSV.

- Scope: contacts:admin
- Sdk: contacts.export.run
- Cli: contacts export run

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "rules": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "all": {
              "type": "array",
              "items": {},
              "minItems": 1,
              "maxItems": 50
            }
          },
          "required": [
            "all"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "any": {
              "type": "array",
              "items": {},
              "minItems": 1,
              "maxItems": 50
            }
          },
          "required": [
            "any"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "not": {}
          },
          "required": [
            "not"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "f": {
              "type": "string",
              "pattern": "^(email|name|phone|source|lifecycle|country|language|owner|company|tag|created_at|updated_at|last_activity_at|orders_count|orders_total|open_deals|segment|custom\\.[a-z][a-z0-9_]{0,39}|consent\\.(email|sms|whatsapp|phone)(\\.[a-z][a-z0-9_]{0,29})?|suppressed\\.(email|sms|whatsapp|phone))$"
            },
            "op": {
              "type": "string",
              "enum": [
                "eq",
                "ne",
                "contains",
                "starts",
                "in",
                "nin",
                "gt",
                "gte",
                "lt",
                "lte",
                "exists",
                "within_days",
                "older_than_days"
              ]
            },
            "v": {}
          },
          "required": [
            "f",
            "op"
          ],
          "additionalProperties": false
        }
      ]
    },
    "segmentId": {
      "type": "string",
      "format": "uuid"
    },
    "tag": {
      "type": "string",
      "maxLength": 40
    },
    "max": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100000
    }
  },
  "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/export' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "rules": {
    "all": []
  },
  "segmentId": "string",
  "tag": "string",
  "max": 0
}'
```
