# api

the covet rest api. all endpoints return json.

base url: https://api.covet.sh/api/v1

auth: pass X-Session-ID header for session-scoped cart and orders.

products

GET /products

list all products. optional ?category=tees filter.

[
  {
    "id": "essential-tee",
    "name": "the essential tee",
    "category": "tees",
    "description": "...",
    "material": "300gsm cotton jersey",
    "price": 4800,
    "sizes": ["S", "M", "L", "XL"],
    "colors": [
      { "name": "bone", "hex": "#E8E0D5" }
    ],
    "in_stock": true
  }
]
GET /products/{id}

get a single product by id.

cart

GET /cart

get the current session's cart.

{
  "session_id": "abc123",
  "items": [
    {
      "product_id": "essential-tee",
      "product_name": "the essential tee",
      "size": "M",
      "color_name": "bone",
      "quantity": 1,
      "unit_price": 4800
    }
  ]
}
POST /cart

add an item to cart. returns the updated cart.

{
  "product_id": "essential-tee",
  "product_name": "the essential tee",
  "size": "M",
  "color_name": "bone",
  "quantity": 1,
  "unit_price": 4800
}
PUT /cart/{index}

update item quantity by index. returns the updated cart.

{ "quantity": 2 }
DELETE /cart/{index}

remove an item by index. returns the updated cart.

DELETE /cart

clear the entire cart.

checkout

POST /checkout

create a stripe checkout session. returns a payment url.

// request
{
  "name": "jane doe",
  "email": "jane@example.com",
  "line1": "123 main st",
  "city": "los angeles",
  "state": "CA",
  "zip": "90001"
}

// response
{
  "order_id": "ord_abc123",
  "checkout_url": "https://checkout.stripe.com/...",
  "session_id": "cs_live_..."
}
GET /checkout/{sessionId}/status

poll payment status. returns pending or paid.

orders

GET /orders

list all orders for the current session.

[
  {
    "id": "ord_abc123",
    "items": [...],
    "shipping_address": {...},
    "subtotal": 4800,
    "total": 4800,
    "status": "paid",
    "created_at": "2026-02-20T..."
  }
]
GET /orders/{id}

get a single order by id.

subscribe

POST /subscribe

subscribe an email for drop notifications.

// request
{ "email": "you@example.com" }

// response
{ "status": "subscribed" }

prices are in cents. status codes follow standard http conventions.