(accounting.expense_categories)
- list - List Expense Categories
- create - Create Expense Category
- get - Get Expense Category
- update - Update Expense Category
- delete - Delete Expense Category
List Expense Categories
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_categories.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.ExpenseCategoriesFilterStatus.ACTIVE,
})
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.ExpenseCategoriesFilter] | ➖ | Apply filters | { "updated_since": "2020-09-30T07:43:32.000Z", "status": "active" } |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.AccountingExpenseCategoriesAllResponse
| 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 Category
import apideck_unify
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_categories.create(name="Travel", raw=False, service_id="salesforce", display_id="123456", code="TRAVEL-001", description="Travel-related expenses including flights, hotels, and ground transportation.", status=apideck_unify.ExpenseCategoryStatus.ACTIVE, account={
"id": "123456",
"name": "Bank account",
"nominal_code": "N091",
"code": "453",
"parent_id": "123456",
"display_id": "123456",
}, offset_account={
"id": "123456",
"name": "Bank account",
"nominal_code": "N091",
"code": "453",
"parent_id": "123456",
"display_id": "123456",
}, tax_rate={
"id": "123456",
"code": "N-T",
"rate": 10,
}, rate_required=False, default_rate=0.67, 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_category_response is not None
# Handle response
print(res.create_expense_category_response)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
name |
str | ✔️ | The name of the expense category. | Travel |
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 |
code |
OptionalNullable[str] | ➖ | The code or external identifier of the expense category. | TRAVEL-001 |
description |
OptionalNullable[str] | ➖ | The description of the expense category. | Travel-related expenses including flights, hotels, and ground transportation. |
status |
OptionalNullable[models.ExpenseCategoryStatus] | ➖ | The status of the expense category. | active |
account |
OptionalNullable[models.LinkedLedgerAccount] | ➖ | N/A | |
offset_account |
OptionalNullable[models.LinkedLedgerAccount] | ➖ | N/A | |
tax_rate |
Optional[models.LinkedTaxRateInput] | ➖ | N/A | |
rate_required |
OptionalNullable[bool] | ➖ | Whether the expense category requires rate/quantity entry (e.g. mileage at $/mile). | false |
default_rate |
OptionalNullable[float] | ➖ | Default rate when rate_required is true (e.g. 0.67 for mileage). | 0.67 |
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.AccountingExpenseCategoriesAddResponse
| 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 Category
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_categories.get(id="<id>", service_id="salesforce", raw=False, fields="id,updated_at")
assert res.get_expense_category_response is not None
# Handle response
print(res.get_expense_category_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.AccountingExpenseCategoriesOneResponse
| 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 Category
import apideck_unify
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_categories.update(id="<id>", name="Travel", service_id="salesforce", raw=False, display_id="123456", code="TRAVEL-001", description="Travel-related expenses including flights, hotels, and ground transportation.", status=apideck_unify.ExpenseCategoryStatus.ACTIVE, account={
"id": "123456",
"name": "Bank account",
"nominal_code": "N091",
"code": "453",
"parent_id": "123456",
"display_id": "123456",
}, offset_account={
"id": "123456",
"name": "Bank account",
"nominal_code": "N091",
"code": "453",
"parent_id": "123456",
"display_id": "123456",
}, tax_rate={
"id": "123456",
"code": "N-T",
"rate": 10,
}, rate_required=False, default_rate=0.67, 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_category_response is not None
# Handle response
print(res.update_expense_category_response)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
id |
str | ✔️ | ID of the record you are acting upon. | |
name |
str | ✔️ | The name of the expense category. | Travel |
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 |
code |
OptionalNullable[str] | ➖ | The code or external identifier of the expense category. | TRAVEL-001 |
description |
OptionalNullable[str] | ➖ | The description of the expense category. | Travel-related expenses including flights, hotels, and ground transportation. |
status |
OptionalNullable[models.ExpenseCategoryStatus] | ➖ | The status of the expense category. | active |
account |
OptionalNullable[models.LinkedLedgerAccount] | ➖ | N/A | |
offset_account |
OptionalNullable[models.LinkedLedgerAccount] | ➖ | N/A | |
tax_rate |
Optional[models.LinkedTaxRateInput] | ➖ | N/A | |
rate_required |
OptionalNullable[bool] | ➖ | Whether the expense category requires rate/quantity entry (e.g. mileage at $/mile). | false |
default_rate |
OptionalNullable[float] | ➖ | Default rate when rate_required is true (e.g. 0.67 for mileage). | 0.67 |
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.AccountingExpenseCategoriesUpdateResponse
| 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 Category
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_categories.delete(id="<id>", service_id="salesforce", raw=False)
assert res.delete_expense_category_response is not None
# Handle response
print(res.delete_expense_category_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.AccountingExpenseCategoriesDeleteResponse
| 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 | */* |