¿How to filter by a related field?

I want to make a filter so that it only returns the data if they belong to a user but I can’t make the filter on the relationship.

What I want is to return only the addresses that belong to the user with ID 1.

These are the example data where user is the relation

{
  "data": [
    {
      "id": 3,
      "attributes": {
        "title": "Casa",
        "name": "Pepe",
        "address": "Calle perez lome, 9",
        "city": "Madrid",
        "state": "Madrid",
        "postal_code": "00000",
        "phone": "111222333",
        "createdAt": "2023-02-01T22:57:38.502Z",
        "updatedAt": "2023-02-01T23:07:13.604Z",
        "publishedAt": "2023-02-01T22:57:38.499Z",
        "user": {
          "data": {
            "id": 1,
            "attributes": {
              "username": "pepe",
              "email": "pepe@gmail.com",
              "provider": "local",
              "confirmed": true,
              "blocked": false,
              "createdAt": "2023-01-31T22:52:17.431Z",
              "updatedAt": "2023-02-01T19:20:48.169Z",
              "name": "Pepe"
            }
          }
        }
      }
    },
    {
      "id": 6,
      "attributes": {
        "title": "aaaa",
        "name": "aaa",
        "address": "aaa",
        "city": "aaa",
        "state": "aaa",
        "postal_code": "aaa",
        "phone": "111222333",
        "createdAt": "2023-02-01T23:03:00.684Z",
        "updatedAt": "2023-02-01T23:03:01.829Z",
        "publishedAt": "2023-02-01T23:03:01.827Z",
        "user": {
          "data": {
            "id": 2,
            "attributes": {
              "username": "carlos_gammer",
              "email": "carlos@tincode.es",
              "provider": "local",
              "confirmed": true,
              "blocked": false,
              "createdAt": "2023-01-31T22:53:41.683Z",
              "updatedAt": "2023-01-31T22:53:41.683Z",
              "name": "Carlos"
            }
          }
        }
      }
    }
  ],
}

Hola Agustin, te escribo en español, porque eres una persona activa en el mundo de la programación de habla hispana, y me has salvado en más de una ocasión.

suponiendo que tu endpoint es address o direcciones,
lo primero que tendríamos que hacer es llamar la relación con el usuario, lo puedes hacer directamente con populate=* ( te traerá todo ) o directamente populate[0]=user, si es que a la hora de hacer la relación le pusiste user, o normalmente se llama users-permissions y luego sería filtrar por el id del usuario,
algo así:
https://URL/api/direcciones?populate[0]=user&filters[user][id][$eq]=1

Un saludo


English

Hello Agustín, you wrote to yourself in Spanish, because you are an active person in the world of Spanish-speaking programming, and you have saved me on more than one occasion.

assuming your endpoint is address or addresses,
The first thing we have to do is call the relationship with the user, you can do it directly with populate=* (it will bring you everything) or directly populate[0]=user, if you put user at the time of making the relationship, or normally it is called users-permissions and then it would filter by the user id,
something like that:
https://url/api/address?populate[0]=user&filters[user][id][$eq]=1