Identify API token

First of all, Hello,

I was wondering if there is a way to identify the user based on the API Token. As we have a need to know who is subject that wants to utilise certain services that depend on FreshDesk API.

Is there a way that this can be achieved, or maybe something planned for the future?

Best Wishes

Hi @sakile ,

Welcome to the community! :tada:

API token is specific to the account and you can get the account details using the /api/v2/account. Sample response for your reference

{
  organisation_id: 284960733419037820,
  organisation_name: "dailyplanet.myfreshworks.com",
  account_id: 1840509,
  account_name: "Daily Planet",
  account_domain: "dailyplanet.freshdesk.com",
  bundle_id: null,
  hipaa_compliant: false,
  total_agents: {
    full_time: 1,
    occasional: 1,
    field_service: 0,
    collaborators: 0
  },
  timezone: "Eastern Time (US & Canada)",
  data_center: "US",
  tier_type: "Forest",
  address: {
    country: USA,
    state: California,
    city: San Mateo CA ,
    street: S. Delaware Street,
    postalcode: 94403
  },
  contact_person: {
    firstname: "Clark",
    lastname: "Kent",
    email: "clarkkent1@gmail.com"
  }
}

Reference for the same - Freshdesk

Let me know if this helps. Thanks

1 Like

Hello @mariappan,

Thanks for the welcome, and for the reply!

Yes I noticed the mentioned /account API, however It seams only to be available for the admins. I would not be possible to identify non admin users?

Best Regards!

Hi @sakile

Good Day!

Yes, unfortunately, non-admin users can’t able to access the API as per documentation.

not be possible to identify non-admin users?

If you want to identify the user role, you can use the below endpoint to get the roles. Only users with admin privileges can access the below endpoint

https://domain.freshdesk.com/api/v2/roles below is the sample response.

[
  {
    "id" : 1,
    "name" : "Account Administrator",
    "description" : "Has complete control over the help desk including access to Account or Billing related information, and receives Invoices.",
    "default" : true,
    "created_at" : "2016-02-29T06:32:28Z",
    "updated_at" : "2016-02-29T06:32:28Z"
  }
]

Now from the logged-in user object, you can find the role_ids key which will be the array if the ID ( To get the role id you can use the above API ) of the Admin role is present in the array, then the logged-in user is an admin.

Thanks