# scheduling.schedules_update

Editar agenda. Só o que for enviado muda (mesmos campos de `scheduling.schedules_create`); texto vazio ou `null` limpa. Trocar o dono (`attendantId`/`memberId` ou `teamId`) limpa o outro lado e o roster; a agenda pessoal mantém o dono. Tornar pública sem slug gera um do nome. Slug repetido dá `invalid_input`.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `id` | string | sim |  |
| `name` | string | não |  |
| `description` | string \| null | não |  |
| `duration` | integer | não |  |
| `color` | string \| null | não |  |
| `isPublic` | boolean | não |  |
| `slug` | string | não |  |
| `pipelineId` | string (uuid) \| null | não |  |
| `stageId` | string (uuid) \| null | não |  |
| `bufferMinutes` | integer | não |  |
| `minNoticeMinutes` | integer | não |  |
| `maxBookingsPerDay` | integer \| null | não |  |
| `maxBookingsPerMemberPerDay` | integer \| null | não |  |
| `maxAdvanceDays` | integer \| null | não |  |
| `rollingWindowEnabled` | boolean | não |  |
| `rollingWindowThresholdPercent` | integer | não |  |
| `rollingWindowStepDays` | integer | não |  |
| `confirmationMessage` | string \| null | não |  |
| `bookingFields` | object[] \| null | não |  |
| `confirmationButtons` | object[] \| null | não |  |
| `redirectUrl` | string \| null | não |  |
| `pixelId` | string \| null | não |  |
| `redirectDelaySeconds` | integer \| null | não |  |
| `emailLayoutTemplateId` | string \| null | não |  |
| `otpVerificationEnabled` | boolean | não |  |
| `otpChannel` | "email" \| "whatsapp" | não |  |
| `otpEmailSenderSignatureId` | string \| null | não |  |
| `otpWhatsappTemplateId` | string \| null | não |  |
| `meetingLocationMode` | "clickmax_meet" \| "google_meet" \| "attendant_room" \| "fixed_link" | não |  |
| `meetingLocationUrl` | string \| null | não |  |
| `meetPlaybookId` | string \| null | não |  |
| `meetCopilotAgentId` | string \| null | não |  |
| `groupCapacity` | integer | não |  |
| `groupShowSeatsLeft` | boolean | não |  |
| `sessionRules` | object[] | não |  |
| `schedulingType` | "individual" \| "group" \| "round_robin" | não |  |
| `attendantId` | string (uuid) \| null | não |  |
| `memberId` | string (uuid) \| null | não |  |
| `teamId` | string (uuid) \| null | não |  |
| `memberCalendars` | object[] | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^(pessoal:)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 1000
        },
        {
          "type": "null"
        }
      ]
    },
    "duration": {
      "type": "integer",
      "minimum": 5,
      "maximum": 480
    },
    "color": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "isPublic": {
      "type": "boolean"
    },
    "slug": {
      "type": "string",
      "maxLength": 48
    },
    "pipelineId": {
      "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"
        }
      ]
    },
    "stageId": {
      "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"
        }
      ]
    },
    "bufferMinutes": {
      "type": "integer",
      "minimum": 0,
      "maximum": 1440
    },
    "minNoticeMinutes": {
      "type": "integer",
      "minimum": 0,
      "maximum": 525600
    },
    "maxBookingsPerDay": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 1,
          "maximum": 100000
        },
        {
          "type": "null"
        }
      ]
    },
    "maxBookingsPerMemberPerDay": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 1,
          "maximum": 100000
        },
        {
          "type": "null"
        }
      ]
    },
    "maxAdvanceDays": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 1,
          "maximum": 365
        },
        {
          "type": "null"
        }
      ]
    },
    "rollingWindowEnabled": {
      "type": "boolean"
    },
    "rollingWindowThresholdPercent": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "rollingWindowStepDays": {
      "type": "integer",
      "minimum": 1,
      "maximum": 30
    },
    "confirmationMessage": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 5000
        },
        {
          "type": "null"
        }
      ]
    },
    "bookingFields": {
      "anyOf": [
        {
          "maxItems": 40,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "field": {
                "type": "string",
                "enum": [
                  "name",
                  "email",
                  "secondaryEmail",
                  "telephone",
                  "whatsappNumber",
                  "instagram",
                  "linkedin",
                  "twitterX",
                  "tiktok",
                  "youtube",
                  "observations",
                  "city",
                  "state",
                  "document",
                  "birthday",
                  "custom"
                ]
              },
              "required": {
                "type": "boolean"
              },
              "customFieldId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              }
            },
            "required": [
              "field",
              "required"
            ]
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "confirmationButtons": {
      "anyOf": [
        {
          "maxItems": 10,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "label": {
                "type": "string",
                "maxLength": 100
              },
              "type": {
                "type": "string",
                "enum": [
                  "link",
                  "whatsapp",
                  "email",
                  "download"
                ]
              },
              "value": {
                "type": "string",
                "maxLength": 2000
              },
              "variant": {
                "default": "primary",
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              }
            },
            "required": [
              "id",
              "label",
              "type",
              "value"
            ]
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "redirectUrl": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2000
        },
        {
          "type": "null"
        }
      ]
    },
    "pixelId": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 100
        },
        {
          "type": "null"
        }
      ]
    },
    "redirectDelaySeconds": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 60
        },
        {
          "type": "null"
        }
      ]
    },
    "emailLayoutTemplateId": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 100
        },
        {
          "type": "null"
        }
      ]
    },
    "otpVerificationEnabled": {
      "type": "boolean"
    },
    "otpChannel": {
      "type": "string",
      "enum": [
        "email",
        "whatsapp"
      ]
    },
    "otpEmailSenderSignatureId": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 100
        },
        {
          "type": "null"
        }
      ]
    },
    "otpWhatsappTemplateId": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 100
        },
        {
          "type": "null"
        }
      ]
    },
    "meetingLocationMode": {
      "type": "string",
      "enum": [
        "clickmax_meet",
        "google_meet",
        "attendant_room",
        "fixed_link"
      ]
    },
    "meetingLocationUrl": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 2000
        },
        {
          "type": "null"
        }
      ]
    },
    "meetPlaybookId": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 100
        },
        {
          "type": "null"
        }
      ]
    },
    "meetCopilotAgentId": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 100
        },
        {
          "type": "null"
        }
      ]
    },
    "groupCapacity": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "groupShowSeatsLeft": {
      "type": "boolean"
    },
    "sessionRules": {
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "dayOfWeek": {
            "type": "integer",
            "minimum": 0,
            "maximum": 6
          },
          "startTime": {
            "type": "string",
            "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
          }
        },
        "required": [
          "dayOfWeek",
          "startTime"
        ]
      }
    },
    "schedulingType": {
      "type": "string",
      "enum": [
        "individual",
        "group",
        "round_robin"
      ]
    },
    "attendantId": {
      "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"
        }
      ]
    },
    "memberId": {
      "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"
        }
      ]
    },
    "teamId": {
      "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"
        }
      ]
    },
    "memberCalendars": {
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "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)$"
          },
          "externalCalendarIds": {
            "default": [],
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          }
        },
        "required": [
          "attendantId"
        ]
      }
    }
  },
  "required": [
    "id"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/scheduling.schedules_update \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"00000000-0000-0000-0000-000000000000","duration":45,"bufferMinutes":10}'
```

CLI:

```bash
node cli/atomiks.mjs scheduling.schedules_update --json '{"id":"00000000-0000-0000-0000-000000000000","duration":45,"bufferMinutes":10}'
```

MCP: ferramenta `scheduling_schedules_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": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "slug": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "duration": {
      "type": "number"
    },
    "color": {
      "type": [
        "string",
        "null"
      ]
    },
    "isPublic": {
      "type": "boolean"
    },
    "isPersonal": {
      "type": "boolean"
    },
    "schedulingType": {
      "type": "string",
      "enum": [
        "individual",
        "group",
        "round_robin"
      ]
    },
    "attendantId": {
      "type": [
        "string",
        "null"
      ]
    },
    "memberId": {
      "type": [
        "string",
        "null"
      ]
    },
    "attendantName": {
      "type": [
        "string",
        "null"
      ]
    },
    "teamId": {
      "type": [
        "string",
        "null"
      ]
    },
    "teamName": {
      "type": [
        "string",
        "null"
      ]
    },
    "teamColor": {
      "type": [
        "string",
        "null"
      ]
    },
    "pipelineId": {
      "type": [
        "string",
        "null"
      ]
    },
    "stageId": {
      "type": [
        "string",
        "null"
      ]
    },
    "bufferMinutes": {
      "type": "number"
    },
    "minNoticeMinutes": {
      "type": "number"
    },
    "maxBookingsPerDay": {
      "type": [
        "number",
        "null"
      ]
    },
    "maxBookingsPerMemberPerDay": {
      "type": [
        "number",
        "null"
      ]
    },
    "maxAdvanceDays": {
      "type": [
        "number",
        "null"
      ]
    },
    "rollingWindowEnabled": {
      "type": "boolean"
    },
    "rollingWindowThresholdPercent": {
      "type": "number"
    },
    "rollingWindowStepDays": {
      "type": "number"
    },
    "confirmationMessage": {
      "type": [
        "string",
        "null"
      ]
    },
    "bookingFields": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "customFieldId": {
            "type": "string"
          }
        },
        "required": [
          "field",
          "required"
        ],
        "additionalProperties": false
      }
    },
    "confirmationButtons": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "value": {
                "type": "string"
              },
              "variant": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "label",
              "type",
              "value",
              "variant"
            ],
            "additionalProperties": false
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "redirectUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "pixelId": {
      "type": [
        "string",
        "null"
      ]
    },
    "redirectDelaySeconds": {
      "type": [
        "number",
        "null"
      ]
    },
    "emailLayoutTemplateId": {
      "type": [
        "string",
        "null"
      ]
    },
    "otpVerificationEnabled": {
      "type": "boolean"
    },
    "otpChannel": {
      "type": "string",
      "enum": [
        "email",
        "whatsapp"
      ]
    },
    "otpEmailSenderSignatureId": {
      "type": [
        "string",
        "null"
      ]
    },
    "otpWhatsappTemplateId": {
      "type": [
        "string",
        "null"
      ]
    },
    "meetingLocationMode": {
      "type": "string",
      "enum": [
        "clickmax_meet",
        "google_meet",
        "attendant_room",
        "fixed_link"
      ]
    },
    "meetingLocationUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "meetPlaybookId": {
      "type": [
        "string",
        "null"
      ]
    },
    "meetCopilotAgentId": {
      "type": [
        "string",
        "null"
      ]
    },
    "memberCalendars": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "attendantId": {
            "type": "string"
          },
          "externalCalendarIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "attendantId",
          "externalCalendarIds"
        ],
        "additionalProperties": false
      }
    },
    "groupCapacity": {
      "type": "number"
    },
    "groupShowSeatsLeft": {
      "type": "boolean"
    },
    "sessionRules": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "dayOfWeek": {
            "type": "integer",
            "minimum": 0,
            "maximum": 6
          },
          "startTime": {
            "type": "string",
            "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
          }
        },
        "required": [
          "dayOfWeek",
          "startTime"
        ],
        "additionalProperties": false
      }
    },
    "publicPath": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string"
    },
    "updatedAt": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "name",
    "slug",
    "description",
    "duration",
    "color",
    "isPublic",
    "isPersonal",
    "schedulingType",
    "attendantId",
    "memberId",
    "attendantName",
    "teamId",
    "teamName",
    "teamColor",
    "pipelineId",
    "stageId",
    "bufferMinutes",
    "minNoticeMinutes",
    "maxBookingsPerDay",
    "maxBookingsPerMemberPerDay",
    "maxAdvanceDays",
    "rollingWindowEnabled",
    "rollingWindowThresholdPercent",
    "rollingWindowStepDays",
    "confirmationMessage",
    "bookingFields",
    "confirmationButtons",
    "redirectUrl",
    "pixelId",
    "redirectDelaySeconds",
    "emailLayoutTemplateId",
    "otpVerificationEnabled",
    "otpChannel",
    "otpEmailSenderSignatureId",
    "otpWhatsappTemplateId",
    "meetingLocationMode",
    "meetingLocationUrl",
    "meetPlaybookId",
    "meetCopilotAgentId",
    "memberCalendars",
    "groupCapacity",
    "groupShowSeatsLeft",
    "sessionRules",
    "publicPath",
    "createdAt",
    "updatedAt"
  ],
  "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).
