Create simplified address
POST/company/address/simple
Creates a new address in a simplified way using only coordinates and basic data. This endpoint is optimized for cases where exact coordinates are known and an address needs to be created quickly without the complexity of Google Maps data.
Operation Flow:
- Authentication via valid JWT
- Validation of minimum required fields (lat, lng, name, company_name)
- Automatic reverse geocoding from coordinates
- Automatic creation of complete address
- Association to the user's company
- Return of the created address
Advantages of this endpoint:
- Requires only 4 mandatory fields vs ~15 of the standard endpoint
- Automatic geocoding from coordinates
- Reuses proven logic from the bulk import system
- Maintains the same data quality as normal creation
Typical use cases:
- Mobile applications with GPS
- Integration from third-party systems with coordinates
- Quick creation from interactive maps
- Simplified bulk creation
Request example:
POST /company/address/simple
Authorization: Bearer {token}
Content-Type: application/json
{
"lat": 40.416775,
"lng": -3.703790,
"name": "Central Office",
"company_name": "CargoOffer SL",
"phone": "+34912345678",
"isDefault": false
}
Successful response example:
{
"_id": "507f1f77bcf86cd799439011",
"name": "Central Office",
"company_name": "CargoOffer SL",
"phone": "+34912345678",
"street": "Calle de Alcalá, 42",
"city": "madrid",
"zipcode": "28014",
"country": "es",
"location": {
"type": "Point",
"coordinates": [-3.703790, 40.416775]
},
"is_default": false,
"can_be_deleted": true
}
Request
Responses
- 200
- 400
- 401
- 404
- 500
Address created successfully
Validation error - Missing required fields or invalid format
Authentication error - Invalid token or company not found
User not found
Internal server error