I was wondering how to do that. Didn't find it for that type of custom data.

If possible I want to do it via API, if not possible i'll try with CRM_Core files.

  • Are you saying you want to use the API to create/upload a file at the server?
    – Nicholai
    Commented Apr 30, 2015 at 13:33

2 Answers 2


You can create a custom group with the CustomGroup API, and custom fields with the CustomField API. Is that what you mean, or do you mean updating the actual data within a custom file?

  • Sorry my english's probably bad... I'm trying to say that I want to create a new line in the database. CustomGroup and CustomField already exists. What I need is to create a new "object" through the API to save it in the database. Commented Apr 30, 2015 at 13:28
  • It depends on the entity your are adding too in my experience. I think for example for the Contact entity, you can add something like custom_25='yourvalue' to the Contact Create param set. In theory you can also use the CustomValue API but that is a bit of a beast...So I tend to use CRM_Core_DAO::executeQuery() if I can not use the entity API. Let me know if this helps you or if you are not aware of the CRM_Core_DAO::executeQuery method Commented Apr 30, 2015 at 13:34
  • I know about CRM_Core_DAO functions and some of others Core functions. Thing is I wanted a "simple" way to store files through the API. If nothing exists right now I will just do is with CRM_Core functions. Anyway thank's a lot for your help ! Commented Apr 30, 2015 at 13:49
  • You might want to try with the CustomValue API? Perhaps I am exaggerating.... Commented Apr 30, 2015 at 13:50

You can do this using the Attachment api. Use the API explorer on your own Civi site to see available parameters for this api.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.