# Variant API Reference
Variant resource object:
{
"type": "products",
"id": "(string)",
"attributes": {
"status": "string",
"title": "string",
"sku": "string",
"price": {float|precision:2},
"compare_at_price": {float|precision:2},
"option1": "string",
"option2": "string",
"option3": "string",
"grams": {Float|precision:2},
"weight": {Float|precision:2},
"weight_unit": "string|in:g,kg,oz,lb",
"created_at": "string|datetime",
"updated_at": "string|datetime"
},
"relationships": {
"product": {
"data": Object (Product Resource)
},
"image": {
"data": Object (Image Resource)
},
"images": {
"data": Array [Image Resources]
}
}
}
Related resources: Product, Image
# Writable relationships
| Relationship name | Relationship resource type | Type | Creating | Updating |
|---|---|---|---|---|
| product | products | To-one | Yes - Required | No |
| image | images | To-one | Yes | Yes |
| images | images | To-many | Yes | Yes |
# Writable fields
| Field name | Creating | Updating |
|---|---|---|
| product_id | required|uuid | not_fillable |
| image_id | uuid | uuid |
| image_ids | array | array |
| status | in:available,out-of-stock | in:available,out-of-stock |
| title | max:255 | max: 255 |
| sku | max:255 | max:255 |
| option1 | max:255 | max:255 |
| option2 | max:255 | max:255 |
| option3 | max:255 | max:255 |
| price | >= 0 | >= 0 |
| compare_at_price | >= 0 | >= 0 |
| cost | >= 0 | >= 0 |
| weight | >= 0 | >= 0 |
| weight_unit | in:g,kg,oz,lb | in:g,kg,oz,lb |