TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Create a cart

POSThttps://api.testingapis.com/api/CartsSign in to see this endpoint's URL

Request body

Optional. application/json, text/json, application/*+json, application/xml, text/xml, application/*+xml. Model: Cart. The new cart. Any client-supplied ID is replaced.

Example body
{"userId": 103, "items": [{"productId": 1, "quantity": 2, "price": 249.99}]}

Responses

200
OK
201
Created; returns { message, data } with the generated ID.
400
The request body is missing.
500
Unexpected server error.

Example

Request
curl -X POST "https://api.testingapis.com/api/Carts" \
  -H "Content-Type: application/json" \
  -d '{"userId": 103, "items": [{"productId": 1, "quantity": 2, "price": 249.99}]}' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response201 Created
{
  "message": "Cart created successfully",
  "data": {
    "id": 12,
    "userId": 103,
    "items": [{"productId": 1, "quantity": 2, "price": 249.99}],
    "total": 499.98,
    "updatedAt": "2026-09-30T18:26:45Z"
  }
}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.