Skip to main content
popsmash
Active Contributor III
Active Contributor III
March 2, 2023

Bug: Unable to filter emails containing "+" character in API

  • March 2, 2023
  • 12 replies
  • 561 views

While attempting to get a profile by email I discovered that filtering is broken for emails containing a “+” character.

URL-encoding the + to %2B also doesn’t seem to work.

Works

?filter=equals(email,"user@popsmash.com")

== RESPONSE ==

{
"data": [
{
"type": "profile",
"id": "01GT84QJYY1DMSR8J9JY454Z86",
"attributes": {
"email": "user@popsmash.com"
}
}
]
}

Does not work

?filter=equals(email,"user+test@popsmash.com")
?filter=equals(email,"user%2Btest@popsmash.com") // URL encoded "+"

== RESPONSE ==

{
"data": []
}

 

    This topic has been closed for replies.

    12 replies

    popsmash
    Active Contributor III
    popsmashAuthor
    Active Contributor III
    August 20, 2023

    @Kim Strauch thanks for the message. When I use the URL format you are suggesting it results in a filter input error. Is it working for you?

    {
    "errors": [
    {
    "id": "9ca07d48-74f3-4026-9306-e64fbd86c724",
    "status": 400,
    "code": "invalid",
    "title": "Invalid input.",
    "detail": "Invalid filter provided.",
    "source": {
    "parameter": "filter"
    },
    "meta": {
    }
    }
    ]
    }

     

     

    POPSMASH: Making marketing personal at https://www.popsmash.com
    Kim Strauch
    Klaviyo Employee
    Klaviyo Employee
    August 20, 2023

    Interesting. I think the API request application you’re using is additionally URI encoding the entire request URL that is causing some problems here. I was able to look up the error ID you included and it seems the URL that’s being requested here is https://a.klaviyo.com/api/lists/VFMwXV/profiles?fields%5Bprofile%5D=email&filter=any(email%252C%255B%2522fjarrett%252B47%2540gmail.com%2522%255D)

    When I request the URL shared above it works for me and I don’t run into an invalid filter error. 

    If you use one of our Postman collections, you can update the value for the filter param and then select the text and hit “Encode URI Component” to encode it properly. Here’s a link to our latest Postman collection you can use, and some screenshots showing the steps I used.