Getting Started

Sparepart API Documentation

Access comprehensive data for 14,000+ computer components including CPUs, GPUs, Memory, Motherboards, Cases, Coolers, PSUs, and Storage devices.

🌐
Base URL https://partcomp.ruang.app
14,031 Components
8 Categories
REST API Type
JSON Format

Authentication

The API uses two authentication methods:

🔑

JWT Token

Used for account management operations like creating and managing API keys.

Header: Authorization: Bearer <token>
🔐

API Key

Used for accessing component data. Get your key from the dashboard.

Header: X-API-Key: sk_your_key_here

Quick Start Guide

Get up and running in 3 simple steps:

1

Create an Account

POST /api/auth/register
{
  "email": "your@email.com",
  "password": "yourpassword",
  "name": "Your Name"
}
2

Login & Get Token

POST /api/auth/login
{
  "email": "your@email.com",
  "password": "yourpassword"
}

// Response
{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "user": { "id": 1, "name": "Your Name" }
}
3

Create API Key & Access Data

POST /api/auth/api-key JWT Required
// Request
{ "name": "My Application" }

// Response
{
  "apiKey": {
    "key": "sk_abc123def456...",
    "name": "My Application"
  }
}
GET /api/cpu API Key
curl -H "X-API-Key: sk_abc123..." \
     https://partcomp.ruang.app/api/cpu

Register User

POST /api/auth/register

Create a new user account.

Request Body

ParameterTypeRequiredDescription
emailstringYesValid email address
passwordstringYesMin 6 characters
namestringYesDisplay name

Response

{
  "message": "User registered successfully",
  "user": {
    "id": 1,
    "email": "user@example.com",
    "name": "John Doe"
  }
}

Login

POST /api/auth/login

Authenticate and receive a JWT token valid for 24 hours.

Request Body

ParameterTypeRequiredDescription
emailstringYesRegistered email
passwordstringYesAccount password

Response

{
  "message": "Login successful",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": 1,
    "email": "user@example.com",
    "name": "John Doe"
  }
}

Create API Key

POST /api/auth/api-key JWT Required

Generate a new API key. Store it securely - it's only shown once!

Headers

HeaderValue
AuthorizationBearer YOUR_JWT_TOKEN

Request Body

ParameterTypeRequiredDescription
namestringYesKey identifier
⚠️ Important: The full API key is only shown once. Save it immediately!

List API Keys

GET /api/auth/api-keys JWT Required

List all API keys for your account. Keys are masked for security.

Delete API Key

DELETE /api/auth/api-key/:id JWT Required

Revoke an API key. The key will stop working immediately.

Get All Components

GET /api/{component} API Key

Retrieve paginated list of components. Replace {component} with: cpu, gpu, memory, motherboard, case, cooler, psu, or storage.

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger20Items per page (max 100)

Example

Request
curl -H "X-API-Key: sk_your_key" \
     "https://partcomp.ruang.app/api/cpu?page=1&limit=5"
Response
{
  "data": [
    {
      "id": 1,
      "partType": "cpu",
      "name": "Intel Core i9-14900K",
      "brand": "Intel",
      "socket": "LGA 1700",
      "speed": 6.0,
      "coreCount": 24,
      "threadCount": 32,
      "power": 125
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 5,
    "total": 458,
    "totalPages": 92
  }
}

Get Single Component

GET /api/{component}/:id API Key

Retrieve a single component by its ID.

Example

curl -H "X-API-Key: sk_your_key" \
     "https://partcomp.ruang.app/api/gpu/42"

CPU Schema

/api/cpu 458 items
FieldTypeDescription
idintegerUnique identifier
partTypestringAlways "cpu"
namestringFull product name
brandstringIntel or AMD
socketstringSocket type (LGA 1700, AM5, etc.)
speednumberBase clock speed in GHz
coreCountintegerNumber of cores
threadCountintegerNumber of threads
powerintegerTDP in watts

GPU Schema

/api/gpu 2,515 items
FieldTypeDescription
idintegerUnique identifier
partTypestringAlways "gpu"
namestringFull product name
brandstringNVIDIA, AMD, or Intel
vramintegerVideo memory in GB
resolutionstringTarget resolution
powerintegerTDP in watts

Memory Schema

/api/memory 1,707 items
FieldTypeDescription
idintegerUnique identifier
partTypestringAlways "memory"
namestringFull product name
typestringDDR4, DDR5, etc.
sizestringCapacity (16GB, 32GB, etc.)

Motherboard Schema

/api/motherboard 2,422 items
FieldTypeDescription
idintegerUnique identifier
partTypestringAlways "motherboard"
namestringFull product name
brandstringManufacturer
socketstringCPU socket type
sizestringForm factor (ATX, mATX, ITX)

Case Schema

/api/case 1,571 items
FieldTypeDescription
idintegerUnique identifier
partTypestringAlways "case"
namestringFull product name
sizestringSupported form factors

Cooler Schema

/api/cooler 872 items
FieldTypeDescription
idintegerUnique identifier
partTypestringAlways "cooler"
namestringFull product name
typestringAir or Liquid

PSU Schema

/api/psu 2,314 items
FieldTypeDescription
idintegerUnique identifier
partTypestringAlways "psu"
namestringFull product name
powerintegerWattage
sizestringForm factor (ATX, SFX)

Storage Schema

/api/storage 2,172 items
FieldTypeDescription
idintegerUnique identifier
partTypestringAlways "storage"
namestringFull product name
typestringSSD, HDD, or NVMe
spacestringStorage capacity

Ready to Start Building?

Create your free account and get your API key in seconds.

Get Your API Key →