Update buyer address
Updates the authenticated Buyer's address using the supplied street, city, and province.
/api/v1/buyers/addressUpdateAddress replaces the shipping address on the authenticated customer’s BuyerEntityv1.0.0BuyerRepresents a customer's ordering profile and delivery address within the Ordering bounded context.Ownercommerce-fulfillment-teamOpen docs profile in 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 (PATCH /ordering/api/v1/buyers/address) and returns the updated buyer profile. Access is restricted strictly to the Microsoft Entra ID customer role (administrators cannot invoke this endpoint on another user’s behalf).
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 PATCH, application/json request and response |
| Gateway Endpoint | PATCH /ordering/api/v1/buyers/address (service path /api/v1/buyers/address) |
| Authentication & Authorization | Microsoft Entra ID JWT — customer policy only (role customer plus scopes ordering_read, ordering_write) |
| Idempotency / Concurrency | Naturally idempotent full address replacement; 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
Request Body (application/json)
All three address fields are required together to replace the address value object.
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
street | string | Yes | Non-empty, max 50 characters; PII-redacted in logs | Updated street address |
city | string | Yes | Non-empty, max 50 characters; PII-redacted in logs | Updated city or district |
province | string | Yes | Non-empty, max 50 characters; PII-redacted in logs | Updated province or state |
Success Response (200 OK)
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
id | string (uuid) | Yes | Valid UUID | Identifier of the authenticated buyer |
name | string | null | No | PII-redacted in logs | Buyer display name stored on the profile |
address | string | null | No | Formatted as "{Street}, {City}, {Province}"; PII-redacted in logs | Formatted full address |
Behavior & Side Effects
- Session-bound lookup: Derives the buyer ID from the authenticated user’s
NameIdentifierclaim (no buyer ID is accepted in the route or body). Returns404 Not Foundif no profile exists yet; callers must first create a profile via Create buyerCommandv1.0.0Create buyerCreates a Buyer profile for the authenticated customer from the supplied address.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs. - Atomic address replacement: Replaces the address value object inside a database transaction; emits no domain or integration events.
- PII redaction: Request address fields and response
name/addressfields are automatically redacted in structured logs.
Error Responses
| Status / Code | Condition | Client Recovery Action |
|---|---|---|
400 Bad Request | Empty/whitespace address field, field exceeding 50 characters, or non-UUID NameIdentifier claim | Fix the request body or token claims; 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 customer role (including admin-only tokens) or lacks ordering_read/ordering_write scopes | Authenticate as a customer with the required scopes |
404 Not Found | Authenticated caller does not have an existing buyer profile | Create the profile first using Create buyerCommandv1.0.0Create buyerCreates a Buyer profile for the authenticated customer from the supplied address.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs |
429 Too Many Requests | Rate limit quota exceeded (Retry-After header included) | Wait for the Retry-After interval before retrying |
500 Internal Server Error | Unhandled database or server failure | Retry with backoff and inspect service logs |
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 address value object.
- Create buyerCommandv1.0.0Create buyerCreates a Buyer profile for the authenticated customer from the supplied address.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs — Create a buyer profile before updating its address.
- Delete buyerCommandv1.0.0Delete buyerDeletes a Buyer profile by identifier; the operation is restricted to administrators.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs — Administrative permanent removal of a buyer profile.
Update buyer address schema
Address fields required to update the authenticated Buyer's address.