Skip to Content

POST /api/v1/cart

Add a single ENS name to the cart. If the item is already in the cart with the same type, the request succeeds silently without creating a duplicate.

Authentication: Required

Cache: None

Request Body

FieldTypeRequiredDescription
ensNameIdnumberYesDatabase ID of the ENS name
cartTypestringYesCart type name (e.g. buy, register)

Sample Request

curl -X POST -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ https://api.grails.app/api/v1/cart \ -d '{ "ensNameId": 42, "cartType": "buy" }'

Response

// 200 OK — newly added { "success": true, "data": { "message": "Added to cart", "cartItemId": 1, "ensNameId": 42, "ensName": "example.eth", "cartType": "buy" }, "meta": { "timestamp": "2026-04-08T00:00:00.000Z", "version": "1.0.0" } }

When the item already exists in the cart with the same type, cartItemId is null:

// 200 OK — duplicate (no-op) { "success": true, "data": { "message": "Item already in cart", "cartItemId": null, "ensNameId": 42, "ensName": "example.eth", "cartType": "buy" }, "meta": { "timestamp": "2026-04-08T00:00:00.000Z", "version": "1.0.0" } }

Error Responses

StatusCodeDescription
400VALIDATION_ERRORInvalid request body
400INVALID_CART_TYPECart type does not exist
401UNAUTHORIZEDMissing or invalid token
404ENS_NAME_NOT_FOUNDENS name ID not found
500INTERNAL_ERRORFailed to add to cart
Last updated on