(accounting.expense_reports)
- list - List Expense Reports
- create - Create Expense Report
- get - Get Expense Report
- update - Update Expense Report
- delete - Delete Expense Report
List Expense Reports
import apideck_unify
from apideck_unify import Apideck
from apideck_unify.utils import parse_datetime
import os
with Apideck(
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:
res = apideck.accounting.expense_reports.list(raw=False, service_id="salesforce", limit=20, fields="id,updated_at", filter_={
"updated_since": parse_datetime("2020-09-30T07:43:32.000Z"),
"status": apideck_unify.ExpenseReportsFilterStatus.SUBMITTED,
})
while res is not None:
# Handle items
res = res.next()| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
raw |
Optional[bool] | ➖ | Include raw response. Mostly used for debugging purposes | |
consumer_id |
Optional[str] | ➖ | ID of the consumer which you want to get or push data from | test-consumer |
app_id |
Optional[str] | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
service_id |
Optional[str] | ➖ | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. | salesforce |
cursor |
OptionalNullable[str] | ➖ | Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. | |
limit |
Optional[int] | ➖ | Number of results to return. Minimum 1, Maximum 200, Default 20 | |
fields |
OptionalNullable[str] | ➖ | The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation. Example: fields=name,email,addresses.cityIn the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded. |
id,updated_at |
filter_ |
Optional[models.ExpenseReportsFilter] | ➖ | Apply filters | { "updated_since": "2020-09-30T07:43:32.000Z", "status": "submitted" } |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.AccountingExpenseReportsAllResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.BadRequestResponse | 400 | application/json |
| models.UnauthorizedResponse | 401 | application/json |
| models.PaymentRequiredResponse | 402 | application/json |
| models.NotFoundResponse | 404 | application/json |
| models.UnprocessableResponse | 422 | application/json |
| models.APIError | 4XX, 5XX | */* |
Create Expense Report
import apideck_unify
from apideck_unify import Apideck
from apideck_unify.utils import parse_datetime
from datetime import date
import os
with Apideck(
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:
res = apideck.accounting.expense_reports.create(employee={
"id": "12345",
"display_name": "John Doe",
}, transaction_date=parse_datetime("2021-05-01T12:00:00.000Z"), line_items=[], raw=False, service_id="salesforce", display_id="123456", number="ER-001", title="Q1 Business Travel", status=apideck_unify.ExpenseReportStatus.SUBMITTED, posting_date=date.fromisoformat("2024-06-01"), due_date=date.fromisoformat("2024-06-15"), currency=apideck_unify.Currency.USD, currency_rate=0.69, sub_total=250, total_tax=25, total_amount=1250.75, reimbursable_amount=1100, memo="Business travel expenses for Q1 client meetings", department={
"display_id": "123456",
"name": "Acme Inc.",
}, location={
"id": "123456",
"display_id": "123456",
"name": "New York Office",
}, account=None, accounting_period={
"id": "12345",
"name": "Q1 2024",
}, subsidiary={
"display_id": "123456",
"name": "Acme Inc.",
}, tracking_categories=[
{
"id": "123456",
"code": "100",
"name": "New York",
"parent_id": "123456",
"parent_name": "New York",
},
], tax_inclusive=True, approved_by={
"id": "12345",
"display_name": "Jane Smith",
}, custom_fields=[
{
"id": "2389328923893298",
"name": "employee_level",
"description": "Employee Level",
"value": "Uses Salesforce and Marketo",
},
], row_version="1-12345", pass_through=[
{
"service_id": "<id>",
"extend_paths": [
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
])
assert res.create_expense_report_response is not None
# Handle response
print(res.create_expense_report_response)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
employee |
models.ExpenseReportEmployee | ✔️ | The employee who submitted the expense report. | |
transaction_date |
date | ✔️ | The date of the transaction - YYYY:MM::DDThh:mm:ss.sTZD | 2021-05-01T12:00:00.000Z |
line_items |
List[models.ExpenseReportLineItemInput] | ✔️ | Expense line items linked to this expense report. | |
raw |
Optional[bool] | ➖ | Include raw response. Mostly used for debugging purposes | |
consumer_id |
Optional[str] | ➖ | ID of the consumer which you want to get or push data from | test-consumer |
app_id |
Optional[str] | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
service_id |
Optional[str] | ➖ | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. | salesforce |
display_id |
OptionalNullable[str] | ➖ | Id to be displayed. | 123456 |
number |
OptionalNullable[str] | ➖ | The expense report number. | ER-001 |
title |
OptionalNullable[str] | ➖ | Title or purpose of the expense report. | Q1 Business Travel |
status |
OptionalNullable[models.ExpenseReportStatus] | ➖ | The status of the expense report. | submitted |
posting_date |
datetime | ➖ | The date the expense report was posted to the general ledger. | 2024-06-01 |
due_date |
datetime | ➖ | Date when reimbursement is due. | 2024-06-15 |
currency |
OptionalNullable[models.Currency] | ➖ | Indicates the associated currency for an amount of money. Values correspond to ISO 4217. | USD |
currency_rate |
OptionalNullable[float] | ➖ | Currency Exchange Rate at the time entity was recorded/generated. | 0.69 |
sub_total |
OptionalNullable[float] | ➖ | Subtotal amount, normally before tax. | 250 |
total_tax |
OptionalNullable[float] | ➖ | Total tax amount applied to this transaction. | 25 |
total_amount |
OptionalNullable[float] | ➖ | Total amount of all expense lines including tax. | 1250.75 |
reimbursable_amount |
OptionalNullable[float] | ➖ | Total reimbursable amount (may differ from total if some expenses are non-reimbursable). | 1100 |
memo |
OptionalNullable[str] | ➖ | The memo of the expense report. | Business travel expenses for Q1 client meetings |
department |
OptionalNullable[models.LinkedDepartmentInput] | ➖ | N/A | |
location |
OptionalNullable[models.LinkedLocationInput] | ➖ | N/A | |
account |
OptionalNullable[models.LinkedLedgerAccount] | ➖ | N/A | |
accounting_period |
OptionalNullable[models.AccountingPeriod] | ➖ | The accounting period the expense report is posted to. | |
subsidiary |
OptionalNullable[models.LinkedSubsidiaryInput] | ➖ | N/A | |
tracking_categories |
List[Nullable[models.LinkedTrackingCategory]] | ➖ | A list of linked tracking categories. | |
tax_inclusive |
OptionalNullable[bool] | ➖ | Amounts are including tax | true |
approved_by |
OptionalNullable[models.ApprovedBy] | ➖ | The person who approved the expense report. | |
custom_fields |
List[models.CustomField] | ➖ | N/A | |
row_version |
OptionalNullable[str] | ➖ | A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. | 1-12345 |
pass_through |
List[models.PassThroughBody] | ➖ | The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.AccountingExpenseReportsAddResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.BadRequestResponse | 400 | application/json |
| models.UnauthorizedResponse | 401 | application/json |
| models.PaymentRequiredResponse | 402 | application/json |
| models.NotFoundResponse | 404 | application/json |
| models.UnprocessableResponse | 422 | application/json |
| models.APIError | 4XX, 5XX | */* |
Get Expense Report
from apideck_unify import Apideck
import os
with Apideck(
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:
res = apideck.accounting.expense_reports.get(id="<id>", service_id="salesforce", raw=False, fields="id,updated_at")
assert res.get_expense_report_response is not None
# Handle response
print(res.get_expense_report_response)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
id |
str | ✔️ | ID of the record you are acting upon. | |
consumer_id |
Optional[str] | ➖ | ID of the consumer which you want to get or push data from | test-consumer |
app_id |
Optional[str] | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
service_id |
Optional[str] | ➖ | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. | salesforce |
raw |
Optional[bool] | ➖ | Include raw response. Mostly used for debugging purposes | |
fields |
OptionalNullable[str] | ➖ | The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation. Example: fields=name,email,addresses.cityIn the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded. |
id,updated_at |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.AccountingExpenseReportsOneResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.BadRequestResponse | 400 | application/json |
| models.UnauthorizedResponse | 401 | application/json |
| models.PaymentRequiredResponse | 402 | application/json |
| models.NotFoundResponse | 404 | application/json |
| models.UnprocessableResponse | 422 | application/json |
| models.APIError | 4XX, 5XX | */* |
Update Expense Report
import apideck_unify
from apideck_unify import Apideck
from apideck_unify.utils import parse_datetime
from datetime import date
import os
with Apideck(
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:
res = apideck.accounting.expense_reports.update(id="<id>", employee={
"id": "12345",
"display_name": "John Doe",
}, transaction_date=parse_datetime("2021-05-01T12:00:00.000Z"), line_items=[], service_id="salesforce", raw=False, display_id="123456", number="ER-001", title="Q1 Business Travel", status=apideck_unify.ExpenseReportStatus.SUBMITTED, posting_date=date.fromisoformat("2024-06-01"), due_date=date.fromisoformat("2024-06-15"), currency=apideck_unify.Currency.USD, currency_rate=0.69, sub_total=250, total_tax=25, total_amount=1250.75, reimbursable_amount=1100, memo="Business travel expenses for Q1 client meetings", department={
"display_id": "123456",
"name": "Acme Inc.",
}, location={
"id": "123456",
"display_id": "123456",
"name": "New York Office",
}, account={
"id": "123456",
"name": "Bank account",
"nominal_code": "N091",
"code": "453",
"parent_id": "123456",
"display_id": "123456",
}, accounting_period={
"id": "12345",
"name": "Q1 2024",
}, subsidiary={
"display_id": "123456",
"name": "Acme Inc.",
}, tracking_categories=None, tax_inclusive=True, approved_by={
"id": "12345",
"display_name": "Jane Smith",
}, custom_fields=[
{
"id": "2389328923893298",
"name": "employee_level",
"description": "Employee Level",
"value": "Uses Salesforce and Marketo",
},
], row_version="1-12345", pass_through=[
{
"service_id": "<id>",
"extend_paths": [
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
])
assert res.update_expense_report_response is not None
# Handle response
print(res.update_expense_report_response)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
id |
str | ✔️ | ID of the record you are acting upon. | |
employee |
models.ExpenseReportEmployee | ✔️ | The employee who submitted the expense report. | |
transaction_date |
date | ✔️ | The date of the transaction - YYYY:MM::DDThh:mm:ss.sTZD | 2021-05-01T12:00:00.000Z |
line_items |
List[models.ExpenseReportLineItemInput] | ✔️ | Expense line items linked to this expense report. | |
consumer_id |
Optional[str] | ➖ | ID of the consumer which you want to get or push data from | test-consumer |
app_id |
Optional[str] | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
service_id |
Optional[str] | ➖ | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. | salesforce |
raw |
Optional[bool] | ➖ | Include raw response. Mostly used for debugging purposes | |
display_id |
OptionalNullable[str] | ➖ | Id to be displayed. | 123456 |
number |
OptionalNullable[str] | ➖ | The expense report number. | ER-001 |
title |
OptionalNullable[str] | ➖ | Title or purpose of the expense report. | Q1 Business Travel |
status |
OptionalNullable[models.ExpenseReportStatus] | ➖ | The status of the expense report. | submitted |
posting_date |
datetime | ➖ | The date the expense report was posted to the general ledger. | 2024-06-01 |
due_date |
datetime | ➖ | Date when reimbursement is due. | 2024-06-15 |
currency |
OptionalNullable[models.Currency] | ➖ | Indicates the associated currency for an amount of money. Values correspond to ISO 4217. | USD |
currency_rate |
OptionalNullable[float] | ➖ | Currency Exchange Rate at the time entity was recorded/generated. | 0.69 |
sub_total |
OptionalNullable[float] | ➖ | Subtotal amount, normally before tax. | 250 |
total_tax |
OptionalNullable[float] | ➖ | Total tax amount applied to this transaction. | 25 |
total_amount |
OptionalNullable[float] | ➖ | Total amount of all expense lines including tax. | 1250.75 |
reimbursable_amount |
OptionalNullable[float] | ➖ | Total reimbursable amount (may differ from total if some expenses are non-reimbursable). | 1100 |
memo |
OptionalNullable[str] | ➖ | The memo of the expense report. | Business travel expenses for Q1 client meetings |
department |
OptionalNullable[models.LinkedDepartmentInput] | ➖ | N/A | |
location |
OptionalNullable[models.LinkedLocationInput] | ➖ | N/A | |
account |
OptionalNullable[models.LinkedLedgerAccount] | ➖ | N/A | |
accounting_period |
OptionalNullable[models.AccountingPeriod] | ➖ | The accounting period the expense report is posted to. | |
subsidiary |
OptionalNullable[models.LinkedSubsidiaryInput] | ➖ | N/A | |
tracking_categories |
List[Nullable[models.LinkedTrackingCategory]] | ➖ | A list of linked tracking categories. | |
tax_inclusive |
OptionalNullable[bool] | ➖ | Amounts are including tax | true |
approved_by |
OptionalNullable[models.ApprovedBy] | ➖ | The person who approved the expense report. | |
custom_fields |
List[models.CustomField] | ➖ | N/A | |
row_version |
OptionalNullable[str] | ➖ | A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. | 1-12345 |
pass_through |
List[models.PassThroughBody] | ➖ | The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.AccountingExpenseReportsUpdateResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.BadRequestResponse | 400 | application/json |
| models.UnauthorizedResponse | 401 | application/json |
| models.PaymentRequiredResponse | 402 | application/json |
| models.NotFoundResponse | 404 | application/json |
| models.UnprocessableResponse | 422 | application/json |
| models.APIError | 4XX, 5XX | */* |
Delete Expense Report
from apideck_unify import Apideck
import os
with Apideck(
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
api_key=os.getenv("APIDECK_API_KEY", ""),
) as apideck:
res = apideck.accounting.expense_reports.delete(id="<id>", service_id="salesforce", raw=False)
assert res.delete_expense_report_response is not None
# Handle response
print(res.delete_expense_report_response)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
id |
str | ✔️ | ID of the record you are acting upon. | |
consumer_id |
Optional[str] | ➖ | ID of the consumer which you want to get or push data from | test-consumer |
app_id |
Optional[str] | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
service_id |
Optional[str] | ➖ | Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. | salesforce |
raw |
Optional[bool] | ➖ | Include raw response. Mostly used for debugging purposes | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.AccountingExpenseReportsDeleteResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| models.BadRequestResponse | 400 | application/json |
| models.UnauthorizedResponse | 401 | application/json |
| models.PaymentRequiredResponse | 402 | application/json |
| models.NotFoundResponse | 404 | application/json |
| models.UnprocessableResponse | 422 | application/json |
| models.APIError | 4XX, 5XX | */* |