# pipelines.attendant_types_set

Definir tipos de atendente e comissão de um pipeline. Troca os tipos do pipeline por `types`, na ordem enviada. Cada um pode ter comissão: `percentage` exige `commissionPercentBp` (0 a 10000, 100 = 1%) e `fixed` exige `commissionFixedCents`; sem `commissionType` fica sem comissão. Devolve o mesmo que `pipelines.attendant_types_get`.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `pipelineId` | string (uuid) | sim |  |
| `types` | object[] | sim |  |

<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)$"
    },
    "types": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "attendantTypeId": {
            "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)$"
          },
          "commissionType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "percentage",
                  "fixed"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "commissionPercentBp": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000
              },
              {
                "type": "null"
              }
            ]
          },
          "commissionFixedCents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "attendantTypeId"
        ]
      }
    }
  },
  "required": [
    "pipelineId",
    "types"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/pipelines.attendant_types_set \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pipelineId":"00000000-0000-0000-0000-000000000000","types":[{"attendantTypeId":"00000000-0000-0000-0000-000000000000","commissionType":"percentage","commissionPercentBp":500}]}'
```

CLI:

```bash
node cli/atomiks.mjs pipelines.attendant_types_set --json '{"pipelineId":"00000000-0000-0000-0000-000000000000","types":[{"attendantTypeId":"00000000-0000-0000-0000-000000000000","commissionType":"percentage","commissionPercentBp":500}]}'
```

MCP: ferramenta `pipelines_attendant_types_set` 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": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "attendantTypeId": {
            "type": "string"
          },
          "attendantTypeName": {
            "type": "string"
          },
          "attendantTypeEmoji": {
            "type": [
              "string",
              "null"
            ]
          },
          "attendantTypeColor": {
            "type": [
              "string",
              "null"
            ]
          },
          "commissionType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "percentage",
                  "fixed"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "commissionPercentBp": {
            "type": [
              "number",
              "null"
            ]
          },
          "commissionFixedCents": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "attendantTypeId",
          "attendantTypeName",
          "attendantTypeEmoji",
          "attendantTypeColor",
          "commissionType",
          "commissionPercentBp",
          "commissionFixedCents"
        ],
        "additionalProperties": false
      }
    },
    "attendants": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "attendantId": {
            "type": "string"
          },
          "weight": {
            "type": "number"
          }
        },
        "required": [
          "attendantId",
          "weight"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "items",
    "attendants"
  ],
  "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).
