How to filter tickets created by email on Freshdesk

Hello everybody!

I’m trying to filter tickets that were created by e-mail, but in the documentation, it isn’t very clear on how or if it can be done. I know that there is a field in the ticket called “source”, which refers to what channel the ticket was created through, so i tried to used it.

I tried to do the following request:

https://domain.freshdesk.com/api/v2/search/tickets?query="source:1"

As in the documentation, “source:1” should refer to the e-mail.

but the response was:

{
    "description": "Validation failed",
    "errors": [
        {
            "field": "source",
            "message": "Unexpected/invalid field in request",
            "code": "invalid_field"
        }
    ]
}

It looks like the field “source” doesn’t exists, so how can I do this filter? Is there another field that I can use to do this?

Thanks!

Hi @Matheus_Souza_Silva

As of I know, There is no straightforward solution to achieve this as only certain ticket fields are supported in the ticket search API. Refer to the below image for supported ticket fields in search API.

Maybe, one possible solution which I could think of now is to traverse through all the tickets and pick only the tickets which have the expected source using the get tickets API.

tickets API: https://domain.freshdesk.com/api/v2/tickets?page=1

Regards,
Mughela Chandresh

2 Likes

@Matheus_Souza_Silva
Good Day!

Kindly take a look at this document for more reference

Filter tickets based on the following requester email (super+man@gmail.com) which needs to be URL encoded.

curl -v -u yourapikey:X -X GET 'https://domain.freshdesk.com/api/v2/tickets?email=super%2Bman%40gmail.com'

I hope this will solve your problem :slight_smile:

Thanks

1 Like

@Santhosh Seems like @Matheus_Souza_Silva wants to filter tickets by source (i.e tickets created by email. ticket source should be email) but https://domain.freshdesk.com/api/v2/tickets?email=super%2Bman%40gmail.com will filter tickets using the given email.