API ReferenceapicommercePOST /v1/carts/{id}/items

POST /v1/carts/\{id\}/items

Service: commerce · operationId: (none)

Required scopes

(no scope declared — review service config)

Path parameters

  • id (string) required

Request body

{
  "type": "object",
  "properties": {
    "product_id": {
      "type": "string",
      "minLength": 1
    },
    "quantity": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "default": 1
    }
  },
  "required": [
    "product_id"
  ]
}

Responses

201 Item added

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "cart_id": {
      "type": "string"
    },
    "product_id": {
      "type": "string"
    },
    "quantity": {
      "type": "number"
    },
    "unit_price_cents": {
      "type": "string"
    },
    "created_at": {
      "type": "string"
    },
    "updated_at": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "cart_id",
    "product_id",
    "quantity",
    "unit_price_cents",
    "created_at",
    "updated_at"
  ]
}

404 Cart or product not found

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

Example

curl -X POST https://commerce.platform.loop.health/v1/carts/{id}/items \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'