# Search Contacts

Searches contact email and SMS channels by address, status, channel or tag (manual or smart tag), paginated by cursor. A contact with both channels appears twice. A contact with neither email address nor mobile number appears once with channel "none" and status "none"; an address or status filter leaves it out. Phone queries need a country code; contact fields are available through get-contact.

## Input schema:

```json
{
  "type": "object",
  "properties": {
    "query": {
      "type": [
        "null",
        "string"
      ],
      "description": "Case-insensitive fragment of an email address, or a mobile number with its country code; omit to match every contact",
      "default": null,
      "maxLength": 250
    },
    "status": {
      "type": [
        "null",
        "string"
      ],
      "description": "Subscription status to filter by; omit for every status",
      "default": null,
      "enum": [
        "pending",
        "optin",
        "subscribed",
        "unsubscribed"
      ]
    },
    "tagId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "ID of a tag of the account the returned contacts must have, manual or smart tag",
      "default": null,
      "minimum": 1
    },
    "channel": {
      "type": [
        "null",
        "string"
      ],
      "description": "Restrict to email, sms, or none for contacts without either; omit for all",
      "default": null,
      "enum": [
        "email",
        "sms",
        "none"
      ]
    },
    "cursor": {
      "type": [
        "null",
        "string"
      ],
      "description": "Opaque nextCursor value of the previous result page; omit for the first page",
      "default": null,
      "maxLength": 500
    },
    "pageSize": {
      "type": "integer",
      "description": "Maximum contacts on the page, from 1 through 100",
      "default": 25,
      "minimum": 1,
      "maximum": 100
    },
    "accountId": {
      "type": [
        "null",
        "integer"
      ],
      "description": "User ID of the account; omit for the account the access token works in",
      "default": null,
      "minimum": 1
    }
  },
  "additionalProperties": false
}
```

## Output schema:

```json
{
  "type": "object",
  "required": [
    "accountId",
    "pageSize",
    "count",
    "hasMore",
    "nextCursor",
    "contacts"
  ],
  "properties": {
    "accountId": {
      "type": "integer"
    },
    "pageSize": {
      "type": "integer"
    },
    "count": {
      "type": "integer"
    },
    "hasMore": {
      "type": "boolean"
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ]
    },
    "contacts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "contactId",
          "channel",
          "contactInfo",
          "email",
          "subscriptionStatus",
          "editUrl"
        ],
        "properties": {
          "contactId": {
            "type": "integer"
          },
          "channel": {
            "type": "string",
            "enum": [
              "email",
              "sms",
              "none"
            ]
          },
          "contactInfo": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "subscriptionStatus": {
            "type": "string"
          },
          "editUrl": {
            "type": "string"
          }
        }
      }
    }
  }
}
```

