Skip to content

Latest commit

 

History

History
873 lines (773 loc) · 190 KB

README.md

File metadata and controls

873 lines (773 loc) · 190 KB

Suppliers

(accounting.suppliers)

Overview

Available Operations

list

List Suppliers

Example Usage

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.suppliers.list(raw=False, service_id="salesforce", company_id="12345", limit=20, filter_={
        "company_name": "SpaceX",
        "display_name": "Elon Musk",
        "first_name": "Elon",
        "last_name": "Musk",
        "email": "elon@musk.com",
        "updated_since": parse_datetime("2020-09-30T07:43:32.000Z"),
    }, sort={
        "by": apideck_unify.SuppliersSortBy.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()

Parameters

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
company_id Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
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.SuppliersFilter] ➖ Apply filters {
"company_name": "SpaceX",
"display_name": "Elon Musk",
"first_name": "Elon",
"last_name": "Musk",
"email": "elon@musk.com",
"updated_since": "2020-09-30T07:43:32.000Z"
}
sort Optional[models.SuppliersSort] ➖ 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.

Response

models.AccountingSuppliersAllResponse

Errors

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

Create Supplier

Example Usage

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.suppliers.create(raw=False, service_id="salesforce", company_id_param="12345", display_id="EMP00101", display_name="Windsurf Shop", company_name="SpaceX", company_id="12345", subsidiary={
        "display_id": "123456",
        "name": "Acme Inc.",
    }, supplier_category="Insurance", title="CEO", first_name="Elon", middle_name="D.", last_name="Musk", suffix="Jr.", individual=True, 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": "elon@musk.com",
            "website": "https://elonmusk.com",
            "notes": "Address notes or delivery instructions.",
            "row_version": "1-12345",
        },
    ], phone_numbers=[
        {
            "id": "12345",
            "country_code": "1",
            "area_code": "323",
            "number": "111-111-1111",
            "extension": "105",
            "type": apideck_unify.PhoneNumberType.PRIMARY,
        },
        {
            "id": "12345",
            "country_code": "1",
            "area_code": "323",
            "number": "111-111-1111",
            "extension": "105",
            "type": apideck_unify.PhoneNumberType.PRIMARY,
        },
    ], emails=[
        {
            "id": "123",
            "email": "elon@musk.com",
            "type": apideck_unify.EmailType.PRIMARY,
        },
    ], websites=[
        {
            "id": "12345",
            "url": "http://example.com",
            "type": apideck_unify.WebsiteType.PRIMARY,
        },
        {
            "id": "12345",
            "url": "http://example.com",
            "type": apideck_unify.WebsiteType.PRIMARY,
        },
        {
            "id": "12345",
            "url": "http://example.com",
            "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 supplier", tax_rate={
        "id": "123456",
        "rate": 10,
    }, tax_number="US123945459", taxable=True, currency=apideck_unify.Currency.USD, account={
        "id": "123456",
        "nominal_code": "N091",
        "code": "453",
    }, status=apideck_unify.SupplierStatus.ACTIVE, payment_method="cash", terms="Net 30 days", terms_id="12345", channel="email", issued_method="Email", issued_email="john.doe@example.com", custom_fields=[
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
            "value": True,
        },
    ], tax_details=[
        {
            "type": "GST on Purchases",
            "number": "123456",
            "is_transaction_tax": True,
            "is_primary_tax": True,
        },
    ], tax_status_details=[
        {
            "country": "US",
            "transaction_tax_status": "taxable",
        },
    ], 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",
                        },
                    },
                },
            ],
        },
    ], subsidiary_id="12345", integration_system_id="12345")

    assert res.create_supplier_response is not None

    # Handle response
    print(res.create_supplier_response)

Parameters

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
company_id_param Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
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 ID the transaction belongs to 12345
subsidiary OptionalNullable[models.LinkedSubsidiaryInput] ➖ N/A
supplier_category OptionalNullable[str] ➖ The category/type of the supplier Insurance
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 supplier true
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 supplier Some notes about this supplier
tax_rate Optional[models.LinkedTaxRateInput] ➖ N/A
tax_number OptionalNullable[str] ➖ N/A US123945459
taxable OptionalNullable[bool] ➖ Whether the entity is subject to taxation true
currency OptionalNullable[models.Currency] ➖ Indicates the associated currency for an amount of money. Values correspond to ISO 4217. USD
account OptionalNullable[models.LinkedLedgerAccount] ➖ N/A
status OptionalNullable[models.SupplierStatus] ➖ Supplier status active
payment_method OptionalNullable[str] ➖ Payment method used for the transaction, such as cash, credit card, bank transfer, or check cash
terms OptionalNullable[str] ➖ Terms of payment. Net 30 days
terms_id OptionalNullable[str] ➖ The ID of the payment terms 12345
channel OptionalNullable[str] ➖ The channel through which the transaction is processed. email
issued_method OptionalNullable[str] ➖ Method of issuance of the purchase order for the supplier Email
issued_email OptionalNullable[str] ➖ Email address of the person who issued the purchase order for the supplier john.doe@example.com
custom_fields List[models.CustomField] ➖ N/A
tax_details List[Nullable[models.LinkedTaxDetail]] ➖ N/A
tax_status_details List[Nullable[models.LinkedTaxStatusDetail]] ➖ 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.
subsidiary_id Optional[str] ➖ The subsidiary the supplier belongs to. 12345
integration_system_id Optional[str] ➖ The integration system the supplier belongs to. 12345
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingSuppliersAddResponse

Errors

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

Get Supplier

Example Usage

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.suppliers.get(id="<id>", service_id="salesforce", company_id="12345", raw=False, fields="id,updated_at")

    assert res.get_supplier_response is not None

    # Handle response
    print(res.get_supplier_response)

Parameters

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
company_id Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
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.

Response

models.AccountingSuppliersOneResponse

Errors

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

Update Supplier

Example Usage

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.suppliers.update(id="<id>", service_id="salesforce", company_id_param="12345", raw=False, display_id="EMP00101", display_name="Windsurf Shop", company_name="SpaceX", company_id="12345", subsidiary={
        "display_id": "123456",
        "name": "Acme Inc.",
    }, supplier_category="Insurance", title="CEO", first_name="Elon", middle_name="D.", last_name="Musk", suffix="Jr.", individual=True, 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": "elon@musk.com",
            "website": "https://elonmusk.com",
            "notes": "Address notes or delivery instructions.",
            "row_version": "1-12345",
        },
    ], phone_numbers=[
        {
            "id": "12345",
            "country_code": "1",
            "area_code": "323",
            "number": "111-111-1111",
            "extension": "105",
            "type": apideck_unify.PhoneNumberType.PRIMARY,
        },
        {
            "id": "12345",
            "country_code": "1",
            "area_code": "323",
            "number": "111-111-1111",
            "extension": "105",
            "type": apideck_unify.PhoneNumberType.PRIMARY,
        },
    ], emails=[
        {
            "id": "123",
            "email": "elon@musk.com",
            "type": apideck_unify.EmailType.PRIMARY,
        },
    ], websites=[
        {
            "id": "12345",
            "url": "http://example.com",
            "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 supplier", tax_rate={
        "id": "123456",
        "rate": 10,
    }, tax_number="US123945459", taxable=True, currency=apideck_unify.Currency.USD, account={
        "id": "123456",
        "nominal_code": "N091",
        "code": "453",
    }, status=apideck_unify.SupplierStatus.ACTIVE, payment_method="cash", terms="Net 30 days", terms_id="12345", channel="email", issued_method="Email", issued_email="john.doe@example.com", custom_fields=[
        {
            "id": "2389328923893298",
            "name": "employee_level",
            "description": "Employee Level",
            "value": {

            },
        },
    ], tax_details=[
        {
            "type": "GST on Purchases",
            "number": "123456",
            "is_transaction_tax": True,
            "is_primary_tax": True,
        },
    ], tax_status_details=[
        {
            "country": "US",
            "transaction_tax_status": "taxable",
        },
    ], row_version="1-12345", pass_through=[
        {
            "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",
                        },
                    },
                },
            ],
        },
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
    ], subsidiary_id="12345", integration_system_id="12345")

    assert res.update_supplier_response is not None

    # Handle response
    print(res.update_supplier_response)

Parameters

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
company_id_param Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
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 ID the transaction belongs to 12345
subsidiary OptionalNullable[models.LinkedSubsidiaryInput] ➖ N/A
supplier_category OptionalNullable[str] ➖ The category/type of the supplier Insurance
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 supplier true
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 supplier Some notes about this supplier
tax_rate Optional[models.LinkedTaxRateInput] ➖ N/A
tax_number OptionalNullable[str] ➖ N/A US123945459
taxable OptionalNullable[bool] ➖ Whether the entity is subject to taxation true
currency OptionalNullable[models.Currency] ➖ Indicates the associated currency for an amount of money. Values correspond to ISO 4217. USD
account OptionalNullable[models.LinkedLedgerAccount] ➖ N/A
status OptionalNullable[models.SupplierStatus] ➖ Supplier status active
payment_method OptionalNullable[str] ➖ Payment method used for the transaction, such as cash, credit card, bank transfer, or check cash
terms OptionalNullable[str] ➖ Terms of payment. Net 30 days
terms_id OptionalNullable[str] ➖ The ID of the payment terms 12345
channel OptionalNullable[str] ➖ The channel through which the transaction is processed. email
issued_method OptionalNullable[str] ➖ Method of issuance of the purchase order for the supplier Email
issued_email OptionalNullable[str] ➖ Email address of the person who issued the purchase order for the supplier john.doe@example.com
custom_fields List[models.CustomField] ➖ N/A
tax_details List[Nullable[models.LinkedTaxDetail]] ➖ N/A
tax_status_details List[Nullable[models.LinkedTaxStatusDetail]] ➖ 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.
subsidiary_id Optional[str] ➖ The subsidiary the supplier belongs to. 12345
integration_system_id Optional[str] ➖ The integration system the supplier belongs to. 12345
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingSuppliersUpdateResponse

Errors

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

Delete Supplier

Example Usage

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.suppliers.delete(id="<id>", service_id="salesforce", company_id="12345", raw=False)

    assert res.delete_supplier_response is not None

    # Handle response
    print(res.delete_supplier_response)

Parameters

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
company_id Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
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.

Response

models.AccountingSuppliersDeleteResponse

Errors

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_batch

Create multiple suppliers in a single request. Each item is processed independently, so some may be created while others fail; the response returns 200 with one result per item, in the order the items were sent. The maximum number of items accepted per request depends on the connector.

Example Usage

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.suppliers.create_batch(items=[
        {
            "ref": "item-1",
            "data": {
                "display_id": "EMP00101",
                "display_name": "Windsurf Shop",
                "company_name": "SpaceX",
                "company_id": "12345",
                "subsidiary": {
                    "display_id": "123456",
                    "name": "Acme Inc.",
                },
                "supplier_category": "Insurance",
                "title": "CEO",
                "first_name": "Elon",
                "middle_name": "D.",
                "last_name": "Musk",
                "suffix": "Jr.",
                "individual": True,
                "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",
                        "line5": "Attention: Finance Dept",
                        "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": "elon@musk.com",
                        "website": "https://elonmusk.com",
                        "notes": "Address notes or delivery instructions.",
                        "row_version": "1-12345",
                    },
                ],
                "phone_numbers": [
                    {
                        "id": "12345",
                        "country_code": "1",
                        "area_code": "323",
                        "number": "111-111-1111",
                        "extension": "105",
                        "type": apideck_unify.PhoneNumberType.PRIMARY,
                    },
                ],
                "emails": [
                    {
                        "id": "123",
                        "email": "elon@musk.com",
                        "type": apideck_unify.EmailType.PRIMARY,
                    },
                ],
                "websites": [
                    {
                        "id": "12345",
                        "url": "http://example.com",
                        "type": apideck_unify.WebsiteType.PRIMARY,
                    },
                ],
                "bank_accounts": [
                    {
                        "bank_name": "Chase Bank",
                        "account_number": "123465",
                        "account_name": "Main Operating Account",
                        "account_type": apideck_unify.AccountType.CREDIT_CARD,
                        "iban": "GB33BUKB20201555555555",
                        "bic": "CHASUS33",
                        "routing_number": "021000021",
                        "bsb_number": "062-001",
                        "branch_identifier": "001",
                        "bank_code": "BNH",
                        "currency": apideck_unify.Currency.USD,
                        "country": "US",
                    },
                ],
                "notes": "Some notes about this supplier",
                "tax_rate": {
                    "id": "123456",
                    "code": "N-T",
                    "rate": 10,
                },
                "tax_number": "US123945459",
                "taxable": True,
                "currency": apideck_unify.Currency.USD,
                "account": {
                    "id": "123456",
                    "name": "Bank account",
                    "nominal_code": "N091",
                    "code": "453",
                    "parent_id": "123456",
                    "display_id": "123456",
                },
                "status": apideck_unify.SupplierCreateInputStatus.ACTIVE,
                "payment_method": "cash",
                "terms": "Net 30 days",
                "terms_id": "12345",
                "channel": "email",
                "issued_method": "Email",
                "issued_email": "john.doe@example.com",
                "custom_fields": [
                    {
                        "id": "2389328923893298",
                        "name": "employee_level",
                        "ref_name": "Marketing",
                        "description": "Employee Level",
                        "value": "Uses Salesforce and Marketo",
                    },
                ],
                "tax_details": [
                    {
                        "type": "GST on Purchases",
                        "number": "123456",
                        "is_transaction_tax": True,
                        "is_primary_tax": True,
                    },
                ],
                "tax_status_details": [
                    {
                        "country": "US",
                        "transaction_tax_status": "taxable",
                    },
                ],
                "row_version": "1-12345",
                "pass_through": [
                    {
                        "service_id": "<id>",
                        "extend_paths": [
                            {
                                "path": "$.nested.property",
                                "value": {
                                    "TaxClassificationRef": {
                                        "value": "EUC-99990201-V1-00020000",
                                    },
                                },
                            },
                        ],
                    },
                ],
                "subsidiary_id": "12345",
                "integration_system_id": "12345",
            },
        },
    ], raw=False, service_id="salesforce", company_id="12345")

    assert res.batch_suppliers_response is not None

    # Handle response
    print(res.batch_suppliers_response)

Parameters

Parameter Type Required Description Example
items List[models.BatchSuppliersRequestItems] ✔️ The records to write. The per-connector limit is the real cap and is usually lower than the ceiling here: read batch_support.resources[<resource>].max_items on the Connector API for the connector you are calling, or the resource gotchas. This ceiling exists so an oversized array is rejected by request validation before any per-item work runs, rather than after it.
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
company_id Optional[str] ➖ The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings. 12345
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.AccountingSuppliersBatchAddResponse

Errors

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 */*