# Find users by date

You can find users based on their first_seen, last_seen, last_contacted, or updated_at attributes. These results can be filtered by conditions defined in the request body.

GET /users/?search=:type&min=:timestamp&max=:timestamp

Attributes Type Required Description
search fixed yes An attribute through which you can search. 4 types to choose from: first_seen, last_seen, last_contacted, updated_at (UNIX format)
min timestamp no A start date of search in UNIX format.
max timestamp no An end date of search in UNIX format.
with_email boolean no If value is set up to true results includes only users with emails.
tags string no A tag name.

The lookup value has to be in ISO-8601 format.

Lookup Description Example usage
__lt Lesser than ?first_seen__lt=2019-05-16+00:00
__lte Lesser than or equal ?first_seen__lte=2019-05-16+00:00
__gt Greater than ?first_seen__gt=2019-05-16+00:00
__gte Greater than or equal ?first_seen__gte=2019-05-16+00:00

# Request

  • CURL
  • JavaScript
  • PHP
  • Python
curl -X GET -H "Authorization: Token <your_64_char_api_key>"
-H "Accept: */*; version=2" 
-H "Accept: */*; version=2" -H "Content-Type: application/json" "https://<your_app_subdomain>.user.com/api/public/users/?search=last_seen&min=1477008000&max=1477139136"

# Response

{
  "next": null,
  "count": 1,
  "results": [
    {
      "google_url": null,
      "first_seen": null,
      "region": null,
      "unsubscribed": false,
      "city": null,
      "name": "Jane Doe",
      "browser_language": null,
      "gravatar_url": "https://randomuser.me/api/portraits/men/51.jpg",
      "updated_at": "2017-06-14T07:06:18.495809Z",
      "gender": "unknown",
      "phone_number": null,
      "last_seen": "2017-06-14T11:06:08.182761Z",
      "id": 19678376,
      "os_type": null,
      "notifications": true,
      "country": null,
      "page_views": 0,
      "timezone": null,
      "score": 0,
      "linkedin_url": null,
      "tags": [
        {
          "id": 1441,
          "name": "tag"
        }
      ],
      "attributes": [
        {
          "value": true,
          "name": "Example attr",
          "name_std": "example_attr",
          "id": 1109
        },
        {
          "value": "attribute value",
          "name": "My string attr",
          "name_std": "my_string_attr",
          "id": 2429
        }
      ],
      "twitter_url": null,
      "key": "g3FaYocCy0U6",
      "created_at": "2017-06-07T09:41:13.466897Z",
      "facebook_url": null,
      "last_contacted": null,
      "lists": [],
      "chat_id": "Chat ID is deprecated and will be removed in future",
      "resolution": null,
      "last_ip": null,
      "status": "visitor",
      "email": "updated@email.com",
      "browser": null
    }
  ],
  "previous": null
}