# pipelines.attendant_routing_set

Definir o peso de um atendente no rodízio do pipeline. Peso (0 a 10, padrão 5) que o atendente tem no rodízio de distribuição deste pipeline. O atendente precisa estar no pipeline (`pipelines.attendants_set`).

- Endpoint: `POST https://app.atomiks.com.br/api/v1/pipelines.attendant_routing_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_routing_set`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `pipelines.attendant_routing_set`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `pipelineId` | string (uuid) | sim |  |
| `attendantId` | string (uuid) | sim |  |
| `weight` | integer | 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)$"
    },
    "attendantId": {
      "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)$"
    },
    "weight": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10
    }
  },
  "required": [
    "pipelineId",
    "attendantId",
    "weight"
  ]
}
```

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs pipelines.attendant_routing_set --json '{"pipelineId":"00000000-0000-0000-0000-000000000000","attendantId":"00000000-0000-0000-0000-000000000000","weight":5}'
```

MCP: ferramenta `pipelines_attendant_routing_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": {
    "pipelineId": {
      "type": "string"
    },
    "attendantId": {
      "type": "string"
    },
    "weight": {
      "type": "number"
    }
  },
  "required": [
    "pipelineId",
    "attendantId",
    "weight"
  ],
  "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).
