Overview

In this guide, you will learn:

Before you get started

The Remote API has the capability to create already approved expenses, to update pending expenses to approve or decline them, and to show and list expenses. Each expense belongs to an employment, has an amount in a given currency, the date it was incurred, and a receipt file.

Before you get started, you’ll need to ensure that you know the employment_id.

Creating an Expense

When creating an expense in a different currency of the employment, for instance, a €100.00 expense that belongs to an American employment, it is possible to send the following request:

curl --location --request POST '<https://gateway.remote-sandbox.com/v1/expenses>' \\
--header 'Authorization: Bearer <your token>' \\
--header 'Content-Type: application/json' \\
--data-raw '{
    "employment_id": "7db936d5-ea9b-4e97-a1f3-4d94ca39c294",
    "amount": 10000,
    "category": "education_training",
    "currency": "EUR",
    "expense_date": "2023-01-10",
    "receipt": {
        "content": "UGVyaW9kI...DAsMCwwLDEwMCwwCg==",
        "name": "receipt.pdf"
    },
    "tax_amount": 0,
    "timezone": "Etc/UTC",
    "title": "Giving Constructive Feedback Training",
    "reviewed_at": "2023-02-10T00:00:00Z"
}'

Receipt

The receipt field represents the receipt of the purchase, which is required to create an expense. The file name and the content encoded in base64 define a receipt to be attached to the expense. The receipt is necessary to create an expense.

To get the base64-encoded file content via the command line, you can run:

$ base64 -i path/to/file.pdf
JVBERi0xLjQKJcOkw7zDtsP922jjaA+hXY1Wh1aNVo...Kc3RhcnR4cmVmCjEyNzg3CiUlRU9GCg==

The response will look like this:

{
    "data": {
        "expense": {
            "amount": 10000,
            "category": "education_training",
            "converted_amount": 10735,
            "converted_currency": {
                "code": "USD",
                "name": "United States Dollar",
                "symbol": "$"
            },
            "converted_tax_amount": 0,
            "currency": {
                "code": "EUR",
                "name": "European Euro",
                "symbol": "€"
            },
            "employment_id": "7db936d5-ea9b-4e97-a1f3-4d94ca39c294",
            "expense_date": "2023-01-10",
            "id": "c26257a7-1cb5-4cd1-bf76-3ed0a389979c",
            "invoice_period": null,
            "notes": null,
            "reason": null,
            "reviewed_at": "2023-02-10",
            "reviewer": {
                "user_email": "[email protected]",
                "user_id": "2f73619f-4970-4c23-a7bb-3d110a7e6cf2",
                "user_name": "Jane Smith"
            },
            "status": "approved",
            "tax_amount": 0,
            "title": "Giving Constructive Feedback Training 5"
        }
    }
}

In this example, we created an expense with the source currency in EUR but the amount was converted to USD, since it is an American worker. If the expense is in the same currency as the country the employment was created, the amount will be the same.