Human Capital Management Blog Posts by SAP
Learn directly from SAP experts through blogs that deliver practical guidance and opportunities to deepen your expertise.
cancel
Showing results for 
Search instead for 
Did you mean: 
davidblank
Product and Topic Expert
Product and Topic Expert
2,681

I am a Technical Consultant with SAP Concur and work with customers that wish to interface their data with Concur Expense and Concur Invoice. I regularly collaborate with customers that use APIs to manage the data exchange between their systems and the Expense solution provided by SAP Concur.

The Quick Expense API facilitates the creation of an expense entry by capturing essential details, including date, amount, and type of expense, with the option to attach a receipt image. This new entry can then be added to an expense report within Concur Expense, enabling the user to provide further specifics such as attendees and itemizations.

The Quick Expense API can be useful in many scenarios. Transactions can be created to aid in testing cycles, easing the burden on your testers to manually create expense entries. If you have a card program that is not able to be automatically imported into Concur from the card provider, you can automate the import of these transactions from information provided to you by the provider. The time savings from being able to programmatically create these transactions can be a significant savings for your organization.

davidblank_0-1736179437123.png

Prerequisites

This post will not discuss authentication with Concur Expense. Please see this post to get an explanation on authentication and application building with Concur Expense.

You will need an application with the following SCOPEs.

Required Scopes:

  • quickexpense.writeonly          - Write quick expense
  • user.read                                - Get User Information, necessary for userID if using a user token
  • receipts.writeonly                   - Required if e-Bunsho is enabled

 

Optional Scope:

  • CONFIG                                 - Get Expense Configuration info, necessary for expenseTypeId

 

Works with these SAP Concur solutions:

  • Expense – Standard
  • Expense – Professional
  • Japan Market: If the partner is using this API to provide the e-Bunsho digital timestamp for the receipt, the partner should confirm that the client has e-Bunsho activated in SAP Concur

davidblank_0-1736179437123.png

Introduction

The Quick Expense API will be discussed with examples for creating the transactions with and without an image. The images shown are tested using Opensource client API Bruno v.1.34.2. You may need to adjust the payload/configuration based upon the API client used.

Additional details regarding the Quick Expense v4 API can be found here.

davidblank_0-1736179437123.png

Detailed Walkthrough

Determine the userID for the Quick Expense

The first step you should complete is to determine the userID that the transaction will be assigned. You can retrieve the profile of the user using this Profile API. This is the reason the user.read scope is listed as required for the Quick Expense API. This API could be used to determine the userID of the user making the profile API call.

GET     https://{datacenterURI}/profile/v1/me?schema=compact

If you wish to determine the userID for the given user by calling another Concur API, there are many to choose from that can be found in the Developer center documentation. These may require additional scopes to be added to the application. One example would be the use of the Identity v4.0 API.

Once the userID is determined, the expenseTypeId will need to be found.

Determine the expenseTypeId for the Quick Expense

The next step that must be completed is to determine the policies that the user is assigned. Transactions can only be created for expense types assigned to policies the user has been given. So, you must first determine the policies that the user has been assigned. Once you have identified the policies the user has been assigned, then you can determine the expense types available for the transaction which will be created by the Quick Expense API. If the Quick Expense API is not supplied an expense type, or a transaction is assigned an expense type that is not allowed for the user, the API will fail.

Determine the policies that are assigned for the user. The userID will be the value found in the last step.

GET     https://{datacenterURI}/expenseconfig/v4/users/{userID}/policies

Additional details regarding the Expense Configuration v4 APIs can be found here.

Example of the policy results for a given userID:

davidblank_0-1736180770449.png

Next, determine the list of expense types available to a user based on a particular policy found in the previous API call. Based on the results, one of the expenseTypeId values will be used to create the transaction using the Quick Expense API.

GET     https://{datacenterURI}/expenseconfig/v4/users/{userID}/policies/{policyId}/expensetypes

Additional details regarding the Expense Configuration v4 APIs can be found here.

Example of the expense type results for a given userID and policyId:

davidblank_0-1736180993288.png

Creating a Quick Expense without an Image

You have now determined the userID that the transaction will be assigned as well as the expenseTypeId. The template for this API call is listed below. Additional details can be found here.

Template for Quick Expense v4 API without an Image

POST   https://{datacenterURI}/quickexpense/v4/users/{userID}/context/{contextType}/quickexpenses

 

Name

Type

Description

userID

string

Required: The unique identifier of the SAP Concur user.

contextType

string

Required: The access level of the SAP Concur user, which determines the form fields they can view/modify. Supported value: TRAVELER.

You are now ready to create the payload for the Quick Expense.

First, determine the paymentTypeId that should be used for the quick expense.

Supported values:

  • CASHX  – Cash
  • CPAID   – Company Paid
  • PENDC – Pending Card Transaction

Next, create the body of the payload with the appropriate values that you wish to load for the user. I have an example payload below that you can use as a reference.

{
  "comment": "Team Lunch to Discuss Quick Expense",
  "expenseTypeId": "MEALS",
  "location": {
       "city": "Atlanta",
       "countryCode": "US",
       "countrySubDivisionCode": "US-GA"
  },
  "paymentTypeId": "CASHX",
  "transactionAmount": {
       "currencyCode": "USD",
       "value": 30.99
  },
  "transactionDate": "2024-12-27",
  "vendor": "Subway"
}

Then, call the Quick Expense v4 API with your payload.

Example of the results using the above payload:

davidblank_0-1736181763348.png

This is what the expense will appear as in Concur.

davidblank_1-1736181788542.png

davidblank_2-1736181804527.png

There may be additional details required for the Concur user to enter once the expense is assigned to a report which is dependent upon the Concur configuration.

 

Creating a Quick Expense with an Image

As discussed in the previous section, you have now determined the userID that the transaction will be assigned as well as the expenseTypeId.

The template for this API call is listed below. Additional details can be found here.

Template for Quick Expense v4 API with an Image

POST     https://{datacenterURI}/quickexpense/v4/users/{userID}/context/{contextType}/quickexpenses/image

 

Name

Type

Description

userID

string

Required The unique identifier of the SAP Concur user.

contextType

string

Required The access level of the SAP Concur user, which determines the form fields they can view/modify. Supported values: TRAVELER.

fileContent

file

Required The quick expense image. Maximum size 50 MB. Supported image types are: PNG, PDF, TIFF, JPEG

Creating a quick expense with an image requires a multi-part form.

You can use the same format for the body as the previous example. A key value is added for the body titled “quickExpenseRequest”.

{
  "comment": "Team Lunch to Discuss Quick Expense",
  "expenseTypeId": "MEALS",
  "location": {
       "city": "New York",
       "countryCode": "US",
       "countrySubDivisionCode": "US-NY"
  },
  "paymentTypeId": "CASHX",
  "transactionAmount": {
       "currencyCode": "USD",
       "value": 33.87
  },
  "transactionDate": "2024-12-27",
  "vendor": "Good Restaurant"
}

A key value is also added for the body titled “fileContent”. The image that you wish to load should then be specified.

Example of the results using the above quickExpenseRequest payload and a fileContent image:

davidblank_1-1736182648768.png

This is what the expense will appear as in Concur.

davidblank_1-1736182276480.png

davidblank_2-1736182291374.png

davidblank_0-1736179437123.png

Conclusion

The Quick Expense API can easily be used to create expenses that can be assigned to a user. There can be significant time savings gained by using this API whether it is utilized to create test transactions or create transactions that could not be created by a card vendor.

davidblank_0-1736179437123.png

Share and Connect

What do you think?  Do you have anything to add? Leave a comment below.

Did you find it useful? Give us a like and share on social media.

Want to know more about SAP Concur? Please follow here.

Want to ask questions about SAP Concur and its offerings? Ask here

Follow my profile for similar content.

Thank you!