Retrieve a component
GET
/api/v1/components/{id}
const url = 'https://api.stocksmith.io/api/v1/components/1';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.stocksmith.io/api/v1/components/1 \ --header 'Authorization: Bearer <token>'Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” id
required
integer
Component ID
Responses
Section titled “ Responses ”Component details
Media type application/json
object
component
required
object
id
required
integer
name
required
string
sku
string
output_type
required
string
category
string
default_variation_id
ID of the default active variation, or null if archived
integer
variations
required
Array<object>
object
id
integer
name
string
sku
string
default
boolean
stock_on_hand
Decimal string
string
committed_stock
Decimal string
string
available_stock
Decimal string
string
low_stock_limit
Decimal string
string
state
string
attributes
Array<object>
object
label
string
value
string
unit_price
Omitted for view-only users.
object
amount
Decimal string, e.g. ‘8.75’
string
currency_code
ISO 4217 code, e.g. ‘USD’
string
created_at
string format: date-time
updated_at
string format: date-time
stock_on_hand
required
Decimal string
string
committed_stock
required
Decimal string
string
available_stock
required
Decimal string
string
low_stock_limit
required
Decimal string
string
state
required
string
unit_price
Omitted for view-only users.
object
amount
Decimal string, e.g. ‘8.75’
string
currency_code
ISO 4217 code, e.g. ‘USD’
string
created_at
required
string format: date-time
updated_at
required
string format: date-time
Example
{ "component": { "output_type": "component", "variations": [ { "state": "active" } ], "state": "active" }}Missing or invalid Bearer token
Media type application/json
object
error
required
Error message
string
Example generated
{ "error": "example"}Component not found
Media type application/json
object
error
required
Error message
string
Example generated
{ "error": "example"}