# roles.list

Lista os cargos e quem os tem. Cargos fixos (Administrador, Membro) e nomeados, na ordem da matriz, cada um com o acesso do Atomiks (módulos, telas, canais) e as pessoas que o têm. `writable` é falso antes da migration dos cargos.

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

## Entrada

Sem campos: envie `{}`.

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {}
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/roles.list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

CLI:

```bash
node cli/atomiks.mjs roles.list --json '{}'
```

MCP: ferramenta `roles_list` 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": {
    "roles": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "fixed": {
            "type": "boolean"
          },
          "position": {
            "type": "number"
          },
          "permissions": {
            "type": "object",
            "properties": {
              "modules": {
                "anyOf": [
                  {
                    "type": "string",
                    "const": "*"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                ]
              },
              "screens": {
                "anyOf": [
                  {
                    "type": "string",
                    "const": "*"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                ]
              },
              "channels": {
                "anyOf": [
                  {
                    "type": "string",
                    "const": "*"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                ]
              }
            },
            "required": [
              "modules",
              "screens",
              "channels"
            ],
            "additionalProperties": false
          },
          "members": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "imageUrl": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "email",
                "imageUrl"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "name",
          "fixed",
          "position",
          "permissions",
          "members"
        ],
        "additionalProperties": false
      }
    },
    "writable": {
      "type": "boolean"
    }
  },
  "required": [
    "roles",
    "writable"
  ],
  "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).
