Listing all sub-resources without parent scope

Let’s say I have User resource which has Address sub-resource (let’s forget about why this is a resource instead of attribute). To get a user’s address, I can do GET /users/{id}/address

Now I want to have an API which returns all the addresses regardless of their owners. I can do GET /addresses. This feels a little bit hacky.

Another option is to move the Address resource to the top level.

  • GET /user-addresses to get all addresses
  • GET /user-addresses/{user-id} to get a specific user’s address
  • POST /user-addresses/{user-id} to create an address

Which one do you prefer? Have you seen similar patterns before? Thanks!