Upload Report Details

To Upload the expense report details for ingestion. Call this API after all the required attachments are uploaded into the system.  You need to specify the external_report_id. For calling the API, you will need the access token

The file_id field which you got as part of the response when you called Generate the URL to Upload Attachment needs to be passed in the request body.  Submit this as the value for the elimageid[] parameter.


Request URI 

PUT https://api.appzen.com/expense-ingestion/reports/{{external_report_id}}


Header Parameters

Name Type Description Required
Authorization String The valid token to authorize the request. Yes

 

Path Parameters

Name Type Description Required
external_report_id String The External report id.  Yes

 

Body Parameters

Name

Type

Description

Required

reportNumber

String

This is the root element to hold the details of a report being ingested. Values should be as a String

Yes

amount

String

Total amount.

Yes

userName

String

This field should be populated with 'last name, first name'

Yes

userid

String

This field needs to be populated with the value of employee id.

Yes

emailAddress

String

User's email id.

Yes

externalOrgId

String

This field is required, when new organization needs to be created by AppZen system.

No

externalOrgName

String

This field is required, when new organization needs to be created by AppZen system.

No

external_template_id

String

This field is required, when new template needs to be created by AppZen system.

Either send template_id and template_name or external_template_id and external_template_name

No

external_template_name

String

This field is required, when new template needs to be created by AppZen system.

No

template_name

String

A valid template_name provided by AppZen needs to be passed against this field.

No

templateId

String

A valid template_id provided by AppZen needs to be passed against this field. In case a valid template_id is not available, it needs to be skipped and valid template details need to be passed instead.

AppZen system looks-up for a valid template_id based on the the template details provided. It looks-up for a template defined/configured in the system for given 'external_template_name' or 'external_template_id

If no template is found to be defined/configured in the system for given external_template_id/external_template_id, then a new template gets created based on provided template details.In such a scenario, external_template_id and external_template_name are mandatory.

No

orgId

String

An organization is a way of segregation of expense.

For the source system having country and currency based org, only 'country' and 'currency_code' needs to be populated.

For the source system having name based org, either of below two combination is required to be populated:


'org_id' : Should be populated with the value provided by AppZen

Either send org_id and org_name or external_org_id and external_org_name]

 

reportLevelImage

String

Receipt Image at report level.

 

reportLevelImageArray

[String]

List of images at report level.

 

country

String

User's organization country code in ISO3 format.

Yes

countryCode

String

User's organization country code in ISO2 format.

No

curr

String

Organization currency/reimbursement currency ISO3.

Yes

date

String

Submission date of expense report.

Allowed formats:

yyyy-MM-dd'T'HH:mm:ss,

yyyy-MM-dd'T'HH:mm:ss.SSS,

yyyy-MM-dd'T'HH:mm:ss.SSSZ,

yyyy-MM-dd hh:mm:ss,

yyyy-MM-dd hh:mm:ss.SSS,

yyyy-MM-dd hh:mm:ss.SSSZ

Yes

desc

String

Description of the expense report.

No

status

String

Status of report in source expense system. workflow status in source system.

Yes

elines

NA

This is the root element to hold the information on the expense lines.

Yes

cardTransactionDetails 

NA

This is the root element to hold the information on the card through which the transaction was done.

Yes

AccountNumber

String

Account number associated with the card.

No

AccountNumberLastSegment

String

Last 4 digits of the card with which the transaction is made.

No

CardDescription

String

Description of the card.

No

CardProgramName

String

Card Program Name.

No

CardTypeCode

String

Type of credit card.

Example: 'Personal', 'Corporate'.

No

Description

String

The card transaction Description.

No

ExchangeRateFromBillingToEmployeeCurrency

String

Exchange Rate From Billing To Employee Currency.

No

MasterCardCode

String

Master Card Code.

No

MerchantCity

String

City to which Merchant belongs.

No

MerchantCountryCode

String

Country code of Merchant's Country in ISO2 format.

No

MerchantReferenceNumber

String

Reference number of a Merchant.

No

MerchantState

String

State to which Merchant belongs.

No

PostedAlphaCode

String

Posted Alpha Code.

No

PostedAmount

String

Posted Amount.

No

PostedDate

String

Posted Date.

No

SIC_Code

String

SIC Code.

No

TaxAmount

String

Total Tax amount.

No

TransactionAlphaCode

String

Transaction Alpha Code.

No

TransactionAmount

String

The amount paid in the transaction.

No

TransactionCCTType

String

Transaction CCT Type.

No

TransactionDate

String

The date of the transaction.

No

TransactionID

String

Unique id for the transaction.

No

TransactionMerchantName

String

The merchant name for which the transaction is made.

No

TransactionReferenceNumber

String

The reference number of the transaction made by the credit card.

No

merchantId

Integer

The unique id of the merchant.

No

comments

String

The line-level comments entered by the user.

No

elExternalLineId

String

The unique number is attached to each expense line.

No

elImageDetails

Array

Extension of all line-level attachment files. Example: For image1.jpeg - jpeg is added to this array.

No

imageId

String

AppZen generated id for the image.

No

imageType

String

The following types are supported:

PDF, JPEG, JPG, PNG and TIFF are supported by default for all the customers.

No

elItemizedFlag

String

Set it as true, if the current line is a child line/itemized line

"false": If the flag is NOT to be set,

"true": If the flag is to be set.

Yes

elItemizedLineNumber

String

The line number for the child/itemized line.

No

elParentLineNumber

String

The elineid of the parent line if the current line id is the child line. 

No

elallocs

 

This is the root that holds the information on expense line allocation.

Use custom1 — custom25 for your details.


Note:

Cost center details should be populated against the field 'custom3'.

No

amount

String

This is the root for holding the amount details.

No

elcostcenter 

String

This is the root for holding the cost center details - fieldName, text, value. Custom3 field

No

elamount

String

Total Reimbursement amount.

Yes

elattendees

NA

This is the root element to hold details of the attendees of an expense line.

Yes

amountByAttendee

String

Amount per attendee.

No

attendeeCount

Integer

Total count of the attendees.

No

attendeeType

String

Type of attendee.

No

elExternalAttendeeId

String

External Attendee ID.

No

elineId

String

unique sequence for that expense line.

No

employeeFlag

String

Checks if the attendee is an employee.

No

employeeId

string

ID if the employee.

No

employer

String

Name of the employer.

No

employerAddr

String

Address of the Employer.

No

name

String

Name of the attendee.

No

orgId

String

Organization Id.

No

taxId

String

Tax Id.

No

title

String

Title of the Employee.

No

elconvrate

String

Conversion rate from the transaction- currency to reimbursement currency.

No

elcurr

String

Reimbursement currency.

Yes

eldate

String

The date when the expense was made. 

Allowed formats: yyyy-MM-dd'T'HH:mm:ss, yyyy-MM-dd'T'HH:mm:ss.SSS, yyyy-MM-dd'T'HH:mm:ss.SSSZ, yyyy-MM-dd hh:mm:ss, yyyy-MM-dd hh:mm:ss.SSS, yyyy-MM-dd hh:mm:ss.SSSZ

Yes

elineid

String

The 1 based index for expense lines.

Unique sequence for that expense line.

Yes

elineinfo

String

Expense line information.

No

elinetype

String

Payment type. e.g. CASH, CREDIT etc

Yes

elmileagedist

String

Expense line mileage distance.

No

elmileagerate

String

Expense line mileage rate.

No

elmileageuom

String

Expense line mileage unit of measure.

No

elpaidamount

String

The total amount in transaction currency i.e. the amount in currency paid to the vendor.

Yes

elpaidcurr

String

Transaction currency.

Yes

elpersonalflag

String

Y if the expense is personal


"N": If the flag is NOT to be set,

"Y": If the flag is to be set.

Yes

elpurpose

String

Justification for this expense line.

Yes

eltype

String

Expense type. e.g. Meals, Taxi, Hotel etc.

No

elvatflag

String

This is True if the expense is VAT line


"false": If the flag is NOT to be set,

"true": If the flag is to be set.

Yes

missingReceipt

String

is N if the receipt is attached


"N": If the flag is NOT to be set,

"Y": If the flag is to be set.

Yes

report_level_image_details_array

NA

This is the root element to hold Extension of all header level attachment files.

Example: for image1.jpeg, jpeg should be added to this array.

 

imageId

String

The Receipt Image ID.

No

imageType

String

The image type. Types Supported are:

JPEG. JPG, PNG and PDF.

For other types, additional work will be required and have to do a feasibility check on supporting that file type.

No

custom1 — custom25

String

Values of custom field

No

Addendum 

Binary

True - if it is a modification in an existing report, False - otherwise

No

 

Sample Request

curl -L -X PUT 'https: //api.appzen.com/expense-ingestion/reports/TestAPIReport' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer eyJrxxxx' \
-H 'Cookie: JSESSIONID=B663D6B89CB2D7A4BE1A91D80A2D0599' \
--data-raw '{
    "expense_report": {
        "date": "2022-12-26T01:06:27",
        "country": "US",
        "amount": "1200.0",
        "report_name": "TestAPIReport",
        "last_updated_at": "2020-12-26T01:23:57.014Z",
        "elines": [
            {
                "el_type": "Hotel Room Charges 001 New",
                "el_curr": "USD",
                "missing_receipt": "N",
                "expense_line_iId": 1,
                "elItemizedFlag": "false",
                "eldetails": [],
                "elamount": "1200.00",
                "elpaidamount": "1200.00",
                "elpurpose": "Expense Link Description",
                "eldate": "2020-12-01T14:23:57.014",
                "eline_id": "1",
                "elpaidcurr": "USD",
                "elconvrate": "0.145507246376813",
                "elinetype": "CREDIT",
                "elpersonalflag": "N",
                "elcostcenter": "605",
                "elvatflag": "false",
                "elimageid": [
                    "f06657f4-9edf-4429-88cf-f3e918c8dd43"
                ]
            }
        ],
        "external_template_id": "external_template_name_trial_44",
        "template_id": "20016792",
        "userName": "API Doc Test",
        "userid": "Apidoctest@appzen.com",
        "createdAt": "2022-12-26T14:06:27",
        "emailAddress": "Apidoctest@appzen.com",
        "countryCode": "US",
        "customerId": "100439",
        "curr": "USD",
        "desc": "Test Report Ingested via API Auto",
        "status": "AppZen-Review"
    }
}


Sample Response

Success

{
    "Status": "Success",
    "msg": "Successfully processed submitted report"
}

Failure

The request fails if you enter an invalid customer id.

{
    "Status": "Failure",
    "msg": "Following fields are mandatory: matching customerId."
}


Response Code

Response Code Description
200 The request is successful.
500 The request failed.


See Also

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.