tomek123
New Member - Level 1

Programmatically attaching receipt image to expense.

I’m working on an integration that uploads receipt images to Concur and then associates each image with the correct expense entry. I can successfully retrieve expenses and upload receipt images - but I’m struggling with the final step: attaching the uploaded image to the expense.

Here’s what I’ve tried and observed so far:

Retrieve expense entry (works fine)

curl -sS -H "Authorization: Bearer $TOKEN" \
"$BASE/expensereports/v4/users/$USER_ID/context/TRAVELER/reports/$REPORT_ID/expenses/$ENTRY_ID"

This returns the expected JSON with fields like receiptImageId: null and isImageRequired: true.

Upload receipt image (works fine)

curl -X POST "https://us2.api.concursolutions.com/api/v3.0/expense/receiptimages" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: image/png" \
  -F "file=@Receipt-20251008.png"

The upload succeeds and returns an ImageID like:

gWnJus1jbr9lkA4skeP4GfmF$s8aZMp1$sQHdZiqgKbNEdwJHCn27ESMXlE07Dozn4SgQ


DOESN'T WORK: Trying to associate receipt image with expense

I attempted several variants of the PATCH call, for example:

curl --location --request PATCH \
"https://us2.api.concursolutions.com/api/expense/expensereport/v4/users/$USER_ID/context/TRAVELER/reports/$REPORT_ID/expenses/$ENTRY_ID" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/merge-patch+json" \
--data-raw '{"receiptImageId": "gWnJus1jbr9lkA4skeP4GfmF$s8aZMp1$sQHdZiqgKbNEdwJHCn27ESMXlE07Dozn4SgQ"}'

and also tried the company-level route:

curl --location --request PATCH \
"https://us2.api.concursolutions.com/expensereports/v4/reports/$REPORT_ID/expenses/$ENTRY_ID" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/merge-patch+json" \
--data-raw '{"receiptImageId": "gWnJus1jbr9lkA4skeP4GfmF$s8dZMp1$sQHdZiqgKbNEdwJHCn27ESMXlE07Dozn4SgQ"}'

However:

  • The /expensereports/v4/... route returns 401 Unauthorized — “This endpoint is only accessible by a valid company JWT.”

  • The /api/expense/expensereport/v4/... route returns 403 Forbidden — even though my token has the expense.report.readwrite, receipts.writeonly, and IMAGE scopes.

 

This is the documentation I followed:

https://developer.concur.com/api-reference/expense/expense-report/v4.reports.html

…the PATCH operation seems valid for updating fields like receiptImageId. But the combination of 401/403 responses suggests this might depend on tenant enablement or API family configuration.

Questions

  1. What is the correct, supported method (for a user token) to associate an uploaded receipt image (from /api/v3.0/expense/receiptimages) with an expense entry?
  2. Should the association be done via Expense Report v4 PATCH, and if so:
    • What request body is expected?
    • Are there specific tenant-level flags or API configurations that must be enabled by the admin?
  3. When I attach a receipt manually in the web UI, the image ID looks different (possibly coming from a different backend, e.g., Spend Documents).
    • Is there a documented way to interchange or map between the IDs returned by the Receipt Images API and those shown in the UI?

Any clarification, examples, or working patterns from others who have implemented this successfully would be hugely appreciated.

 

0 REPLIES 0