Skip to main content
PATCH
/
api
/
address
Update Address
curl --request PATCH \
  --url https://api.example.com/api/address \
  --header 'Content-Type: application/json' \
  --data '
{
  "addressId": 123,
  "address": "<string>",
  "subdistrict": "<string>",
  "district": "<string>",
  "regency": "<string>",
  "province": "<string>",
  "postalCode": "<string>",
  "phone": "<string>"
}
'
{
  "statusCode": 200,
  "message": "Address updated successfully"
}

Authentication

This endpoint requires JWT authentication. Include your bearer token in the Authorization header.
Authorization: Bearer <your_token>

Request Body

addressId
number
required
The ID of the address to update. Must belong to the authenticated user.
address
string
The street address
subdistrict
string
The subdistrict (kelurahan/desa)
district
string
The district (kecamatan)
regency
string
The regency or city (kabupaten/kota)
province
string
The province
postalCode
string
The postal code
phone
string
Contact phone number for this address

Response

statusCode
number
HTTP status code of the response
message
string
Response message

Example Request

curl -X PATCH https://api.example.com/api/address \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "addressId": 1,
    "address": "Jl. Sudirman No. 456",
    "phone": "081234567899"
  }'

Example Response

{
  "statusCode": 200,
  "message": "Address updated successfully"
}

Notes

  • Only the address owner can update their own addresses
  • All fields except addressId are optional - only provide fields you want to update
  • The endpoint performs a partial update, preserving fields not included in the request
  • If the address doesn’t exist or doesn’t belong to the user, a 404 error is returned

Build docs developers (and LLMs) love