Search ticket by custom field value

Hi.
I have a ticket with a custom single string field value cf_contrato=25
image
When I search for this field in a Api query, it does not return results.
…api/v2/search/tickets?query=“cf_contrato:‘25’”

{
    "results": [],
    "total": 0
}

What am I doing wrong?
It’s posible to search tickets by custom fields?
It’s posible to search tickets by company?
Thanks

1 Like

Hi @ealcantara,

Welcome to the community! :tada:

There are some changes made for Custom fields as part of the improvement cycles for better search capabilities. The single line text fields may work differently for the recently created accounts and newly created fields in all the accounts.

Please contact the Freshdesk support (support@freshdesk.com) to check if your account needs any changes to use single line text fields in the Filter API.

Hi.

Is there any plans to update the API documentation. As im getting the same issue when trying to filter by a custom single line text field.

@james.metaswitch It is not generic for all the accounts which is why it is not documented. It will be documented when it is made available without requesting the Freshdesk support for modifying anything for your account.

I will pass on this feedback to the product team to consider making this process easier.

@james.metaswitch Did you try the documentation step to filter based on a custom field (single-line text field) with a key as “custom_string” as follows?

curl -v -u user@yourcompany.com:test -X GET ‘https://domain.freshdesk.com/api/v2/search/tickets?query=“custom_string:theactualkeyword”