TechParts Developer API

The TechParts API provides programmatic access to our computer components catalog, inventory management, and order processing systems. Built for developers integrating TechParts product data and e-commerce functionality into their applications.

TechParts Developer API
GET /products/{id}

Get Product Details

Retrieves comprehensive information for a specific product by its unique identifier. Returns full technical specifications, pricing, inventory availability, and related product information.

Path Parameters

Parameter Type Required Description
id string Yes Unique product identifier (format: PROD-XXXX-XXXX)

Request Example

cURL
curl -X GET "https://api.techparts.com/v1/products/PROD-4090-MSI-001" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response

200 Success
JSON
{
  "id": "PROD-4090-MSI-001",
  "sku": "GPU-NV-4090-MSI-001",
  "name": "NVIDIA GeForce RTX 4090 MSI Gaming X Trio",
  "category": "graphics-cards",
  "manufacturer": "MSI",
  "price": 1599.99,
  "currency": "USD",
  "stock": 23,
  "in_stock": true,
  "specifications": {
    "memory": "24GB GDDR6X",
    "cuda_cores": 16384,
    "boost_clock": "2520 MHz",
    "power_consumption": "450W"
  },
  "warranty": "3 years",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-12-28T14:22:00Z"
}

Error Responses

404 Product Not Found
JSON
{
  "error": "not_found",
  "message": "Product with ID 'PROD-4090-MSI-001' does not exist"
}
401 Unauthorized
JSON
{
  "error": "unauthorized",
  "message": "Valid API key required. Include 'Authorization: Bearer YOUR_API_KEY' header."
}
POST /orders

Create Order

Creates a new order for specified products. Validates product availability, calculates totals, and reserves inventory. Returns order confirmation with tracking information.

Request Body

Field Type Required Description
customer_id string Yes Customer account identifier
items array Yes Array of order items (1-50 items)
items[].product_id string Yes Product identifier
items[].quantity integer Yes Quantity to order (min: 1, max: 999)
shipping_address object Yes Shipping address details

Request Example

cURL
curl -X POST "https://api.techparts.com/v1/orders" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "CUST-789012",
    "items": [
      {
        "product_id": "PROD-4090-MSI-001",
        "quantity": 1
      },
      {
        "product_id": "PROD-5950X-AMD-001",
        "quantity": 1
      }
    ],
    "shipping_address": {
      "street": "123 Tech Lane",
      "city": "San Francisco",
      "state": "CA",
      "zip": "94105",
      "country": "US"
    }
  }'

Response

201 Created
JSON
{
  "order_id": "ORD-2024-98765",
  "status": "pending",
  "subtotal": 2149.98,
  "tax": 171.99,
  "shipping": 0.00,
  "total": 2321.97,
  "currency": "USD",
  "items_count": 2,
  "created_at": "2024-12-28T15:30:00Z",
  "estimated_delivery": "2024-12-31T23:59:00Z",
  "tracking_url": "https://techparts.com/track/ORD-2024-98765"
}

Error Responses

400 Insufficient Stock
JSON
{
  "error": "insufficient_stock",
  "message": "Product 'PROD-4090-MSI-001' has only 5 units available. Requested: 10",
  "available_quantity": 5
}
400 Invalid Request
JSON
{
  "error": "validation_error",
  "message": "Invalid request body",
  "details": [
    "Field 'customer_id' is required",
    "Field 'items' must contain at least 1 item"
  ]
}
PATCH /inventory/{sku}

Update Inventory

Updates inventory quantity for a specific product SKU. Used for stock adjustments, restocking, and inventory corrections. Requires elevated permissions.

Path Parameters

Parameter Type Required Description
sku string Yes Product SKU identifier (format: GPU-XX-XXXX-XXX-XXX)

Request Body

Field Type Required Description
quantity integer Yes New inventory quantity (0-9999)
reason string No Optional reason for adjustment (max 200 chars)

Request Example

cURL
curl -X PATCH "https://api.techparts.com/v1/inventory/GPU-NV-4090-MSI-001" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "quantity": 45,
    "reason": "Received shipment from warehouse"
  }'

Response

200 Success
JSON
{
  "sku": "GPU-NV-4090-MSI-001",
  "product_id": "PROD-4090-MSI-001",
  "product_name": "NVIDIA GeForce RTX 4090 MSI Gaming X Trio",
  "quantity": 45,
  "previous_quantity": 23,
  "change": +22,
  "updated_at": "2024-12-28T15:45:00Z",
  "updated_by": "api_user_12345"
}

Error Responses

404 SKU Not Found
JSON
{
  "error": "not_found",
  "message": "SKU 'GPU-NV-4090-MSI-001' does not exist in inventory system"
}
403 Forbidden
JSON
{
  "error": "forbidden",
  "message": "Insufficient permissions to update inventory. Requires 'inventory:write' scope."
}