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.
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:
Optional Scope:
Works with these SAP Concur solutions:
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.
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:
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:
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:
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:
This is what the expense will appear as in Concur.
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:
This is what the expense will appear as in Concur.
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.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 22 | |
| 18 | |
| 16 | |
| 15 | |
| 10 | |
| 8 | |
| 8 | |
| 7 | |
| 3 | |
| 3 |