Delete buyer
Deletes a Buyer profile by identifier; the operation is restricted to administrators.
/api/v1/buyers/{id}DeleteBuyer permanently removes a BuyerEntityv1.0.0BuyerRepresents a customer's ordering profile and delivery address within the Ordering bounded context.Ownercommerce-fulfillment-teamOpen docs profile from Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle,
creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs (DELETE /ordering/api/v1/buyers/{id}) and returns 204 No Content. Access is restricted to callers holding the Microsoft Entra ID admin role.
Overview
| Property | Value |
|---|---|
| Bounded Context | Ordering |
| Owner Service | Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs |
| Protocol / Format | HTTP DELETE, path parameter only, empty response (204 No Content) |
| Gateway Endpoint | DELETE /ordering/api/v1/buyers/{id} (service path /api/v1/buyers/{id}) |
| Authentication & Authorization | Microsoft Entra ID JWT — admin policy (role admin plus scopes ordering_read, ordering_write) |
| Idempotency / Concurrency | Not idempotent across retries; repeat calls return 404 Not Found; no x-request-id header is required |
| Rate Limit / Caching | Global concurrency (100), per-IP fixed-window (30 req/min), and per-user token bucket (30 burst, 20 per 10s, queue 5) |
| Contract Version | 1.0.0 (ApiVersions.V1) |
Request & Response Contract
Path Parameters
Accepts no request body and requires no x-request-id header.
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
id | string (uuid) | Yes | Path parameter; valid UUID | Unique identifier of the buyer profile to delete |
Success Response (204 No Content)
Empty response body confirms the buyer profile was permanently deleted.
Behavior & Side Effects
- Permanent hard delete: Permanently removes the BuyerEntityv1.0.0BuyerRepresents a customer's ordering profile and delivery address within the Ordering bounded context.Ownercommerce-fulfillment-teamOpen docs row from PostgreSQL (unlike orders, buyers are not soft-deleted).
- No events emitted: Deleting a buyer raises no domain events and publishes no Kafka integration events.
The orders.buyer_id foreign key column is non-nullable while the relationship is configured with ON DELETE SET NULL. Attempting to delete a buyer who has existing orders will fail at the database layer and return 500 Internal Server Error.
Error Responses
| Status / Code | Condition | Client Recovery Action |
|---|---|---|
400 Bad Request | Path parameter {id} is not a valid UUID | Supply a valid UUID; do not retry unchanged |
401 Unauthorized | Missing, expired, or invalid Entra ID bearer token | Acquire a fresh Entra ID access token and retry |
403 Forbidden | Caller lacks the admin role or ordering_read/ordering_write scopes | Authenticate with an admin token that includes the required scopes |
404 Not Found | No buyer profile exists with the specified {id} | Verify the buyer identifier; treat as already absent if retrying a prior deletion |
429 Too Many Requests | Rate limit quota exceeded (Retry-After header included) | Wait for the Retry-After interval before retrying |
500 Internal Server Error | Database foreign-key constraint error (e.g., buyer has orders) or unhandled failure | Inspect service logs and check whether dependent orders reference the buyer |
Related Documentation
- Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle, creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs — Service architecture, persistence, and endpoints.
- BuyerEntityv1.0.0BuyerRepresents a customer's ordering profile and delivery address within the Ordering bounded context.Ownercommerce-fulfillment-teamOpen docs — Buyer aggregate schema and constraints.
- Create buyerCommandv1.0.0Create buyerCreates a Buyer profile for the authenticated customer from the supplied address.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs — Create a buyer profile for the authenticated caller.
- Update buyer addressCommandv1.0.0Update buyer addressUpdates the authenticated Buyer's address using the supplied street, city, and province.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs — Update the authenticated customer’s address.
Delete buyer schema
Path identifier for the Buyer to delete. The operation has no request body.
Schema does not contain any properties.