DESKIE API
Users
Create a user

POST  |  https://[domain].deskie.io/api/users.json
Create a new user.
Parameters
Request

{
  "user" : {
    "user_email" : "[email protected]",
    "user_full_name" : "User's full name",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "user_note" : "Some note",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true
    }
  }
}
Response

{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "password" : "bsdegs",
    "type" : "email",
    "user_email" : "[email protected]",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true
    },
    "linked_users" : [123,456]
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X POST -d '{ "user": { "user_email":"[email protected]", "user_full_name":"User\u0027s full name", "language_id":2, "custom_fields":{"cf_20":"some data", "cf_23":true} }}' https://[domain].deskie.io/api/users.json
Get a list of users

GET  |  https://[domain].deskie.io/api/users.json
Get a list of users.
1. You can get up to 100 users in the response to one request, i.e. the maximum value of the "limit" parameter is 100.

2. To get users in batches, you need to pass the "page" and "limit" parameters. The "page" parameter allows you to get the desired page with users, the number of which is determined by the "limit" parameter.

3. You can determine how many users there are in total using "total_count" in the response to the first request.

4. If you do not specify the "page" and "limit" parameters in your request, you will get the first 100 users sorted by creation time, starting with the newest.

5. The maximum value of the "page" parameter is 500.

If you have a lot of users and you want to get all them, you need to check when the first user was created. You can do so in the "Users" section of the agent account. Then divide the entire period into small intervals and pass the "page" and "limit" parameters for each interval.

Let's say you've been using Deskie for a year, and 200,000 users were created in your account during that period. You can split the year into 12 months and get data for each month by passing not only the "page" and "limit" parameters, but also the "from_time" and "to_time" parameters, so that the selection includes users for the desired month, taking into account the creation time.
Parameters
Response

{
    "0": {
      "user" : {
        "user_id" : 200,
        "user_full_name" : "User's full name",
        "company_name" : "User's company name",
        "company_position" : "User's position",
        "thumbnail" : "",
        "confirmed" : false,
        "active" : true,
        "deleted" : false,
        "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
        "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
        "type" : "email",
        "user_email" : "[email protected]",
        "language_id" : 2,
        "custom_fields" : {
            "cf_20" : "some data",
            "cf_23" : true
        }
      }
    },
    "1": {
      "user" : {
        "user_id" : 300,
        "user_full_name" : "Second user's full name",
        "company_name" : "Second user's company name",
        "company_position" : "Second user's position",
        "thumbnail" : "",
        "confirmed" : false,
        "active" : true,
        "deleted" : false,
        "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
        "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
        "type" : "facebook",
        "facebook_id" : 123123123,
        "language_id" : 2,
        "custom_fields" : {
            "cf_20" : "some data",
            "cf_23" : true
        }
      }
    },
    "2": {
      "user" : {
        "user_id" : 400,
        "user_full_name" : "Third user's full name",
        "company_name" : "Third user's company name",
        "company_position" : "Third user's position",
        "thumbnail" : "",
        "confirmed" : false,
        "active" : true,
        "deleted" : false,
        "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
        "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
        "type" : "twitter",
        "facebook_id" : 3333333,
        "language_id" : 1,
        "custom_fields" : {
            "cf_20" : "some data",
            "cf_23" : true
        }
      }
    },
    "total_count":20
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -g -X GET "https://[domain].deskie.io/api/users.json?limit=50&page=2&language_id=2&custom_fields[cf_20]=data"
View a user

GET  |  https://[domain].deskie.io/api/users/[id].json
View data of a specific user.
Response

{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "type" : "email",
    "user_email" : "[email protected]",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true
    },
    "linked_users" : [123,456]
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X GET https://[domain].deskie.io/api/users/200.json
Edit a user

PUT  |  https://[domain].deskie.io/api/users/[id].json
Edit data of a specific user.
Parameters
Request

{
  "user" : {
    "user_full_name" : "User's full name changed",
    "language_id" : 1,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true
    }
  }
}
Response

{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name changed",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "type" : "email",
    "user_email" : "[email protected]",
    "language_id" : 1,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true
    }
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '{ "user": { "user_full_name":"User\u0027s full name changed", "language_id":2, "custom_fields":{"cf_20":"some data", "cf_23":true} }}' https://[domain].deskie.io/api/users/200.json
Generate an identification code

POST  |  https://[domain].deskie.io/api/users/identification.json
Almost all social networks and messengers, except WhatsApp, do not transmit data that can be used to identify the user.

If your clients (users) have personal accounts on your service or use your mobile application, you can configure the generation of identification codes for them within their personal accounts or mobile application. Read more.
Parameters
Request

{
  "user" : {
    "user_full_name" : "Jane Ostin",
    "company_name" : "ABCompany",
    "user_email" : "[email protected]",
    "user_phone" : "+442034867173", 
    "user_whatsapp_phone" : "+442034867173",
    "user_custom_id" : "j.ostin",
    "user_custom_channel" : "481", 
    "custom_fields" : {
        "cf_7264" : "some data",
        "cf_7786" : 2,
        "cf_7486" : true
    }
  }
}
Response

{
    "code": "o_37BD49_uv"
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X POST -d '{ "user": { "user_email":"[email protected]", "user_phone":"+442034867173", "user_full_name":"Jane Ostin", "custom_fields":{"cf_7264":"some data", "cf_7786":2, "cf_7486":true} }}' https://[domain].deskie.io/api/users/identification.json
Link user profiles

PUT  |  https://[domain].deskie.io/api/users/[id]/link.json
When a user contacts through any of the communication channels, we do automatically create a profile that relates to this particular channel.

For example, a user had contacted you via the email channel and we created a profile by email for him. After some time, the same user had contacted you via the Telegram channel, and we did create a profile by Telegram for him. The service cannot figure out automatically that the user in both profiles created is the same person. Therefore, we provide you with the possibility to link profiles by specifying the email address of the user in his profile by Telegram.

This method allows you to perform such a linking using the API.

The ID in the URL is the user with whose profile the linking will be performed. This is a linkage of profiles, not a merge. That is, in the database, we store them separately, but, also we do commit that they are linked (the linked_users parameter in the user data). This is done so that at any time you can unlink the linked profiles.
Parameters
Request

{
    "user_email" : "[email protected]"
}
Response

{
  "user" : {
    "user_id" : 1307386,
    "user_full_name" : "User's full name",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2020 10:55:23 +0200",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true
    },
    "type" : "telegram",
    "telegram_id" : 495582869,
    "linked_users" : [1307386,25830712]
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '{"user_email":"[email protected]"}' "https://[domain].deskie.io/api/users/25830712/link.json"
Unlink user profiles

PUT  |  https://[domain].deskie.io/api/users/[id]/unlink.json
When a user contacts through any of the communication channels, we do automatically create a profile that relates to this particular channel.

For example, a user had contacted you via the email channel and we created a profile by email for him. After some time, the same user had contacted you via the Telegram channel, and we did create a profile by Telegram for him. The service cannot figure out automatically that the user in both profiles created is the same person. Therefore, we provide you with the possibility to link profiles by specifying the email address of the user in his profile by Telegram.

If the linking was performed by mistake, the profiles might be unlinked. This method allows you to perform such an unlinking using the API.

ID in URL is the user from whom the user (value being passed within the request parameters) will be unlinked.
Parameters
Request

{
    "user_id" : 25830712
}
Response

{
  "user" : {
    "user_id" : 1307386,
    "user_full_name" : "User's full name",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2020 10:55:23 +0200",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true
    },
    "type" : "telegram",
    "telegram_id" : 495582869,
    "linked_users" : [1307386]
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '{"user_id": 25830712}' "https://[domain].deskie.io/api/users/25830712/unlink.json"
Delete a user

PUT  |  https://[domain].deskie.io/api/users/[id]/disable.json
Delete a user. In this situation, the user is moved to the "Deleted" list and can be restored, if necessary.
Response

{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name changed",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : true,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "type" : "email",
    "user_email" : "[email protected]",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true
    }
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '' https://[domain].deskie.io/api/users/200/disable.json
Block a user

PUT  |  https://[domain].deskie.io/api/users/[id]/block.json
Block a user. All the new cases received from the user being blocked will automatically be marked as spam. 
Response

{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name changed",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : false,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "type" : "email",
    "user_email" : "[email protected]",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true
    }
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '' https://[domain].deskie.io/api/users/200/block.json
Restore a user

PUT  |  https://[domain].deskie.io/api/users/[id]/restore.json
Unblock a user that has been blocked or restore a user that has been deleted.
Response

{
  "user" : {
    "user_id" : 200,
    "user_full_name" : "User's full name changed",
    "company_name" : "User's company name",
    "company_position" : "User's position",
    "thumbnail" : "",
    "confirmed" : false,
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
    "type" : "email",
    "user_email" : "[email protected]",
    "language_id" : 2,
    "custom_fields" : {
        "cf_20" : "some data",
        "cf_23" : true
    }
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '' https://[domain].deskie.io/api/users/200/restore.json
Delete permanently a user

DELETE  |  https://[domain].deskie.io/api/users/[id].json
Delete permanently a user. Available only to the agents with a full access level.
Response

HTTP Status: 200 OK
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X DELETE https://[domain].deskie.io/api/users/200.json