|
| 1 | +# accounts |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Accounts |
| 6 | + |
| 7 | +### Available Operations |
| 8 | + |
| 9 | +* [create](#create) - Create account |
| 10 | +* [get](#get) - Get account |
| 11 | +* [get_create_model](#get_create_model) - Get create account model |
| 12 | +* [list](#list) - List accounts |
| 13 | + |
| 14 | +## create |
| 15 | + |
| 16 | +Creates a new account for a given company. |
| 17 | + |
| 18 | +Required data may vary by integration. To see what data to post, first call [Get create account model](https://docs.codat.io/accounting-api#/operations/get-create-chartOfAccounts-model). |
| 19 | + |
| 20 | +> **Supported Integrations** |
| 21 | +> |
| 22 | +> Check out our [Knowledge UI](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=chartOfAccounts) for integrations that support creating an account. |
| 23 | +
|
| 24 | +### Example Usage |
| 25 | + |
| 26 | +```python |
| 27 | +import codataccounting |
| 28 | +from codataccounting.models import operations, shared |
| 29 | + |
| 30 | +s = codataccounting.CodatAccounting( |
| 31 | + security=shared.Security( |
| 32 | + auth_header="YOUR_API_KEY_HERE", |
| 33 | + ), |
| 34 | +) |
| 35 | + |
| 36 | + |
| 37 | +req = operations.CreateAccountRequest( |
| 38 | + account=shared.Account( |
| 39 | + currency="quibusdam", |
| 40 | + current_balance=6027.63, |
| 41 | + description="Invoices the business has issued but has not yet collected payment on.", |
| 42 | + fully_qualified_category="Asset.Current", |
| 43 | + fully_qualified_name="Asset.Current.Accounts Receivable", |
| 44 | + id="1b6266d1-1e44-46c5-8eb5-a8f98e03124e", |
| 45 | + is_bank_account=False, |
| 46 | + metadata=shared.Metadata( |
| 47 | + is_deleted=False, |
| 48 | + ), |
| 49 | + modified_date="nulla", |
| 50 | + name="Accounts Receivable", |
| 51 | + nominal_code="610", |
| 52 | + source_modified_date="corrupti", |
| 53 | + status="Active", |
| 54 | + type="Asset", |
| 55 | + valid_datatype_links=[ |
| 56 | + shared.ValidDataTypeLinks( |
| 57 | + links=[ |
| 58 | + "error", |
| 59 | + "deserunt", |
| 60 | + ], |
| 61 | + property="suscipit", |
| 62 | + ), |
| 63 | + shared.ValidDataTypeLinks( |
| 64 | + links=[ |
| 65 | + "magnam", |
| 66 | + "debitis", |
| 67 | + ], |
| 68 | + property="ipsa", |
| 69 | + ), |
| 70 | + shared.ValidDataTypeLinks( |
| 71 | + links=[ |
| 72 | + "tempora", |
| 73 | + "suscipit", |
| 74 | + "molestiae", |
| 75 | + "minus", |
| 76 | + ], |
| 77 | + property="placeat", |
| 78 | + ), |
| 79 | + shared.ValidDataTypeLinks( |
| 80 | + links=[ |
| 81 | + "iusto", |
| 82 | + "excepturi", |
| 83 | + "nisi", |
| 84 | + ], |
| 85 | + property="recusandae", |
| 86 | + ), |
| 87 | + ], |
| 88 | + ), |
| 89 | + company_id="8a210b68-6988-11ed-a1eb-0242ac120002", |
| 90 | + connection_id="2e9d2c44-f675-40ba-8049-353bfcb5e171", |
| 91 | + timeout_in_minutes=836079, |
| 92 | +) |
| 93 | + |
| 94 | +res = s.accounts.create(req) |
| 95 | + |
| 96 | +if res.create_account_response is not None: |
| 97 | + # handle response |
| 98 | +``` |
| 99 | + |
| 100 | +## get |
| 101 | + |
| 102 | +Gets a single account corresponding to the given ID. |
| 103 | + |
| 104 | +### Example Usage |
| 105 | + |
| 106 | +```python |
| 107 | +import codataccounting |
| 108 | +from codataccounting.models import operations |
| 109 | + |
| 110 | +s = codataccounting.CodatAccounting( |
| 111 | + security=shared.Security( |
| 112 | + auth_header="YOUR_API_KEY_HERE", |
| 113 | + ), |
| 114 | +) |
| 115 | + |
| 116 | + |
| 117 | +req = operations.GetAccountRequest( |
| 118 | + account_id="8a210b68-6988-11ed-a1eb-0242ac120002", |
| 119 | + company_id="8a210b68-6988-11ed-a1eb-0242ac120002", |
| 120 | +) |
| 121 | + |
| 122 | +res = s.accounts.get(req) |
| 123 | + |
| 124 | +if res.account is not None: |
| 125 | + # handle response |
| 126 | +``` |
| 127 | + |
| 128 | +## get_create_model |
| 129 | + |
| 130 | +Get create account model. Returns the expected data for the request payload. |
| 131 | + |
| 132 | +See the examples for integration-specific indicative models. |
| 133 | + |
| 134 | +> **Supported Integrations** |
| 135 | +> |
| 136 | +> Check out our [Knowledge UI](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=chartOfAccounts) for integrations that support creating an account. |
| 137 | +
|
| 138 | +### Example Usage |
| 139 | + |
| 140 | +```python |
| 141 | +import codataccounting |
| 142 | +from codataccounting.models import operations |
| 143 | + |
| 144 | +s = codataccounting.CodatAccounting( |
| 145 | + security=shared.Security( |
| 146 | + auth_header="YOUR_API_KEY_HERE", |
| 147 | + ), |
| 148 | +) |
| 149 | + |
| 150 | + |
| 151 | +req = operations.GetCreateChartOfAccountsModelRequest( |
| 152 | + company_id="8a210b68-6988-11ed-a1eb-0242ac120002", |
| 153 | + connection_id="2e9d2c44-f675-40ba-8049-353bfcb5e171", |
| 154 | +) |
| 155 | + |
| 156 | +res = s.accounts.get_create_model(req) |
| 157 | + |
| 158 | +if res.push_option is not None: |
| 159 | + # handle response |
| 160 | +``` |
| 161 | + |
| 162 | +## list |
| 163 | + |
| 164 | +Gets the latest accounts for a company |
| 165 | + |
| 166 | +### Example Usage |
| 167 | + |
| 168 | +```python |
| 169 | +import codataccounting |
| 170 | +from codataccounting.models import operations |
| 171 | + |
| 172 | +s = codataccounting.CodatAccounting( |
| 173 | + security=shared.Security( |
| 174 | + auth_header="YOUR_API_KEY_HERE", |
| 175 | + ), |
| 176 | +) |
| 177 | + |
| 178 | + |
| 179 | +req = operations.ListAccountsRequest( |
| 180 | + company_id="8a210b68-6988-11ed-a1eb-0242ac120002", |
| 181 | + order_by="-modifiedDate", |
| 182 | + page=1, |
| 183 | + page_size=100, |
| 184 | + query="ab", |
| 185 | +) |
| 186 | + |
| 187 | +res = s.accounts.list(req) |
| 188 | + |
| 189 | +if res.accounts is not None: |
| 190 | + # handle response |
| 191 | +``` |
0 commit comments