# pipelines.settings_update

Alterar as configurações de um pipeline. Altera só o que for enviado (campos de `pipelines.settings_get`; nome e grupo ficam em `crm.pipeline_update`). `description` vazio limpa; `slaTargetStageId` precisa ser etapa do pipeline; `lostReasons` troca a lista inteira; `cardDisplay` troca o objeto inteiro (chaves `show…` e `hideWhenEmpty`). Exige a migration de configurações (`migration_pendente` sem ela).

- Endpoint: `POST https://app.atomiks.com.br/api/v1/pipelines.settings_update` (corpo JSON)
- Quem pode chamar: administrador da conta
- Escopo da chave: `crm:write`
- Grava dados: sim
- Pela chave de API: sim
- Ferramenta MCP: `pipelines_settings_update`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `pipelines.settings_update`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `pipelineId` | string (uuid) | sim |  |
| `description` | string \| null | não |  |
| `autoAssign` | boolean | não |  |
| `autoAssignStrategy` | "manual" \| "round_robin" | não |  |
| `slaEnabled` | boolean | não |  |
| `slaInactivityDays` | integer | não |  |
| `slaTargetStageId` | string (uuid) \| null | não |  |
| `slaFirstContactEnabled` | boolean | não |  |
| `slaFirstContactMinutes` | integer | não |  |
| `assignResponsibleOnScheduling` | boolean | não |  |
| `restrictSchedulingToPeers` | boolean | não |  |
| `lostReasons` | string[] | não |  |
| `restrictLossReasons` | boolean | não |  |
| `defaultPriority` | "urgent" \| "high" \| "medium" \| "low" \| "none" | não |  |
| `defaultCurrency` | "BRL" \| "USD" \| "EUR" | não |  |
| `cardDisplay` | object | não |  |
| `pixelEnabled` | boolean | não |  |
| `pixelEvent` | string \| null | não |  |
| `cardOrder` | "manual" \| "createdAtDesc" \| "createdAtAsc" \| "stageTimeAsc" \| "stageTimeDesc" | não |  |

<details><summary>JSON Schema</summary>

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "pipelineId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2000
        },
        {
          "type": "null"
        }
      ]
    },
    "autoAssign": {
      "type": "boolean"
    },
    "autoAssignStrategy": {
      "type": "string",
      "enum": [
        "manual",
        "round_robin"
      ]
    },
    "slaEnabled": {
      "type": "boolean"
    },
    "slaInactivityDays": {
      "type": "integer",
      "minimum": 1,
      "maximum": 365
    },
    "slaTargetStageId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "slaFirstContactEnabled": {
      "type": "boolean"
    },
    "slaFirstContactMinutes": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1440
    },
    "assignResponsibleOnScheduling": {
      "type": "boolean"
    },
    "restrictSchedulingToPeers": {
      "type": "boolean"
    },
    "lostReasons": {
      "maxItems": 50,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 120
      }
    },
    "restrictLossReasons": {
      "type": "boolean"
    },
    "defaultPriority": {
      "type": "string",
      "enum": [
        "urgent",
        "high",
        "medium",
        "low",
        "none"
      ]
    },
    "defaultCurrency": {
      "type": "string",
      "enum": [
        "BRL",
        "USD",
        "EUR"
      ]
    },
    "cardDisplay": {
      "type": "object",
      "properties": {
        "showCompanyName": {
          "type": "boolean"
        },
        "showAssignedAttendant": {
          "type": "boolean"
        },
        "showContactCard": {
          "type": "boolean"
        },
        "showProductName": {
          "type": "boolean"
        },
        "showTotalValue": {
          "type": "boolean"
        },
        "showFunnelName": {
          "type": "boolean"
        },
        "showDate": {
          "type": "boolean"
        },
        "showPaymentStatus": {
          "type": "boolean"
        },
        "showScheduledMeeting": {
          "type": "boolean"
        },
        "showNextAction": {
          "type": "boolean"
        },
        "showLeadIndicators": {
          "type": "boolean"
        },
        "showCustomObjects": {
          "type": "boolean"
        },
        "showSubscription": {
          "type": "boolean"
        },
        "hideWhenEmpty": {
          "type": "boolean"
        }
      },
      "additionalProperties": false
    },
    "pixelEnabled": {
      "type": "boolean"
    },
    "pixelEvent": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 60
        },
        {
          "type": "null"
        }
      ]
    },
    "cardOrder": {
      "type": "string",
      "enum": [
        "manual",
        "createdAtDesc",
        "createdAtAsc",
        "stageTimeAsc",
        "stageTimeDesc"
      ]
    }
  },
  "required": [
    "pipelineId"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/pipelines.settings_update \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pipelineId":"00000000-0000-0000-0000-000000000000","autoAssign":true}'
```

CLI:

```bash
node cli/atomiks.mjs pipelines.settings_update --json '{"pipelineId":"00000000-0000-0000-0000-000000000000","autoAssign":true}'
```

MCP: ferramenta `pipelines_settings_update` com a mesma entrada.

## Saída

Sucesso: `{"data": ...}` com o formato abaixo.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "pipelineId": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "groupName": {
      "type": [
        "string",
        "null"
      ]
    },
    "isDefault": {
      "type": "boolean"
    },
    "archivedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "autoAssign": {
      "type": "boolean"
    },
    "autoAssignStrategy": {
      "type": "string",
      "enum": [
        "manual",
        "round_robin"
      ]
    },
    "teamId": {
      "type": [
        "string",
        "null"
      ]
    },
    "teamDistributionMode": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "weighted",
            "strict"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "slaEnabled": {
      "type": "boolean"
    },
    "slaInactivityDays": {
      "type": "number"
    },
    "slaTargetStageId": {
      "type": [
        "string",
        "null"
      ]
    },
    "slaFirstContactEnabled": {
      "type": "boolean"
    },
    "slaFirstContactMinutes": {
      "type": "number"
    },
    "assignResponsibleOnScheduling": {
      "type": "boolean"
    },
    "restrictSchedulingToPeers": {
      "type": "boolean"
    },
    "lostReasons": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "restrictLossReasons": {
      "type": "boolean"
    },
    "defaultPriority": {
      "type": "string",
      "enum": [
        "urgent",
        "high",
        "medium",
        "low",
        "none"
      ]
    },
    "defaultCurrency": {
      "type": "string",
      "enum": [
        "BRL",
        "USD",
        "EUR"
      ]
    },
    "cardDisplay": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "boolean"
      }
    },
    "pixelEnabled": {
      "type": "boolean"
    },
    "pixelEvent": {
      "type": [
        "string",
        "null"
      ]
    },
    "cardOrder": {
      "type": "string",
      "enum": [
        "manual",
        "createdAtDesc",
        "createdAtAsc",
        "stageTimeAsc",
        "stageTimeDesc"
      ]
    }
  },
  "required": [
    "pipelineId",
    "name",
    "groupName",
    "isDefault",
    "archivedAt",
    "description",
    "autoAssign",
    "autoAssignStrategy",
    "teamId",
    "teamDistributionMode",
    "slaEnabled",
    "slaInactivityDays",
    "slaTargetStageId",
    "slaFirstContactEnabled",
    "slaFirstContactMinutes",
    "assignResponsibleOnScheduling",
    "restrictSchedulingToPeers",
    "lostReasons",
    "restrictLossReasons",
    "defaultPriority",
    "defaultCurrency",
    "cardDisplay",
    "pixelEnabled",
    "pixelEvent",
    "cardOrder"
  ],
  "additionalProperties": false
}
```

## Erros

`{"error": {"code", "message", "requestId"}}`. Códigos: `invalid_input` (400), `unauthorized` (401), `forbidden` / `account_pending` / `scope_missing` (403), `not_found` (404), `limit_reached` (409), `internal` (500).
