Filters

Filters allow you to perform structured searches on parties, cases and opportunities. For a full description of the model see the Filter model definition. See the Filter reference to view the supported search criteria for each entity type and for usage examples.

Run query

Runs a query and returns the matching results. The entity parameter in the URL determines which entity type to search and must be one of parties, opportunities or kases. The conditions field in the request body is used to specify the search criteria.

POST
https://api.capsulecrm.com/api/v2/{entity}/filters/results
          {
  "filter": {
    "conditions": [
      {
        "field": "tag",
        "operator": "is",
        "value": "VIP"
      },
      {
        "field": "addedOn",
        "operator": "is within last",
        "value": 7
      }
    ]
  }
}
        

Query Parameters

Name Type Description
page Integer

The page of results to return. Default: 1

perPage Integer

Number of entities to return per page. Value must be between 1 and 100 Default: 50

embed Array of String

Can be used to specify extra entities to fully include in the result. If provided, should be a comma separated list of strings. Accepted values are the same as for the list or show endpoint of the specified entity.

Response

Returns HTTP status code 200. The body of the response will contain a list of entities that match the specified filter conditions. The response will be in the same format as the response for the list endpoint of the requested entity type e.g. the results of a parties query are in the same format as returned by List parties. In the case of an invalid request, an error message will be returned, as described in the errors section.

HTTP/1.1 200
Link: <https://api.capsulecrm.com/api/v2/{entity}/filters/results?page=2>; rel="next"
{
  "parties": [
    {
      "id": 11587,
      "type": "person",
      "about": null,
      "title": null,
      "firstName": "Scott",
      "lastName": "Spacey",
      "jobTitle": "Creative Director",
      "createdAt": "2015-09-15T10:43:23Z",
      "updatedAt": "2015-09-15T10:43:23Z",
      "organisation": null,
      "lastContactedAt": null,
      "owner": null,
      "team": null,
      "addresses": [
        {
          "id": 12135,
          "type": null,
          "city": "Chicago",
          "country": "United States",
          "street": "847 North Rush Street",
          "state": "IL",
          "zip": "65629"
        }
      ],
      "phoneNumbers": [
        {
          "id": 12133,
          "type": null,
          "number": "773-338-7786"
        }
      ],
      "websites": [],
      "emailAddresses": [
        {
          "id": 12134,
          "type": "Work",
          "address": "scott@homestyleshop.co"
        }
      ],
      "pictureURL": "https://capsulecrm.com/theme/default/images/person_avatar_70.png"
    }
  ]
}

Headers:

Name Type Description
Link String

Links to the next and previous pages, encoded as defined in RFC 5988