Skip to main content
GET
/
api
/
address
List Addresses
curl --request GET \
  --url https://api.example.com/api/address
{
  "statusCode": 200,
  "message": "Success fetching addresses data",
  "data": [
    {
      "id": 1,
      "user_id": 123,
      "address": "Jl. Sudirman No. 123",
      "subdistrict": "Senayan",
      "district": "Kebayoran Baru",
      "regency": "Jakarta Selatan",
      "province": "DKI Jakarta",
      "postal_code": "12190",
      "phone": "081234567890"
    },
    {
      "id": 2,
      "user_id": 123,
      "address": "Jl. Thamrin No. 456",
      "subdistrict": "Menteng",
      "district": "Menteng",
      "regency": "Jakarta Pusat",
      "province": "DKI Jakarta",
      "postal_code": "10310",
      "phone": "081234567891"
    }
  ]
}

Authentication

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

Response

statusCode
number
HTTP status code of the response
message
string
Response message
data
array
Array of address objects

Example Request

curl -X GET https://api.example.com/api/address \
  -H "Authorization: Bearer <your_token>"

Example Response

{
  "statusCode": 200,
  "message": "Success fetching addresses data",
  "data": [
    {
      "id": 1,
      "user_id": 123,
      "address": "Jl. Sudirman No. 123",
      "subdistrict": "Senayan",
      "district": "Kebayoran Baru",
      "regency": "Jakarta Selatan",
      "province": "DKI Jakarta",
      "postal_code": "12190",
      "phone": "081234567890"
    },
    {
      "id": 2,
      "user_id": 123,
      "address": "Jl. Thamrin No. 456",
      "subdistrict": "Menteng",
      "district": "Menteng",
      "regency": "Jakarta Pusat",
      "province": "DKI Jakarta",
      "postal_code": "10310",
      "phone": "081234567891"
    }
  ]
}

Notes

  • This endpoint returns only addresses belonging to the authenticated user
  • Returns an empty array if the user has no saved addresses

Build docs developers (and LLMs) love