{
    "name": "Project_queryContacts",
    "description": "Queries contacts within the given project.",
    "params": [
        {
            "name": "project_id",
            "type": "string",
            "required": true,
            "description": "ID of the Project"
        },
        {
            "name": "group_id",
            "type": "string",
            "description": "Filter contacts within a group"
        },
        {
            "name": "name",
            "type": "string",
            "description": "Filter contacts by name",
            "example": {
                "prefix": "John"
            },
            "modifiers": [
                "ne",
                "prefix",
                "not_prefix",
                "gte",
                "gt",
                "lt",
                "lte"
            ]
        },
        {
            "name": "phone_number",
            "type": "string",
            "description": "Filter contacts by phone number",
            "modifiers": [
                "ne",
                "prefix",
                "not_prefix",
                "gte",
                "gt",
                "lt",
                "lte",
                "exists"
            ]
        },
        {
            "name": "time_created",
            "type": "integer",
            "description": "Filter contacts by time created",
            "modifiers": [
                "min",
                "max"
            ]
        },
        {
            "name": "last_message_time",
            "type": "integer",
            "description": "Filter contacts by last time a message was sent or received",
            "example": {
                "min": 1777049093
            },
            "modifiers": [
                "min",
                "max",
                "exists"
            ]
        },
        {
            "name": "last_incoming_message_time",
            "type": "integer",
            "description": "Filter contacts by last time a message was received",
            "modifiers": [
                "min",
                "max",
                "exists"
            ]
        },
        {
            "name": "last_outgoing_message_time",
            "type": "integer",
            "description": "Filter contacts by last time a message was sent",
            "modifiers": [
                "min",
                "max",
                "exists"
            ]
        },
        {
            "name": "incoming_message_count",
            "type": "integer",
            "description": "Filter contacts by number of messages received from the contact",
            "modifiers": [
                "ne",
                "min",
                "max"
            ]
        },
        {
            "name": "outgoing_message_count",
            "type": "integer",
            "description": "Filter contacts by number of messages sent to the contact",
            "modifiers": [
                "ne",
                "min",
                "max"
            ]
        },
        {
            "name": "send_blocked",
            "type": "boolean",
            "description": "Filter contacts by blocked status"
        },
        {
            "name": "vars",
            "type": "object",
            "description": "Filter contacts by value of a custom variable (e.g. vars[email], vars[foo], etc.)",
            "modifiers": [
                "ne",
                "prefix",
                "not_prefix",
                "gte",
                "gt",
                "lt",
                "lte",
                "min",
                "max",
                "exists"
            ]
        },
        {
            "name": "sort",
            "type": "string",
            "description": "Sort the results based on a field",
            "enum": [
                "default",
                "name",
                "phone_number",
                "last_message_time"
            ],
            "default": "default"
        },
        {
            "name": "sort_dir",
            "type": "string",
            "description": "Sort the results in ascending or descending order",
            "enum": [
                "asc",
                "desc"
            ],
            "default": "asc"
        },
        {
            "name": "page_size",
            "type": "integer",
            "description": "Number of results returned per page (max 500)",
            "default": 50
        },
        {
            "name": "offset",
            "type": "integer",
            "description": "Number of items to skip from beginning of result set",
            "default": 0
        },
        {
            "name": "marker",
            "type": "string",
            "description": "'next_marker' property returned by a previous call to this API method, indicating where the next page of results should start."
        },
        {
            "name": "count",
            "type": "boolean",
            "description": "If true, the API will return the count of items matching the filter, instead of the items themselves",
            "default": false
        },
        {
            "name": "fields",
            "type": "string",
            "description": "Comma-separated list of response field names to include. The id field is always returned. Available fields: id, name, phone_number, time_created, time_updated, send_blocked, conversation_status, last_message_time, last_incoming_message_time, last_outgoing_message_time, message_count, incoming_message_count, outgoing_message_count, last_message_id, default_route_id, group_ids, vars, project_id, url"
        }
    ],
    "item_type": "Contact",
    "item_type_description": "A contact represents a person or other entity that can be communicated with via phone number or other messaging channel within a project.\n\n Each contact has a name, phone number, and custom variables that can be used to personalize messages. Contacts can belong to one or more groups, and can be used as recipients for broadcasts, campaigns, and other messaging operations.\n\n Contacts can be imported or created individually via the API or web app. If the project's auto_create_contacts setting is enabled, a contact will be automatically created for each unique phone number that a message is sent to or received from.",
    "item_fields": [
        {
            "name": "id",
            "type": "string, max 34 characters",
            "description": "ID of the contact"
        },
        {
            "name": "name",
            "description": "Name of the contact"
        },
        {
            "name": "phone_number",
            "type": "string",
            "description": "Phone number of the contact"
        },
        {
            "name": "time_created",
            "type": "UNIX timestamp",
            "description": "Time the contact was added in Telerivet"
        },
        {
            "name": "time_updated",
            "type": "UNIX timestamp",
            "description": "Time the contact was last updated in Telerivet"
        },
        {
            "name": "send_blocked",
            "type": "bool",
            "description": "True if Telerivet is blocked from sending messages to this contact"
        },
        {
            "name": "conversation_status",
            "description": "Current status of the conversation with this contact"
        },
        {
            "name": "last_message_time",
            "type": "UNIX timestamp",
            "description": "Last time the contact sent or received a message (null if no messages have been sent or received)"
        },
        {
            "name": "last_incoming_message_time",
            "type": "UNIX timestamp",
            "description": "Last time a message was received from this contact"
        },
        {
            "name": "last_outgoing_message_time",
            "type": "UNIX timestamp",
            "description": "Last time a message was sent to this contact"
        },
        {
            "name": "message_count",
            "type": "int",
            "description": "Total number of non-deleted messages sent to or received from this contact"
        },
        {
            "name": "incoming_message_count",
            "type": "int",
            "description": "Number of messages received from this contact"
        },
        {
            "name": "outgoing_message_count",
            "type": "int",
            "description": "Number of messages sent to this contact"
        },
        {
            "name": "last_message_id",
            "description": "ID of the last message sent to or received from this contact (null if no messages have been sent or received)"
        },
        {
            "name": "default_route_id",
            "description": "ID of the basic route (phone) or custom route that Telerivet will use by default to send messages to this contact (null if using project default ro..."
        },
        {
            "name": "group_ids",
            "type": "array of strings",
            "description": "List of IDs of groups that this contact belongs to"
        },
        {
            "name": "vars",
            "type": "object",
            "description": "Custom variables stored for this contact."
        },
        {
            "name": "project_id",
            "description": "ID of the project this contact belongs to"
        },
        {
            "name": "url",
            "description": "URL to this contact in the Telerivet web app"
        }
    ],
    "filter_operators": "Parameters with a 'modifiers' list support filter operators. Pass the value as an object with the modifier as key, e.g. {\"min\": 1000} or {\"prefix\": \"John\"}. Supported modifiers: prefix/not_prefix (string starts/doesn't start with), eq/ne (equals/not equals), gte/gt/lt/lte (comparisons), min/max (numeric range, min inclusive, max exclusive), exists (true: has value, false: is null).",
    "response_fields": [
        {
            "name": "data",
            "type": "array",
            "description": "Array of results, each with the fields listed in item_fields"
        },
        {
            "name": "truncated",
            "type": "boolean",
            "description": "Whether there are more results available"
        },
        {
            "name": "next_marker",
            "type": "string",
            "description": "Pass this to the marker parameter to get the next page of results (null if truncated is false)"
        }
    ]
}