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

Authentication

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

Request Body

address
string
required
The street address
subdistrict
string
required
The subdistrict (kelurahan/desa)
district
string
required
The district (kecamatan)
regency
string
required
The regency or city (kabupaten/kota)
province
string
required
The province
postalCode
string
required
The postal code
phone
string
required
Contact phone number for this address

Response

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

Example Request

curl -X POST https://api.example.com/api/address \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "Jl. Sudirman No. 123",
    "subdistrict": "Senayan",
    "district": "Kebayoran Baru",
    "regency": "Jakarta Selatan",
    "province": "DKI Jakarta",
    "postalCode": "12190",
    "phone": "081234567890"
  }'

Example Response

{
  "statusCode": 201,
  "message": "Address added successfully"
}

Notes

  • The address is automatically associated with the authenticated user
  • All fields are required
  • The user can have multiple saved addresses

Build docs developers (and LLMs) love