Entities Address Service
Overview
The Entities Address Service manages addresses associated with entities (customers or suppliers). Addresses can be used for billing, shipping, or general contact purposes.
Each entity address includes:
EntityID- identifier of the associated entityName- address label or nameLine1,Line2- street addressCity,StateRegion,PostalCode,CountryCode- location dataPhone,Email- contact informationAddressType- address purpose:0= Default,1= Shipping,2= Billing (FK toentities.EntityAddressType)
Soft delete is supported — deleted addresses have IsDeleted = true and a DeletedAt timestamp rather than being physically removed.
All operations are tenant-aware and audited.
Endpoints
GET
/api/v1/EntityAddresses/{id}
Returns a single address by its ID.
Route parameters:
id(long, required) - address identifier
Behavior:
- Looks up the address by ID
- Returns
404 Not Foundif the address does not exist
Response:
AddressModel- address details
Authorization:
- Requires Bearer Token
GET
/api/v1/EntityAddresses/entity/{entityId}
Returns all addresses for a specific entity.
Route parameters:
entityId(long, required) - entity identifier
Behavior:
- Filters addresses by
EntityID - Returns
404 Not Foundif no addresses exist
Response:
List<AddressModel>- all addresses for the entity
Authorization:
- Requires Bearer Token
POST
/api/v1/EntityAddresses
Creates a new entity address.
Request body (AddressModel):
EntityID(long, required) - associated entityName(string, required) - address name or labelLine1(string, required) - first line of addressLine2(string?, optional) - second line of addressCity(string, required)StateRegion(string?, optional)PostalCode(string, required)CountryCode(string, required)Phone(string?, optional)Email(string?, optional)AddressType(int?, optional, default:0) -0= Default,1= Shipping,2= Billing
Behavior:
- Validates required fields using
IsReadyToAdd() - Adds the address to the database
- Writes an audit log entry on success
Response:
201 Created-AddressModel
Authorization:
- Requires Bearer Token
- Permission:
FullManage
PUT
/api/v1/EntityAddresses/{id}
Updates an existing entity address.
Route parameters:
id(long, required) - address identifier
Request body (AddressModel):
- Required for update:
Id(set from route),Name - Optional:
Line1,Line2,City,StateRegion,PostalCode,CountryCode,Phone,Email,AddressType,EntityID
Behavior:
- Validates required fields using
IsReadyToUpdate() - Updates only the provided fields
- Writes an audit log entry on success
Response:
200 OK-AddressModel
Authorization:
- Requires Bearer Token
- Permission:
FullManage
DELETE
/api/v1/EntityAddresses/{id}
Soft-deletes an entity address by its ID.
Route parameters:
id(long, required) - address identifier
Behavior:
- Performs a soft delete — sets
IsDeleted = trueandDeletedAtto the current timestamp - Record is retained in the database
- Writes an audit log entry on success
Response:
204 No Content
Authorization:
- Requires Bearer Token
- Permission:
FullManage
Notes
- Validation is enforced in the service layer (
IsReadyToAdd()/IsReadyToUpdate()) - An entity can have multiple addresses with different
AddressTypevalues AddressTypemust be a valid value fromEntityAddressType(0,1, or2)- The previous
IsBilling/IsShippingboolean fields have been replaced by the integerAddressType - Tenant-aware operations ensure data isolation per tenant
- Internal errors are logged but not exposed to API consumers