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

# Get Client Rule

> Who counts as a client in one connected CRM

Reads the rule that decides which of a connected CRM's companies are your
clients. `rule` is `null` when none is set, and then no companies come from that
CRM.

A company is a client when it matches a **company property** condition (`field`
and the `values` that mean client), when it has a **won deal** (`wonDeal`), or
both. `match` says whether either is enough (`any`) or both must hold (`all`).
See [CRM rule](https://docs.clustr-ai.com/client-companies.md#crm-rule) for how each CRM marks a won deal.

The companies the rule marks join your [client list](https://docs.clustr-ai.com/client-companies.md), which
every feature reads.

## Errors

| Status | Code | When |
| - | - | - |
| 404 | `CRM_NOT_CONNECTED` | That CRM is not connected for this workspace |
| 404 | `UNKNOWN_PROVIDER` | `provider` is not one of the three |

```bash cURL theme={null}
curl https://api.clustr-ai.com/api/public/client-companies/rule/hubspot \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json 200 theme={null}
{
  "success": true,
  "data": {
    "rule": {
      "enabled": true,
      "field": "customer_status",
      "fieldLabel": "Customer status",
      "fieldType": "single_select",
      "values": ["active"],
      "valueLabels": ["Active"],
      "wonDeal": true,
      "match": "any",
      "updatedAt": "2026-10-01T09:12:00Z"
    }
  }
}
```


## OpenAPI

````yaml GET /client-companies/rule/{provider}
openapi: 3.1.0
info:
  title: Clustr Public API
  description: >
    Programmatic access to your Clustr network: import connectors, search warm
    intros (opportunities), and manage target accounts.


    ## Authentication

    All endpoints require a Bearer token (API key) in the `Authorization`
    header.


    ```

    Authorization: Bearer <your_api_key>

    ```


    API keys can be created and managed from the [API settings
    page](https://app.clustr-ai.com/api).
  version: '1.0'
  contact:
    name: Clustr Support
    url: https://clustr-ai.com
servers:
  - url: https://api.clustr-ai.com/api/public
    description: Production
security:
  - BearerAuth: []
paths:
  /client-companies/rule/{provider}:
    parameters:
      - $ref: '#/components/parameters/ClientRuleProvider'
    get:
      tags:
        - Client Companies
      summary: Get Client Rule
      description: |
        The rule that decides which of a connected CRM's companies are clients,
        or `null` when none is set. A company is a client when it matches a
        company property condition, when it has a won deal, or both, combined
        by `match`.
      operationId: getClientRule
      responses:
        '200':
          description: The rule, or null
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      rule:
                        nullable: true
                        allOf:
                          - $ref: '#/components/schemas/ClientRule'
        '401':
          description: Invalid or missing API key
        '404':
          description: >-
            The CRM is not connected (`CRM_NOT_CONNECTED`), or the provider is
            unknown
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    ClientRuleProvider:
      name: provider
      in: path
      required: true
      schema:
        type: string
        enum:
          - hubspot
          - salesforce
          - attio
      description: >-
        The CRM whose client rule to use. It must be connected to your
        workspace.
  schemas:
    ClientRule:
      allOf:
        - $ref: '#/components/schemas/ClientRuleRequest'
        - type: object
          properties:
            updatedAt:
              type: string
              format: date-time
              description: When the rule was last saved.
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid request body
            code:
              type: string
              example: BAD_REQUEST
    ClientRuleRequest:
      type: object
      description: |
        Who counts as a client in one CRM: a company property condition
        (`field`, `fieldType` and the `values` that mean client), a won deal
        (`wonDeal`), or both, combined by `match`.
      properties:
        confirm:
          type: boolean
          description: >-
            Set Client Rule only (Preview Client Rule ignores it). Changing or
            turning off a rule

            that is on can remove companies from your client list, so such a
            save writes nothing

            and answers `confirmationRequired: true` with `currentRuleMatches`,
            `newRuleMatches`,

            `countIsLowerBound`, a `sample` and a `message`. Send the same
            request with `confirm`

            set to true to apply it.
        enabled:
          type: boolean
          description: >-
            Whether the rule applies. A disabled rule is kept but marks no
            company as a client.
        field:
          type: string
          description: >-
            The company property's API name, from the fields endpoint. Omit
            `field` and `fieldType` for a rule on won deals alone.
        fieldLabel:
          type: string
          description: The property's display name. Filled from the CRM when omitted.
        fieldType:
          type: string
          description: >-
            `boolean`, `single_select`, `multi_select` or `text`, as the fields
            endpoint reports it.
          enum:
            - boolean
            - single_select
            - multi_select
            - text
        values:
          type: array
          items:
            type: string
          description: >-
            The values that mean client: option values for a dropdown,
            `["true"]` for a checkbox, exact text for a text property.
        valueLabels:
          type: array
          items:
            type: string
          description: Display labels for `values`, in the same order.
        wonDeal:
          type: boolean
          description: |
            A company with at least one won deal is a client: HubSpot
            `hs_is_closed_won`, Salesforce `IsWon`, Attio a deal in one of
            `wonStages`.
        wonStages:
          type: array
          items:
            type: string
          description: >-
            Attio only, and required there with `wonDeal`: the ids of the deal
            stages that count as won, from `dealStages`. Ignored for HubSpot and
            Salesforce.
        wonStageLabels:
          type: array
          items:
            type: string
          description: 'Attio only: display labels for `wonStages`, in the same order.'
        match:
          type: string
          enum:
            - any
            - all
          default: any
          description: >-
            With both conditions, `any` (either is enough) or `all` (both must
            hold).
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: The API key you created on the API settings page of the Clustr app.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.