Search to Order
Complete workflow from product search to order placement
This cookbook walks you through the complete workflow to search for products and place an order using the PartsSource API. By the end, you'll understand how data flows from user lookup through order creation.
Overview
Placing an order requires four API calls that build on each other:
1
User/Customer Lookup
Get user profile, companies, addresses
2
Catalog Search
Find products matching your criteria
3
Catalog Detail
Get pricing options and the priceOptionId
4
Create Order
Place order using the priceOptionId
Critical Concept: priceOptionId
The priceOptionId returned from /catalog/detail is essentially a quote that is valid for 30 days. You must capture this value from Step 3 and use it when creating an order in Step 4.
Prerequisites
Valid OAuth 2.0 access token (see Authentication)
User ID or username for lookup
Understanding of which API to use (Customer API vs Internal API)
Which API should I use?
Customer API (
api.partssource.com/customer): For customer-facing integrations with tenant isolationInternal API (
api.partssource.com/internal): For internal/admin applications with cross-tenant access
Step 1: User/Customer Lookup
First, retrieve the user profile to get company information, facility IDs, and shipping/billing addresses needed for ordering.
API Difference: The endpoint path differs between APIs:
Customer API:
GET /users/lookupInternal API:
GET /customers/lookup
Customer API
Internal API
Response
Key Values to Capture
contactId
requesterId for catalog detail and order creation
companies[].id
companyId for catalog detail and order (Internal API)
shippingAddresses[].id
shippingAddressId for order
billingAddresses[].id
billingAddressId for order
Step 2: Catalog Search
Search the product catalog using keywords, filters, and pagination.
Request (Both APIs)
Pagination Limits:
Customer API: Maximum 200 results per page
Internal API: Maximum 1000 results per page
Response
Key Values to Capture
items[].id
productId for catalog detail and order creation
Step 3: Get Catalog Detail (Critical)
This is the most important step. The catalog detail endpoint returns pricing options, each with a unique priceOptionId that acts as a 30-day quote.
API Difference: The Internal API requires companyId, while the Customer API does not.
Customer API Request
Internal API Request
Response
Understanding the Options Array
Each option in the options array represents a different purchasing choice:
priceOptionId
Required for order - The quote ID, valid for 30 days
price
Unit price for this option
condition
Product condition (New OEM, Refurbished, Aftermarket, etc.)
warranty
Warranty period included
purchaseChoice
Type of purchase (Buy, Exchange, Loan, etc.)
customFields
Additional fields required by the vendor
The priceOptionId is your quote
Think of each priceOptionId as a unique quote from a vendor. It locks in:
The price at the time of lookup
The specific condition and warranty terms
The vendor fulfilling the order
This quote expires after 30 days. If you try to use an expired priceOptionId, the order will fail validation.
About customFields (Internal API)
Some pricing options require additional information from the buyer. The customFields array defines what data you must provide when creating the order.
fieldId
Identifier to use in order request
prompt
User-facing label for the field
isRequired
Whether the field must be provided
formatRegex
Validation pattern for the value
errorMessage
Message shown if validation fails
Step 4: Create Order
Place the order using the priceOptionId from Step 3. Every order request requires an Idempotency-Key header.
Required: Idempotency-Key Header
Every order creation request MUST include a unique Idempotency-Key header (UUID format). This prevents duplicate orders if you need to retry a failed request.
See Idempotency for details.
Customer API Request
Internal API Request
Internal API Difference: The Internal API requires companyId in the order request.
Response
Complete Flow Example
Authenticate and get access token
Look up user to get profile and addresses
Use the user ID or username to retrieve company information, facility IDs, and addresses.
Search catalog for desired product
Search using keywords or filters to find the product you want to order.
Get catalog detail with pricing options
Call /catalog/detail with the productId from search results. Capture the priceOptionId for the option you want.
Create order with priceOptionId
Submit the order with:
priceOptionIdfrom Step 4Address IDs from Step 2
A unique
Idempotency-Keyheader
Verify order creation
Check the response for orderNumber and success: true. Store the order number for tracking.
Error Handling
Common Errors
400 Bad Request
Missing required fields
Check required fields for your API
400 Bad Request
Missing Idempotency-Key
Add the header with a UUID
403 Forbidden
Tenant mismatch
Verify user belongs to the company
404 Not Found
Invalid priceOptionId
Get fresh catalog detail before ordering
409 Conflict
Idempotency key reused with different body
Use new key for different orders
422 Unprocessable Entity
Validation failed
Check error details in response
priceOptionId Expired
If your priceOptionId is older than 30 days, the order will fail validation. Call /catalog/detail again to get a fresh quote with updated pricing.
Next Steps
Idempotency - Detailed idempotency handling and retry patterns
Pagination - Navigating large catalog result sets
Error Handling - Complete error reference and handling patterns
Last updated

