QuickBooks: Read a purchase
QuickBooks purchase.get: arguments, response, policy and SDK examples.
← Purchase operations · Get started
Operation quickbooks.purchase.read_a_purchase
Provider route: GET /v3/company/{realmID}/purchase/{purchaseId}. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/quickbooks with npm, or alter-sdk-quickbooks with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { QuickBooksIntegration } from "@alter-ai/quickbooks";
async function execute(input: Parameters<QuickBooksIntegration["purchase"]["get"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new QuickBooksIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.purchase.get(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_quickbooks import QuickBooksIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = QuickBooksIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.purchase.get(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
query | object | Optional | Additional keys: not allowed |
query.minorversion | integer | Optional | Must equal: 75 |
query.requestid | string | Optional | Minimum length: 1 |
query.include | string | Optional | One of: enhancedAllCustomFields |
path | object | Required within parent | Additional keys: not allowed |
path.purchaseId | string | Required within parent | Minimum length: 1 |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
time | string | Optional | |
Purchase | Model | Optional | Expand Read a purchase — response body — Purchase |
Referenced models: Read a purchase — response body — Purchase
Schemas
Section titled “Schemas”9 more schemas are linked from the tables above, on the schema pages.
Read a purchase — response body — Purchase Line item Account Based Expense Line Detail, Amount, Custom Extensions, Description, Detail Type, Id, Line Num
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
AccountBasedExpenseLineDetail | Model | Optional | Expand Read a purchase — response body — Purchase Line item Account Based Expense Line Detail, Amount, Custom Extensions, Description, Detail Type, Id, Line Num Account Based Expense Line Detail LineDetail |
Amount | JSON | Optional | The amount of the line item. Decimal string |
Amount (anyOf 1) | JSON | Alternative | |
Amount (anyOf 1) (anyOf 1) | number | Alternative | |
Amount (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Amount (anyOf 2) | string | Alternative | |
CustomExtensions | array | Optional | Array of custom extension objects that associate additional attributes with the line. The ExtensionType field specifies the type of extension. The currently supported value is DIMENSION . The AssociatedValues array contains key/value pairs referencing Dimensions DefinitionID/Dimension ValueID. Multiple key/value pairs per extension type are supported. This field is designed to support additional extension types in the future. Dimensions is available for Intuit Enterprise Suite. |
CustomExtensions[] | Model | Each item | Expand Read an item — response body — Item Custom Extensions item |
Description | string | Optional | Free form text description of the line item that appears in the printed record. |
DetailType | string | Optional | Set to AccountBasedExpenseLineDetail for this type of line. |
Id | string | Optional | The Id of the line item. Its use in requests is as folllows: If Id is greater than zero and exists for the company, the request is considered an update operation for a line item. If no Id is provided, the Id provided is less than or equal to zero, or the Id provided is greater than zero and does not exist for the company then the request is considered a create operation for a line item. Available in all objects that use lines and support the update operation. Read only: true |
LineNum | JSON | Optional | Specifies the position of the line in the collection of transaction lines. Positive Integer. Decimal string |
LineNum (anyOf 1) | JSON | Alternative | |
LineNum (anyOf 1) (anyOf 1) | number | Alternative | |
LineNum (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
LineNum (anyOf 2) | string | Alternative |
Referenced models: Read a purchase — response body — Purchase Line item Account Based Expense Line Detail, Amount, Custom Extensions, Description, Detail Type, Id, Line Num Account Based Expense Line Detail, Read an item — response body — Item Custom Extensions item
Read a bill — response body — Bill Currency Ref
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
name | string | Optional | The full name of the currency. |
value | JSON | Optional | |
value (anyOf 1) | string | Alternative | |
value (anyOf 2) | JSON | Alternative | |
value (anyOf 2) (anyOf 1) | integer | Alternative | |
value (anyOf 2) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Read an invoice — response body — Invoice Custom Field item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
DefinitionId | string | Optional | Unique identifier of the CustomFieldDefinition that corresponds to this CustomField. Read only: true |
Name | string | Optional | Name of the custom field. Read only: true |
StringValue | string | Optional | The value for the StringType custom field. |
Type | string | Optional | Data type of custom field. Only one type is currently supported: StringType . Read only: true |
Read a purchase — response body — Purchase Line item Amount, Custom Extensions, Description, Detail Type, Id, Item Based Expense Line Detail, Line Num, Linked Txn
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
Amount | JSON | Optional | The amount of the line item. Decimal string |
Amount (anyOf 1) | JSON | Alternative | |
Amount (anyOf 1) (anyOf 1) | number | Alternative | |
Amount (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Amount (anyOf 2) | string | Alternative | |
CustomExtensions | array | Optional | Array of custom extension objects that associate additional attributes with the line. The ExtensionType field specifies the type of extension. The currently supported value is DIMENSION . The AssociatedValues array contains key/value pairs referencing Dimensions DefinitionID/Dimension ValueID. Multiple key/value pairs per extension type are supported. This field is designed to support additional extension types in the future. Dimensions is available for Intuit Enterprise Suite. |
CustomExtensions[] | Model | Each item | Expand Read an item — response body — Item Custom Extensions item |
Description | string | Optional | Free form text description of the line item that appears in the printed record. |
DetailType | string | Optional | Set to ItemBasedExpenseLineDetail for this type of line. |
Id | string | Optional | The Id of the line item. Its use in requests is as folllows: If Id is greater than zero and exists for the company, the request is considered an update operation for a line item. If no Id is provided, the Id provided is less than or equal to zero, or the Id provided is greater than zero and does not exist for the company then the request is considered a create operation for a line item. Available in all objects that use lines and support the update operation. Read only: true |
ItemBasedExpenseLineDetail | Model | Optional | Expand Read a bill — response body — Bill Line item Amount, Custom Extensions, Description, Detail Type, Id, Item Based Expense Line Detail, Line Num, Linked Txn Item Based Expense Line Detail |
LineNum | JSON | Optional | Specifies the position of the line in the collection of transaction lines. Positive integer. Decimal string |
LineNum (anyOf 1) | JSON | Alternative | |
LineNum (anyOf 1) (anyOf 1) | number | Alternative | |
LineNum (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
LineNum (anyOf 2) | string | Alternative | |
LinkedTxn | array | Optional | Zero or more transactions linked to this object. The LinkedTxn.TxnType can be set to ReimburseCharge . The LinkedTxn.TxnId can be set as the ID of the transaction. |
LinkedTxn[] | Model | Each item | Expand Read a bill — response body — Bill Linked Txn item |
Referenced models: Read an item — response body — Item Custom Extensions item, Read a bill — response body — Bill Line item Amount, Custom Extensions, Description, Detail Type, Id, Item Based Expense Line Detail, Line Num, Linked Txn Item Based Expense Line Detail, Read a bill — response body — Bill Linked Txn item
Read a bill — response body — Bill Linked Txn item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
TxnId | string | Optional | Transaction Id of the related transaction. |
TxnLineId | string | Optional | Required for Deposit and Bill entities. The line number of a specific line of the linked transaction. If supplied, the TxnId and TxnType attributes of the linked transaction must also be populated. Conditionally required |
TxnType | string | Optional | Transaction type of the linked object. |
Read a bill — response body — Bill Meta Data
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
CreateTime | string | Optional | Time the entity was created in the source domain. Read only: true |
LastUpdatedTime | string | Optional | Time the entity was last updated in the source domain. Read only: true |
Create a vendor — request body — body Bill Addr
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
City | string | Optional | City name. |
Country | string | Optional | For international addresses, the request can be an ISO alpha-3 code or the full name of the country. The response for update and read operations returns ISO alpha-3 country codes only. |
CountrySubDivisionCode | string | Optional | Region within a country. For example, state name for USA, province name for Canada. |
Id | string | Optional | Unique identifier of the QuickBooks object for the address, autoincremented when the address is changed. This is an internal value included for backwards compatibility and can be ignored. Read only: true |
Line1 | string | Optional | First line of the address. |
Line2 | string | Optional | Second line of the address. |
Line3 | string | Optional | Third line of the address. |
Line4 | string | Optional | Fourth line of the address. |
Line5 | string | Optional | Fifth line of the address. |
PostalCode | string | Optional | Postal code. For example, zip code for USA and Canada |
Read an item — response body — Item Custom Extensions item Associated Values item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: allowed |
Key | string | Optional | For ExtensionType=DIMENSION , the unique ID of the dimension definition. |
Value | string | Optional | For ExtensionType=DIMENSION , the unique ID of the selected dimension value. |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: quickbooks.purchase.read_a_purchase. Catalog operation: purchase/read_a_purchase. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.