> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ryzeapi.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Atualizar conta

> Atualiza foto, nome de exibição e / ou status (about) do perfil da instância

**Auth:** `TokenAccount` ou `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotente:** sim (setar o mesmo valor de novo e no-op)

## Descrição

Atualiza um ou mais campos do perfil da conta conectada: **foto**, **nome de exibição** (push name) e / ou **status** (about). Update parcial, pelo menos um campo deve ser enviado. A `updatedFields` na resposta lista o que foi efetivamente alterado.

## Exemplos

### Tudo

Atualiza os três campos do perfil em uma única chamada: foto (URL pública), nome de exibição ("João Silva") e status ("Disponível"). A resposta lista quais foram efetivamente alterados em `updatedFields`.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/profile/account/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "profilePicture": "https://exemplo.com/foto.jpg",
      "profileName": "João Silva",
      "profileStatus": "Disponível"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/profile/account/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      profilePicture: "https://exemplo.com/foto.jpg",
      profileName:    "João Silva",
      profileStatus:  "Disponível"
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/profile/account/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "profilePicture": "https://exemplo.com/foto.jpg",
          "profileName":    "João Silva",
          "profileStatus":  "Disponível"
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "profilePicture": "https://exemplo.com/foto.jpg",
          "profileName":    "João Silva",
          "profileStatus":  "Disponível"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/profile/account/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Só nome

Atualiza apenas o `profileName` (push name) para "Vendas Empresa". Foto e status atuais ficam inalterados, o handler aceita update parcial.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/profile/account/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "profileName": "Vendas Empresa"
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/profile/account/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      profileName: "Vendas Empresa"
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/profile/account/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "profileName": "Vendas Empresa"
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "profileName": "Vendas Empresa"
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/profile/account/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Foto base64

Atualiza apenas a foto, enviando a imagem inline como `data:` URL com base64. O servidor decodifica, converte para JPEG 640x640 e aplica como nova foto de perfil.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/profile/account/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "profilePicture": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/profile/account/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      profilePicture: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/profile/account/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "profilePicture": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "profilePicture": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/profile/account/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Remover foto

Envia `profilePicture: ""` (string vazia) para apagar a foto atual. O perfil fica sem imagem, exibindo o avatar padrão do WhatsApp.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/profile/account/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "profilePicture": ""
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/profile/account/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      profilePicture: ""
    })
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      f"https://ryzeapi.cloud/api/profile/account/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "profilePicture": ""
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "profilePicture": ""
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/profile/account/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Resposta de sucesso

Retorna um envelope simples com `success`, `message` fixa (`Profile updated successfully`) e `updatedFields`, um array com os nomes dos campos efetivamente alterados (`profilePicture`, `profileName`, `profileStatus`). Use esse array para confirmar quais updates passaram, campos não enviados ou ignorados (ex.: `profileName` vazio é no-op) ficam de fora da lista.

```json 200 OK theme={null}
{
  "success": true,
  "message": "Profile updated successfully",
  "updatedFields": ["profileName", "profileStatus"]
}
```

## Parâmetros de rota

<ParamField path="instance" type="string" required>
  Nome da instância.
</ParamField>

## Headers

<ParamField header="token" type="string" required>
  `TokenAccount` ou `TokenInstance`.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

## Request body

Pelo menos **um** campo obrigatório.

<ParamField body="profilePicture" type="string">
  URL ou base64. String vazia (`""`) **remove** a foto atual. Convertida para JPEG (máx 640×640).
</ParamField>

<ParamField body="profileName" type="string">
  Push name, nome exibido aos outros contatos.
</ParamField>

<ParamField body="profileStatus" type="string">
  Texto da seção "Recados" (about). Pode ser string vazia para limpar.
</ParamField>

## Notas

<Note>
  * `profilePicture: ""` **remove** a foto. `profileName: ""` é tratado como **no-op**. `profileStatus: ""` **limpa** o status.
  * URLs de foto devem ser públicas, o servidor bloqueia downloads de redes internas (RFC1918, link-local) por SSRF guard.
  * Formatos aceitos: JPEG, PNG, WebP, GIF (primeiro frame). Tudo vira JPEG Q90 antes de subir.
  * O cache local (`profile_name`, `profile_picture_url`) é atualizado em background, pode haver alguns segundos de defasagem.
  * Mudanças frequentes podem ser rate-limitadas pelo WhatsApp.
</Note>

## Erros

| HTTP | Mensagem                                                                              |
| ---- | ------------------------------------------------------------------------------------- |
| 400  | `At least one field must be provided (profilePicture, profileName, or profileStatus)` |
| 400  | `Instance is not connected to WhatsApp`                                               |
| 500  | `failed to process profile picture: <reason>`                                         |
| 500  | `failed to set profile picture: <reason>`                                             |
| 500  | `failed to set profile name: <reason>`                                                |
| 500  | `failed to set profile status: <reason>`                                              |

Envelope:

```json theme={null}
{
  "success": false,
  "error": { "message": "At least one field must be provided (profilePicture, profileName, or profileStatus)" }
}
```
