I'm looking for some recommendations. I've inherited a CiviCRM instance with a quite complicated custom data structure, and I want to review and update it. I was wondering if there were any tools or APIs that would help me export or visualize the data schema/fields for different object types?

The best option I can find is exporting all the fields for each type using the Export to CSV function, but that will require manually selecting hundreds of custom fields for each contact type in the field mapping GUI. UUUUggghhh! :-)

I've found the Data Explorer extension (https://civicrm.org/extensions/data-explorer) and am checking if that's a possibility, but that seems to have the same issues as the Exporter -- lots of manual selection.

Can anyone suggest a better way? Thanks!

2 Answers 2


You could start with API Explorer v4:

  • Set the Entity to CustomGroup and Action to get.
  • In the Chain section, set Entity to CustomField and Action to get. The next box should autopopulate to {where: [[custom_group_id, =, $id]]}

Basic example

From there, you can limit the fields returned both for the CustomGroup and the CustomFields and maybe sort them. Once that shows what you want, remove the Limit so see all the data.

Example with selected fields

From there, you can copy/paste the generated code to a php file and do what you like with the output.

  • Oh super, thanks, I hadn't found this in the API and sounds like a good way forward.
    – minbori
    Nov 14, 2020 at 10:01

You could also check out https://doc.symbiotic.coop/dev/civicrm/latest/schema/index.html which is derived using SchemaSpy per the answer here


  • Very useful as a general guide, but specifically for custom fields it doesn't really tell you how they match up. There are some foreign key-ish fields that aren't really foreign keys, like custom_group.table_name and custom_field.column_name. And extends_XXX can be tricky, like a custom group that is for activities of type A and C but not B.
    – Demerit
    Nov 13, 2020 at 19:38
  • Thanks, I did look into the database schema documentation which was super helpful, but as demerit says, it didn't really help me with the custom data.
    – minbori
    Nov 14, 2020 at 10:03

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.