(accounting.customers)
- list - List Customers
- create - Create Customer
- get - Get Customer
- update - Update Customer
- delete - Delete Customer
List Customers
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.customers.list(service_id="salesforce", filter_={
"company_name": "SpaceX",
"display_name": "Elon Musk",
"first_name": "Elon",
"last_name": "Musk",
"email": "[email protected]",
"status": apideck_unify.CustomersFilterStatus.ACTIVE,
"updated_since": dateutil.parser.isoparse("2020-09-30T07:43:32.000Z"),
}, sort={
"by": apideck_unify.CustomersSortBy.UPDATED_AT,
"direction": apideck_unify.SortDirection.DESC,
}, pass_through={
"search": "San Francisco",
}, fields="id,updated_at")
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 | |
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 | |
filter_ |
Optional[models.CustomersFilter] | ➖ | Apply filters | { "company_name": "SpaceX", "display_name": "Elon Musk", "first_name": "Elon", "last_name": "Musk", "email": "[email protected]", "status": "active", "updated_since": "2020-09-30T07:43:32.000Z" } |
sort |
Optional[models.CustomersSort] | ➖ | Apply sorting | { "by": "updated_at", "direction": "desc" } |
pass_through |
Dict[str, Any] | ➖ | Optional unmapped key/values that will be passed through to downstream as query parameters. Ie: ?pass_through[search]=leads becomes ?search=leads | { "search": "San Francisco" } |
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.city In 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.AccountingCustomersAllResponse
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 Customer
import apideck_unify
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.customers.create(service_id="salesforce", display_id="EMP00101", display_name="Windsurf Shop", company_name="SpaceX", company_id="12345", title="CEO", first_name="Elon", middle_name="D.", last_name="Musk", suffix="Jr.", individual=True, project=False, addresses=[
{
"id": "123",
"type": apideck_unify.Type.PRIMARY,
"string": "25 Spring Street, Blackburn, VIC 3130",
"name": "HQ US",
"line1": "Main street",
"line2": "apt #",
"line3": "Suite #",
"line4": "delivery instructions",
"street_number": "25",
"city": "San Francisco",
"state": "CA",
"postal_code": "94104",
"country": "US",
"latitude": "40.759211",
"longitude": "-73.984638",
"county": "Santa Clara",
"contact_name": "Elon Musk",
"salutation": "Mr",
"phone_number": "111-111-1111",
"fax": "122-111-1111",
"email": "[email protected]",
"website": "https://elonmusk.com",
"notes": "Address notes or delivery instructions.",
"row_version": "1-12345",
},
], phone_numbers=[
{
"number": "111-111-1111",
"id": "12345",
"country_code": "1",
"area_code": "323",
"extension": "105",
"type": apideck_unify.PhoneNumberType.PRIMARY,
},
{
"number": "111-111-1111",
"id": "12345",
"country_code": "1",
"area_code": "323",
"extension": "105",
"type": apideck_unify.PhoneNumberType.PRIMARY,
},
], emails=[
{
"email": "[email protected]",
"id": "123",
"type": apideck_unify.EmailType.PRIMARY,
},
], websites=[
{
"url": "http://example.com",
"id": "12345",
"type": apideck_unify.WebsiteType.PRIMARY,
},
], bank_accounts=[
{
"bank_name": "Monzo",
"account_number": "123465",
"account_name": "SPACEX LLC",
"account_type": apideck_unify.AccountType.CREDIT_CARD,
"iban": "CH2989144532982975332",
"bic": "AUDSCHGGXXX",
"routing_number": "012345678",
"bsb_number": "062-001",
"branch_identifier": "001",
"bank_code": "BNH",
"currency": apideck_unify.Currency.USD,
},
], notes="Some notes about this customer", tax_rate={
"id": "123456",
"rate": 10,
}, tax_number="US123945459", currency=apideck_unify.Currency.USD, account={
"id": "123456",
"nominal_code": "N091",
"code": "453",
}, parent={
"id": "12345",
"name": "Windsurf Shop",
}, status=apideck_unify.CustomerStatusStatus.ACTIVE, payment_method="cash", channel="email", custom_fields=[
{
"id": "2389328923893298",
"name": "employee_level",
"description": "Employee Level",
"value": True,
},
], 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_customer_response is not None
# Handle response
print(res.create_customer_response)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
raw |
Optional[bool] | ➖ | Include raw response. Mostly used for debugging purposes | |
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] | ➖ | Display ID | EMP00101 |
display_name |
OptionalNullable[str] | ➖ | Display name | Windsurf Shop |
company_name |
OptionalNullable[str] | ➖ | The name of the company. | SpaceX |
company_id |
OptionalNullable[str] | ➖ | The company or subsidiary id the transaction belongs to | 12345 |
title |
OptionalNullable[str] | ➖ | The job title of the person. | CEO |
first_name |
OptionalNullable[str] | ➖ | The first name of the person. | Elon |
middle_name |
OptionalNullable[str] | ➖ | Middle name of the person. | D. |
last_name |
OptionalNullable[str] | ➖ | The last name of the person. | Musk |
suffix |
OptionalNullable[str] | ➖ | N/A | Jr. |
individual |
OptionalNullable[bool] | ➖ | Is this an individual or business customer | true |
project |
OptionalNullable[bool] | ➖ | If true, indicates this is a Project. | false |
addresses |
List[models.Address] | ➖ | N/A | |
phone_numbers |
List[models.PhoneNumber] | ➖ | N/A | |
emails |
List[models.Email] | ➖ | N/A | |
websites |
List[models.Website] | ➖ | N/A | |
bank_accounts |
List[models.BankAccount] | ➖ | N/A | |
notes |
OptionalNullable[str] | ➖ | Some notes about this customer | Some notes about this customer |
tax_rate |
Optional[models.LinkedTaxRateInput] | ➖ | N/A | |
tax_number |
OptionalNullable[str] | ➖ | N/A | US123945459 |
currency |
OptionalNullable[models.Currency] | ➖ | Indicates the associated currency for an amount of money. Values correspond to ISO 4217. | USD |
account |
OptionalNullable[models.LinkedLedgerAccountInput] | ➖ | N/A | |
parent |
OptionalNullable[models.LinkedParentCustomer] | ➖ | The parent customer this entity is linked to. | |
status |
OptionalNullable[models.CustomerStatusStatus] | ➖ | Customer status | active |
payment_method |
OptionalNullable[str] | ➖ | Payment method used for the transaction, such as cash, credit card, bank transfer, or check | cash |
channel |
OptionalNullable[str] | ➖ | The channel through which the transaction is processed. | |
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.AccountingCustomersAddResponse
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 Customer
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.customers.get(id="<id>", service_id="salesforce", fields="id,updated_at")
assert res.get_customer_response is not None
# Handle response
print(res.get_customer_response)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
str | ✔️ | ID of the record you are acting upon. | |
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.city In 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.AccountingCustomersOneResponse
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 Customer
import apideck_unify
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.customers.update(id="<id>", service_id="salesforce", display_id="EMP00101", display_name="Windsurf Shop", company_name="SpaceX", company_id="12345", title="CEO", first_name="Elon", middle_name="D.", last_name="Musk", suffix="Jr.", individual=True, project=False, addresses=[
{
"id": "123",
"type": apideck_unify.Type.PRIMARY,
"string": "25 Spring Street, Blackburn, VIC 3130",
"name": "HQ US",
"line1": "Main street",
"line2": "apt #",
"line3": "Suite #",
"line4": "delivery instructions",
"street_number": "25",
"city": "San Francisco",
"state": "CA",
"postal_code": "94104",
"country": "US",
"latitude": "40.759211",
"longitude": "-73.984638",
"county": "Santa Clara",
"contact_name": "Elon Musk",
"salutation": "Mr",
"phone_number": "111-111-1111",
"fax": "122-111-1111",
"email": "[email protected]",
"website": "https://elonmusk.com",
"notes": "Address notes or delivery instructions.",
"row_version": "1-12345",
},
{
"id": "123",
"type": apideck_unify.Type.PRIMARY,
"string": "25 Spring Street, Blackburn, VIC 3130",
"name": "HQ US",
"line1": "Main street",
"line2": "apt #",
"line3": "Suite #",
"line4": "delivery instructions",
"street_number": "25",
"city": "San Francisco",
"state": "CA",
"postal_code": "94104",
"country": "US",
"latitude": "40.759211",
"longitude": "-73.984638",
"county": "Santa Clara",
"contact_name": "Elon Musk",
"salutation": "Mr",
"phone_number": "111-111-1111",
"fax": "122-111-1111",
"email": "[email protected]",
"website": "https://elonmusk.com",
"notes": "Address notes or delivery instructions.",
"row_version": "1-12345",
},
{
"id": "123",
"type": apideck_unify.Type.PRIMARY,
"string": "25 Spring Street, Blackburn, VIC 3130",
"name": "HQ US",
"line1": "Main street",
"line2": "apt #",
"line3": "Suite #",
"line4": "delivery instructions",
"street_number": "25",
"city": "San Francisco",
"state": "CA",
"postal_code": "94104",
"country": "US",
"latitude": "40.759211",
"longitude": "-73.984638",
"county": "Santa Clara",
"contact_name": "Elon Musk",
"salutation": "Mr",
"phone_number": "111-111-1111",
"fax": "122-111-1111",
"email": "[email protected]",
"website": "https://elonmusk.com",
"notes": "Address notes or delivery instructions.",
"row_version": "1-12345",
},
], phone_numbers=[
{
"number": "111-111-1111",
"id": "12345",
"country_code": "1",
"area_code": "323",
"extension": "105",
"type": apideck_unify.PhoneNumberType.PRIMARY,
},
{
"number": "111-111-1111",
"id": "12345",
"country_code": "1",
"area_code": "323",
"extension": "105",
"type": apideck_unify.PhoneNumberType.PRIMARY,
},
], emails=[
{
"email": "[email protected]",
"id": "123",
"type": apideck_unify.EmailType.PRIMARY,
},
], websites=[
{
"url": "http://example.com",
"id": "12345",
"type": apideck_unify.WebsiteType.PRIMARY,
},
{
"url": "http://example.com",
"id": "12345",
"type": apideck_unify.WebsiteType.PRIMARY,
},
{
"url": "http://example.com",
"id": "12345",
"type": apideck_unify.WebsiteType.PRIMARY,
},
], bank_accounts=[
{
"bank_name": "Monzo",
"account_number": "123465",
"account_name": "SPACEX LLC",
"account_type": apideck_unify.AccountType.CREDIT_CARD,
"iban": "CH2989144532982975332",
"bic": "AUDSCHGGXXX",
"routing_number": "012345678",
"bsb_number": "062-001",
"branch_identifier": "001",
"bank_code": "BNH",
"currency": apideck_unify.Currency.USD,
},
{
"bank_name": "Monzo",
"account_number": "123465",
"account_name": "SPACEX LLC",
"account_type": apideck_unify.AccountType.CREDIT_CARD,
"iban": "CH2989144532982975332",
"bic": "AUDSCHGGXXX",
"routing_number": "012345678",
"bsb_number": "062-001",
"branch_identifier": "001",
"bank_code": "BNH",
"currency": apideck_unify.Currency.USD,
},
], notes="Some notes about this customer", tax_rate={
"id": "123456",
"rate": 10,
}, tax_number="US123945459", currency=apideck_unify.Currency.USD, account={
"id": "123456",
"nominal_code": "N091",
"code": "453",
}, parent={
"id": "12345",
"name": "Windsurf Shop",
}, status=apideck_unify.CustomerStatusStatus.ACTIVE, payment_method="cash", channel="email", custom_fields=[
{
"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",
},
},
},
{
"path": "$.nested.property",
"value": {
"TaxClassificationRef": {
"value": "EUC-99990201-V1-00020000",
},
},
},
],
},
])
assert res.update_customer_response is not None
# Handle response
print(res.update_customer_response)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
str | ✔️ | ID of the record you are acting upon. | |
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] | ➖ | Display ID | EMP00101 |
display_name |
OptionalNullable[str] | ➖ | Display name | Windsurf Shop |
company_name |
OptionalNullable[str] | ➖ | The name of the company. | SpaceX |
company_id |
OptionalNullable[str] | ➖ | The company or subsidiary id the transaction belongs to | 12345 |
title |
OptionalNullable[str] | ➖ | The job title of the person. | CEO |
first_name |
OptionalNullable[str] | ➖ | The first name of the person. | Elon |
middle_name |
OptionalNullable[str] | ➖ | Middle name of the person. | D. |
last_name |
OptionalNullable[str] | ➖ | The last name of the person. | Musk |
suffix |
OptionalNullable[str] | ➖ | N/A | Jr. |
individual |
OptionalNullable[bool] | ➖ | Is this an individual or business customer | true |
project |
OptionalNullable[bool] | ➖ | If true, indicates this is a Project. | false |
addresses |
List[models.Address] | ➖ | N/A | |
phone_numbers |
List[models.PhoneNumber] | ➖ | N/A | |
emails |
List[models.Email] | ➖ | N/A | |
websites |
List[models.Website] | ➖ | N/A | |
bank_accounts |
List[models.BankAccount] | ➖ | N/A | |
notes |
OptionalNullable[str] | ➖ | Some notes about this customer | Some notes about this customer |
tax_rate |
Optional[models.LinkedTaxRateInput] | ➖ | N/A | |
tax_number |
OptionalNullable[str] | ➖ | N/A | US123945459 |
currency |
OptionalNullable[models.Currency] | ➖ | Indicates the associated currency for an amount of money. Values correspond to ISO 4217. | USD |
account |
OptionalNullable[models.LinkedLedgerAccountInput] | ➖ | N/A | |
parent |
OptionalNullable[models.LinkedParentCustomer] | ➖ | The parent customer this entity is linked to. | |
status |
OptionalNullable[models.CustomerStatusStatus] | ➖ | Customer status | active |
payment_method |
OptionalNullable[str] | ➖ | Payment method used for the transaction, such as cash, credit card, bank transfer, or check | cash |
channel |
OptionalNullable[str] | ➖ | The channel through which the transaction is processed. | |
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.AccountingCustomersUpdateResponse
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 Customer
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.customers.delete(id="<id>", service_id="salesforce")
assert res.delete_customer_response is not None
# Handle response
print(res.delete_customer_response)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
str | ✔️ | ID of the record you are acting upon. | |
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.AccountingCustomersDeleteResponse
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 | */* |