# custom_objects.relations_list

Listar ligações dos objetos. Ligações entre objetos e Contatos, Oportunidades, Empresas ou outros objetos. Com `objectId`, as que envolvem o objeto (como origem ou como alvo); sem ele, todas. Cada uma traz os dois nomes (`sourceLabel` na ficha da origem, `targetLabel` na ficha do outro lado), `cardinality` (`many_to_one`: cada registro da origem tem um só do outro lado; `one_to_many`: o outro lado tem um só da origem; `many_to_many`), `showOnCard` (selo no card da oportunidade) e `linkCount` (quantos vínculos existem). As ligações fixas do sistema entre Contatos, Oportunidades e Empresas não entram.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `objectId` | string (uuid) | não |  |

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

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

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs custom_objects.relations_list --json '{}'
```

MCP: ferramenta `custom_objects_relations_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": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "objectId": {
            "type": "string"
          },
          "sourceObject": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "singularName": {
                "type": "string"
              },
              "pluralName": {
                "type": "string"
              },
              "icon": {
                "type": "string"
              },
              "color": {
                "type": "string"
              },
              "gender": {
                "type": "string",
                "enum": [
                  "masculine",
                  "feminine"
                ]
              }
            },
            "required": [
              "id",
              "singularName",
              "pluralName",
              "icon",
              "color",
              "gender"
            ],
            "additionalProperties": false
          },
          "sourceLabel": {
            "type": "string"
          },
          "targetLabel": {
            "type": "string"
          },
          "targetType": {
            "type": "string",
            "enum": [
              "leads",
              "opportunities",
              "companies",
              "objects"
            ]
          },
          "targetObjectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "targetObject": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "singularName": {
                    "type": "string"
                  },
                  "pluralName": {
                    "type": "string"
                  },
                  "icon": {
                    "type": "string"
                  },
                  "color": {
                    "type": "string"
                  },
                  "gender": {
                    "type": "string",
                    "enum": [
                      "masculine",
                      "feminine"
                    ]
                  }
                },
                "required": [
                  "id",
                  "singularName",
                  "pluralName",
                  "icon",
                  "color",
                  "gender"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "cardinality": {
            "type": "string",
            "enum": [
              "many_to_one",
              "one_to_many",
              "many_to_many"
            ]
          },
          "showOnCard": {
            "type": "boolean"
          },
          "linkCount": {
            "type": "number"
          },
          "createdAt": {
            "type": "string"
          },
          "updatedAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "objectId",
          "sourceObject",
          "sourceLabel",
          "targetLabel",
          "targetType",
          "targetObjectId",
          "targetObject",
          "cardinality",
          "showOnCard",
          "linkCount",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "items"
  ],
  "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).
