# pipelines.archive_set

Arquivar ou restaurar um pipeline. `archived: true` esconde o pipeline das listas (o padrão não pode: marque outro antes); `archived: false` o restaura. Os cards permanecem salvos. Devolve as configurações do pipeline.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `pipelineId` | string (uuid) | sim |  |
| `archived` | boolean | 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)$"
    },
    "archived": {
      "type": "boolean"
    }
  },
  "required": [
    "pipelineId",
    "archived"
  ]
}
```

</details>

## Exemplo

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

CLI:

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

MCP: ferramenta `pipelines_archive_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"
    },
    "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).
