(accounting.expenses)
- list - List Expenses
- create - Create Expense
- get - Get Expense
- update - Update Expense
- delete - Delete Expense
List Expenses
from apideck_unify import Apideck
import os
with Apideck(
api_key=os.getenv("APIDECK_API_KEY", ""),
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:
res = apideck.accounting.expenses.list(raw=False, consumer_id="test-consumer", app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", service_id="salesforce", limit=20)
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 | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.AccountingExpensesAllResponse
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
import apideck_unify
from apideck_unify import Apideck
import dateutil.parser
import os
with Apideck(
api_key=os.getenv("APIDECK_API_KEY", ""),
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:
res = apideck.accounting.expenses.create(transaction_date=dateutil.parser.isoparse("2021-05-01T12:00:00.000Z"), account_id="123456", line_items=[
{
"total_amount": 275,
"tracking_categories": [
{
"id": "123456",
"name": "New York",
},
{
"id": "123456",
"name": "New York",
},
],
"account_id": "123456",
"customer_id": "12345",
"department_id": "12345",
"location_id": "12345",
"tax_rate": {
"id": "123456",
"rate": 10,
},
"description": "Travel US.",
"billable": True,
},
], raw=False, consumer_id="test-consumer", app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", service_id="salesforce", number="OIT00546", customer_id="12345", supplier_id="12345", company_id="12345", department_id="12345", payment_type=apideck_unify.ExpensePaymentType.CASH, currency=apideck_unify.Currency.USD, currency_rate=0.69, type_=apideck_unify.ExpenseType.EXPENSE, memo="For travel expenses incurred on 2024-05-15", tax_rate={
"id": "123456",
"rate": 10,
}, total_amount=275, custom_fields=[
{
"id": "2389328923893298",
"name": "employee_level",
"description": "Employee Level",
"value": "Uses Salesforce and Marketo",
},
{
"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",
},
},
},
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
"service_id": "<id>",
"extend_paths": [
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
"service_id": "<id>",
"extend_paths": [
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
])
assert res.create_expense_response is not None
# Handle response
print(res.create_expense_response)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
transaction_date |
date | ✔️ | The date of the transaction - YYYY:MM::DDThh:mm:ss.sTZD | 2021-05-01T12:00:00.000Z |
account_id |
str | ✔️ | The unique identifier for the ledger account that this expense should be credited to. | 123456 |
line_items |
List[models.ExpenseLineItemInput] | ✔️ | Expense line items linked to this expense. | |
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 |
number |
OptionalNullable[str] | ➖ | Number. | OIT00546 |
customer_id |
Optional[str] | ➖ | The ID of the customer this entity is linked to. Used for expenses that should be marked as billable to customers. | 12345 |
supplier_id |
Optional[str] | ➖ | The ID of the supplier this entity is linked to. | 12345 |
company_id |
OptionalNullable[str] | ➖ | The company or subsidiary id the transaction belongs to | 12345 |
department_id |
Optional[str] | ➖ | The ID of the department this expense is linked to. | 12345 |
payment_type |
OptionalNullable[models.ExpensePaymentType] | ➖ | The type of payment for the expense. | cash |
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 |
type |
OptionalNullable[models.ExpenseType] | ➖ | The type of expense. | expense |
memo |
OptionalNullable[str] | ➖ | The memo of the expense. | For travel expenses incurred on 2024-05-15 |
tax_rate |
Optional[models.LinkedTaxRateInput] | ➖ | N/A | |
total_amount |
OptionalNullable[float] | ➖ | The total amount of the expense line item. | 275 |
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.AccountingExpensesAddResponse
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
from apideck_unify import Apideck
import os
with Apideck(
api_key=os.getenv("APIDECK_API_KEY", ""),
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:
res = apideck.accounting.expenses.get(id="<id>", consumer_id="test-consumer", app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", service_id="salesforce", raw=False)
assert res.get_expense_response is not None
# Handle response
print(res.get_expense_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.AccountingExpensesOneResponse
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
import apideck_unify
from apideck_unify import Apideck
import dateutil.parser
import os
with Apideck(
api_key=os.getenv("APIDECK_API_KEY", ""),
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:
res = apideck.accounting.expenses.update(id="<id>", transaction_date=dateutil.parser.isoparse("2021-05-01T12:00:00.000Z"), account_id="123456", line_items=[
{
"total_amount": 275,
"tracking_categories": [
{
"id": "123456",
"name": "New York",
},
{
"id": "123456",
"name": "New York",
},
],
"account_id": "123456",
"customer_id": "12345",
"department_id": "12345",
"location_id": "12345",
"tax_rate": {
"id": "123456",
"rate": 10,
},
"description": "Travel US.",
"billable": True,
},
{
"total_amount": 275,
"tracking_categories": [
{
"id": "123456",
"name": "New York",
},
{
"id": "123456",
"name": "New York",
},
],
"account_id": "123456",
"customer_id": "12345",
"department_id": "12345",
"location_id": "12345",
"tax_rate": {
"id": "123456",
"rate": 10,
},
"description": "Travel US.",
"billable": True,
},
{
"total_amount": 275,
"tracking_categories": [
{
"id": "123456",
"name": "New York",
},
{
"id": "123456",
"name": "New York",
},
{
"id": "123456",
"name": "New York",
},
],
"account_id": "123456",
"customer_id": "12345",
"department_id": "12345",
"location_id": "12345",
"tax_rate": {
"id": "123456",
"rate": 10,
},
"description": "Travel US.",
"billable": True,
},
], consumer_id="test-consumer", app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", service_id="salesforce", raw=False, number="OIT00546", customer_id="12345", supplier_id="12345", company_id="12345", department_id="12345", payment_type=apideck_unify.ExpensePaymentType.CASH, currency=apideck_unify.Currency.USD, currency_rate=0.69, type_=apideck_unify.ExpenseType.EXPENSE, memo="For travel expenses incurred on 2024-05-15", tax_rate={
"id": "123456",
"rate": 10,
}, total_amount=275, custom_fields=[
{
"id": "2389328923893298",
"name": "employee_level",
"description": "Employee Level",
"value": True,
},
{
"id": "2389328923893298",
"name": "employee_level",
"description": "Employee Level",
"value": {},
},
], row_version="1-12345", pass_through=[
{
"service_id": "<id>",
"extend_paths": [
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
"service_id": "<id>",
"extend_paths": [
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
{
"service_id": "<id>",
"extend_paths": [
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
])
assert res.update_expense_response is not None
# Handle response
print(res.update_expense_response)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
str | ✔️ | ID of the record you are acting upon. | |
transaction_date |
date | ✔️ | The date of the transaction - YYYY:MM::DDThh:mm:ss.sTZD | 2021-05-01T12:00:00.000Z |
account_id |
str | ✔️ | The unique identifier for the ledger account that this expense should be credited to. | 123456 |
line_items |
List[models.ExpenseLineItemInput] | ✔️ | Expense line items linked to this expense. | |
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 | |
number |
OptionalNullable[str] | ➖ | Number. | OIT00546 |
customer_id |
Optional[str] | ➖ | The ID of the customer this entity is linked to. Used for expenses that should be marked as billable to customers. | 12345 |
supplier_id |
Optional[str] | ➖ | The ID of the supplier this entity is linked to. | 12345 |
company_id |
OptionalNullable[str] | ➖ | The company or subsidiary id the transaction belongs to | 12345 |
department_id |
Optional[str] | ➖ | The ID of the department this expense is linked to. | 12345 |
payment_type |
OptionalNullable[models.ExpensePaymentType] | ➖ | The type of payment for the expense. | cash |
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 |
type |
OptionalNullable[models.ExpenseType] | ➖ | The type of expense. | expense |
memo |
OptionalNullable[str] | ➖ | The memo of the expense. | For travel expenses incurred on 2024-05-15 |
tax_rate |
Optional[models.LinkedTaxRateInput] | ➖ | N/A | |
total_amount |
OptionalNullable[float] | ➖ | The total amount of the expense line item. | 275 |
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.AccountingExpensesUpdateResponse
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
from apideck_unify import Apideck
import os
with Apideck(
api_key=os.getenv("APIDECK_API_KEY", ""),
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:
res = apideck.accounting.expenses.delete(id="<id>", consumer_id="test-consumer", app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", service_id="salesforce", raw=False)
assert res.delete_expense_response is not None
# Handle response
print(res.delete_expense_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.AccountingExpensesDeleteResponse
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 | */* |