Flat Rate Repairs
Ordering flat rate repairs with per-unit required fields
This cookbook walks you through ordering flat rate repair services via the PartsSource API. Flat rate repairs have unique constraints compared to standard part orders—most importantly, each repair must be its own line item with a quantity of one.
Overview
Flat rate repairs are a service option where a vendor repairs your equipment at a fixed price. Unlike standard part purchases where you might order a quantity of five in a single line item, flat rate repairs require vendor-specific information about each individual unit being repaired—at minimum a repair reason and equipment serial number, and often additional fields like asset ID or work order depending on the configuration.
Because each repair needs its own set of required fields, the API enforces a strict quantity limit:
One Repair Per Line Item
Flat rate repair line items must have a quantity of 1. Each unit being repaired requires its own requiredFields (repair reason, serial number, and any other vendor-required fields), and these fields are submitted per line item—not per unit.
If you need three repairs for the same product, you must submit three separate line items, each with quantity: 1 and its own required field values.
Why This Constraint Exists
Consider a hospital sending three ultrasound probes for repair. Each probe has a different serial number and may be sent in for a different reason. The vendor needs to track each repair individually for:
Traceability — matching the serial number to the specific unit returned after repair
Diagnostics — understanding the reported issue for each unit before it arrives
Compliance — maintaining per-device repair records for regulatory purposes
A single line item with quantity: 3 would only allow one set of required fields, making it impossible to capture per-unit details. The one-per-line-item model ensures every repair is fully documented.
Prerequisites
Valid OAuth 2.0 access token (see Authentication)
Familiarity with the standard Search to Order workflow
Understanding of Required Fields
Step 1: Get Catalog Detail for a Flat Rate Repair
After searching the catalog and finding a product that offers flat rate repair (see Search to Order Steps 1–2), call /catalog/detail to retrieve pricing options.
A flat rate repair option is identified by its condition value containing "Flat Rate Repair" (e.g., "Aftermarket Flat Rate Repair"). Note that the purchaseChoice will be "Outright" — it is the condition, not the purchase choice, that distinguishes flat rate repairs from standard part purchases.
Request
Response
Response trimmed for clarity. The actual response may include additional customFields (such as Asset ID, Work Order, Cost Center, Model, etc.) depending on the vendor. Always check isRequired on each field — the specific set of required fields varies by vendor and product.
Key Indicators of a Flat Rate Repair
condition
"Aftermarket Flat Rate Repair"
Identifies this as a flat rate repair — look for "Flat Rate Repair" in the condition string
purchaseChoice
"Outright"
The purchase choice is Outright, same as standard purchases — not "Flat Rate Repair"
customFields
Non-empty array with required entries
Required fields must be captured for each unit
Required vs. Optional Custom Fields
Flat rate repair options typically include a mix of required and optional custom fields. You must provide values for all fields where isRequired is true. Repair Reason and Equipment Serial # are always required for flat rate repairs. Vendors may also require additional fields such as Asset ID, Work Order, or others — always check isRequired on each field in the customFields response.
Tip: Inspect customFields Before Building Your Order
The specific required fields can vary by vendor and product. Always read the customFields array from the catalog detail response rather than hardcoding field IDs. The fields shown above are typical, but vendors may include additional required or optional fields. Note that field IDs are GUIDs — do not attempt to guess them.
Step 2: Build the Order — One Line Item Per Repair
This is where flat rate repairs diverge from standard orders. Instead of setting quantity to the number of units you need repaired, you create a separate line item for each repair, each with its own requiredFields.
Ordering a Single Repair
For a single repair, the order request looks similar to a standard order — but with the required repair reason and serial number populated. The shippingMethod field is required — see Shipping Methods for valid values.
Ordering Multiple Repairs on the Same Order
When you need to repair multiple units, create a separate entry in the quoteItems array for each one. Every line item uses the same priceOptionId and productId but has different requiredFields values:
Same priceOptionId, Different requiredFields
Notice that all three line items share the same priceOptionId and productId. The priceOptionId quote applies per unit, so reusing it across line items is expected. What must be unique is the requiredFields on each line item — each repair needs its own serial number, repair reason, and values for any other required fields.
What NOT to Do
Do Not Set Quantity Greater Than One
Setting quantity: 2 (or higher) on a flat rate repair line item will result in a validation error because the API cannot associate a single set of required fields with multiple units:
This will fail with a 422 Unprocessable Entity:
Do Not Omit Required Fields
Submitting a flat rate repair line item without the mandatory requiredFields will also fail validation:
Complete Flow Example
Search the catalog for a repair service
Use /catalog/search to find products that offer flat rate repair options.
Get catalog detail and identify the flat rate repair option
Call /catalog/detail with the productId. Look for an option where condition contains "Flat Rate Repair" (e.g., "Aftermarket Flat Rate Repair"). Note its priceOptionId and customFields.
Collect required fields for each unit
For every unit being sent for repair, gather the repair reason and serial number, plus any other vendor-required fields (such as asset ID or work order). Each unit will become its own line item.
Build the quoteItems array — one entry per repair
Create a separate object in the quoteItems array for each unit. Every entry should have quantity: 1, the same priceOptionId, and its own requiredFields.
Submit the order with an Idempotency-Key
POST to /orders with a unique Idempotency-Key header. Verify the response returns success: true and an orderNumber.
Implementation Tips
Programmatically Building Multi-Repair Orders
When your integration needs to create orders for multiple repairs, build the quoteItems array dynamically. Read the customFields from the catalog detail response to get the correct field IDs:
Validating Before Submission
Validate each repair unit against the customFields definitions from catalog detail before submitting the order. This avoids round-trip validation failures:
Watch for Duplicate Serial Numbers
Since each repair must target a distinct unit, submitting two line items with the same serial number is almost always a mistake. Consider adding a duplicate check in your integration logic as shown above.
Error Handling
422 Unprocessable Entity
quantity greater than 1 on a flat rate repair item
Set quantity: 1 and create separate line items per unit
422 Unprocessable Entity
Missing a required field (repair reason, serial number, or other vendor-required fields)
Provide all fields where isRequired is true in the customFields response
422 Unprocessable Entity
Field value fails format validation
Check value against the formatRegex from catalog detail
400 Bad Request
Unknown fieldId in requiredFields
Use exact fieldId GUIDs from the catalog detail response
404 Not Found
Expired priceOptionId
Fetch fresh catalog detail — quotes expire after 30 days
Related Concepts
Required Fields — Full reference for vendor-defined custom fields
Price Option ID — How quotes work and expiration behavior
Search to Order — The standard ordering workflow that this cookbook builds on
Idempotency — Preventing duplicate orders with idempotency keys
Last updated

