Ticket creation with attachment with API V2 through PHP not working

Hi community,

I’m using PHP to make API calls to interact with Freshdesk, and un til today, i had no problem to deal with it.

Right now, i’m facing an issue about attachments files that we can add to the tickets. In fact, i’m trying to use the code samples here :

but i’m very disappointed cause none of the ones who deal with attachments are working.

Could some PHP developer help me ? Somebody made it work on his side ?

Thanks a lot guys, you could help me a lot with this !!
Have a nice day

hello could you share your code and error return? I’ve used these examples a few times, I didn’t get any problems!


This code :

does not work ! I also used these samples to make a lot of other things like “Create a simple ticket”, “Create a user” but this thing with attachments just dont work.

Could someone please help me ? i’m lost !!!

No one to help me ?!

Thanks guys !!!

Hi Anthony

I’m currently dealing with the same problem. Did you find the solution?



Hello Everyone,

I am facing same issue with this attachment code, please share any solution to this. Creating ticket with attachment using PHP is not working. I am sharing request and response as below:

[email] => test@test.com
[subject] => test upload
[description] => test upload
[priority] => 2
[status] => 2
[attachments] => Array
[0] => CURLFile Object
[name] => https://domain.com/Giftcardbanner.png
[mime] => image/png
[postname] => Giftcardbanner.png



{“description”:“Validation failed”,“errors”:[{“field”:“attachments”,“message”:“It should contain elements of type valid file format only”,“code”:“datatype_mismatch”}]}

Thanks a lot in advance.


Hey @irshad,
I’ve shared this feedback/query with the Freshdesk support team. And they would be able to help with this.