# channel_connections.refresh

Atualizar os dados de uma conta conectada. Busca de novo na Meta (ou no Instagram) a qualidade, o limite de envio, o status e a verificação do número, ou o nome, a foto e as contagens da conta do Instagram, ignorando o cache (`POST /channel-instances/{id}/resync`). Devolve o item atualizado.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/channel_connections.refresh` (corpo JSON)
- Quem pode chamar: membro da conta
- Escopo da chave: `channels:read`
- Grava dados: não
- Pela chave de API: sim
- Ferramenta MCP: `channel_connections_refresh`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `channel_connections.refresh`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `channelId` | string (uuid) | sim |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "channelId": {
      "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)$"
    }
  },
  "required": [
    "channelId"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/channel_connections.refresh \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"channelId":"00000000-0000-0000-0000-000000000000"}'
```

CLI:

```bash
node cli/atomiks.mjs channel_connections.refresh --json '{"channelId":"00000000-0000-0000-0000-000000000000"}'
```

MCP: ferramenta `channel_connections_refresh` 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"
    },
    "channel": {
      "type": "string",
      "enum": [
        "whatsapp",
        "whatsapp_unofficial",
        "instagram"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "connecting",
        "live",
        "error"
      ]
    },
    "syncing": {
      "type": "boolean"
    },
    "stableKey": {
      "type": "string"
    },
    "displayName": {
      "type": [
        "string",
        "null"
      ]
    },
    "phone": {
      "type": [
        "string",
        "null"
      ]
    },
    "wabaId": {
      "type": [
        "string",
        "null"
      ]
    },
    "numberStatus": {
      "type": [
        "string",
        "null"
      ]
    },
    "businessVerified": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "qualityRating": {
      "type": [
        "string",
        "null"
      ]
    },
    "messagingLimitTier": {
      "type": [
        "string",
        "null"
      ]
    },
    "requestedNameStatus": {
      "type": [
        "string",
        "null"
      ]
    },
    "instagramName": {
      "type": [
        "string",
        "null"
      ]
    },
    "instagramUsername": {
      "type": [
        "string",
        "null"
      ]
    },
    "instagramBio": {
      "type": [
        "string",
        "null"
      ]
    },
    "instagramWebsite": {
      "type": [
        "string",
        "null"
      ]
    },
    "instagramFollowersCount": {
      "type": [
        "number",
        "null"
      ]
    },
    "instagramFollowsCount": {
      "type": [
        "number",
        "null"
      ]
    },
    "instagramMediaCount": {
      "type": [
        "number",
        "null"
      ]
    },
    "instagramAccountType": {
      "type": [
        "string",
        "null"
      ]
    },
    "profilePhotoUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "usagePermissions": {
      "type": "object",
      "properties": {
        "liveChat": {
          "type": "boolean"
        },
        "automations": {
          "type": "boolean"
        },
        "broadcast": {
          "type": "boolean"
        }
      },
      "required": [
        "liveChat",
        "automations",
        "broadcast"
      ],
      "additionalProperties": false
    },
    "connectionType": {
      "type": "string"
    },
    "humanAgent": {
      "type": "boolean"
    },
    "receiveGroups": {
      "type": "boolean"
    },
    "alwaysOnline": {
      "type": "boolean"
    },
    "providerUpdateAvailable": {
      "type": "boolean"
    },
    "lastWebhookAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "syncedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "archivedAt": {
      "type": "null"
    },
    "createdAt": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "channel",
    "status",
    "syncing",
    "stableKey",
    "displayName",
    "phone",
    "wabaId",
    "numberStatus",
    "businessVerified",
    "qualityRating",
    "messagingLimitTier",
    "requestedNameStatus",
    "instagramName",
    "instagramUsername",
    "instagramBio",
    "instagramWebsite",
    "instagramFollowersCount",
    "instagramFollowsCount",
    "instagramMediaCount",
    "instagramAccountType",
    "profilePhotoUrl",
    "usagePermissions",
    "connectionType",
    "humanAgent",
    "receiveGroups",
    "alwaysOnline",
    "providerUpdateAvailable",
    "lastWebhookAt",
    "syncedAt",
    "archivedAt",
    "createdAt"
  ],
  "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).
