How do I get Policy Info using an API?

viswaisteer
viswaisteer Expensify Customer Posts: 2

Hi Support team

I have a task where I create/update employee in expensify and assign him to a given policy. After successful creation/updation,I need to check whether that employee's manager also assigned to that policy if not he also need to be assigned to that policy with a auditor.

Example:

Tasks are

  1. Create Emp A and assign with Policy '1A' and manager B.
  2. Check whether manager B has already assigned with Policy '1A' if not assign with Policy '1A'

I have completed the task 1. But for task 2 I need an API which which helps either to fetch Manager's existing policy details based on manager email or fetch employee details associated with an policy id.


I have tried Policy getter and policy getter and policy list getter but both didnt give the expected response.

Policy getter: Gives only tax details in below response only for the admin email.

Policy List Getter: Gives only policyList": [{
        "outputCurrency": "USD",
        "owner": "<<>>",
        "role": "<<>>",
        "name": "<<>>",
        "id": "<<>>",
        "type": "<<>>"


If I give other employee email Im getting below response.

{"responseMessage":"Not authorized to authenticate as user sample@email.com","responseCode":401}


Can someone help or advise for above scenario?


Regards

Viswa

Answers

  • Alejandro Paz
    Alejandro Paz Expensify Team Posts: 87 Expensify Team

    Hi @viswaisteer !

    Based on the "{"responseMessage":"Not authorized to authenticate as user sample@email.com","responseCode":401}" message, it sounds like this may be due to your current level of access. Access to the Expense Creator API on behalf of employees requires some set-up from Expensify as we're required to:

    1. Make sure you're set up correctly, (using Domain Control, are a Domain Admin, are a Policy Admin etc...)
    2. Validate you are authorized internally to add data to other accounts on your domain.

    Do you have access to the policies that you're attempting to get information from? If you want to continue troubleshooting this with more specifics and detail, can you write into concierge@expensify.com and reference this post? Thanks!

  • viswaisteer
    viswaisteer Expensify Customer Posts: 2

    Thanks Alejandro for the reply. Unfortuantely for the links Domain Control,Domain Admin and Policy Admin, Im getting message as We're currently experiencing issues with our American Express and Capital One connections. Please visit our status page for more details and to subscribe to updates.

    And also we are not trying access  Expense Creator API. We just expecting an API to return an employee details associated to an Policy or an API to return policy details based on employee email. From Expensify UI, there is a API call is used which is giving the result we are getting.

    Attached screenshots of API request and repsonse called from UI

    1. API request screenshot - API request call with params
    2. API Response screenshot - API response with policy info and associated employees

    Is there any similar APIs exposed for integration purposes?


    I will also send out an email to concierge@expensify.com .

    Thanks

    Regards

    Viswa