Ver .md

pipelines.filter_count

Contar oportunidades de um filtro avançado. Quantas oportunidades visíveis ao chamador, em todos os pipelines, casam com o filtro avançado (o número do rodapé do modal de filtro). Sem condições, conta todas.

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

Entrada

CampoTipoObrigatórioNota
filterobject[]sim
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "filter": {
      "maxItems": 30,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "matcher": {
            "type": "string",
            "enum": [
              "all",
              "any"
            ]
          },
          "connector": {
            "type": "string",
            "enum": [
              "and",
              "or"
            ]
          },
          "conditions": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string",
                  "maxLength": 60
                },
                "operator": {
                  "type": "string",
                  "maxLength": 30
                },
                "value": {
                  "anyOf": [
                    {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 4000
                        },
                        {
                          "maxItems": 500,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 200
                          }
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "lead": {
                  "maxItems": 200,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "maxLength": 64
                      },
                      "order": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "field": {
                        "type": "string",
                        "maxLength": 60
                      },
                      "operator": {
                        "type": "string",
                        "maxLength": 30
                      },
                      "negation": {
                        "default": false,
                        "type": "boolean"
                      },
                      "parentId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 64
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "valueString": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 4000
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "valueNumber": {
                        "type": [
                          "number",
                          "null"
                        ]
                      },
                      "valueDate": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 40
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "valueBool": {
                        "type": [
                          "boolean",
                          "null"
                        ]
                      },
                      "valueUuid": {
                        "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"
                          }
                        ]
                      }
                    },
                    "required": [
                      "field",
                      "operator"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "field",
                "operator"
              ]
            }
          }
        },
        "required": [
          "matcher",
          "connector",
          "conditions"
        ]
      }
    }
  },
  "required": [
    "filter"
  ]
}

Exemplo

curl -X POST https://app.atomiks.com.br/api/v1/pipelines.filter_count \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"filter":[{"matcher":"all","connector":"and","conditions":[{"field":"status","operator":"equals","value":"open"}]}]}'

CLI:

node cli/atomiks.mjs pipelines.filter_count --json '{"filter":[{"matcher":"all","connector":"and","conditions":[{"field":"status","operator":"equals","value":"open"}]}]}'

MCP: ferramenta pipelines_filter_count com a mesma entrada.

Saída

Sucesso: {"data": ...} com o formato abaixo.

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