we have some custom tables and in the menu, Support -> Developer -> Api Explorer v4, currently those custom tables are not available. Since we are new to this, in order for those custom tables to appear, we need to create our own extensions, install it then we can use it thru the APi Explorer v4, is it correct? Please give your suggestions. Thanks

2 Answers 2


It sounds like what you are asking about are Custom Field Groups.

A Custom Field Group is generally not accessible from the API as an entity. Instead, you access the Custom Fields within the Custom Field Group on the relevant entity (e.g. if you have a Custom Field Group for Contacts called mygroup and a Custom Field within it called myfield, you can access mygroup.myfield on the Contact entity).

The only exception to this is Custom Field Groups that allow multiple values, which is only possible for Contacts. For these, the Group is accessible as an API Entity.

  • @Learn CiviCRM this is the correct answer. I'll leave my answer up for future readers who are looking for the answer to the question of custom SQL tables. Aug 17 at 14:17

If you have database tables you created outside of CiviCRM, they can't be exposed to API4. API4 relies on metadata stored in the DAO file for the entity, which you don't have. To rectify this, you should use civix to generate an extension, to create an XML representation of your data, and to generate the DAO boilerplate.

You should instead then export table, remove it, and install the extension. This will install the newly-defined table. If it doesn't exactly match the old table, uninstall and try again until it does. Then you can reimport the table to restore your data (if there was no data in the table this is unncecessary).

Then, finally, you can place a file in your extension at Civi/Api4/Yourentity.php that reads:


namespace Civi\Api4;

 * Yourentitiy
 * @searchable secondary
 * @since 5.65
 * @package Civi\Api4
class Yourentity extends Generic\DAOEntity {


Clear cache, and it should be in API4.

  • Thanks for your quick response, those custom tables are created within CiviCRM, is it the same procedure and do we have a quicker way to do that? THANKS Aug 16 at 18:53
  • are your custom fields set as Searchable - that is the only thing which often causes them to not be available in other contexts, eg Search, Import. So may be same with API Explorer
    – petednz - fuzion
    Aug 16 at 19:50
  • Thanks for your help. All the custom fields I can see those in the APIv4, is some of the custom field that has multiple values currently CiviCRM put them in tables where the table name as civicrm_value_XXXX which is not showing up under Entity in APIv4. Thanks and help. Aug 16 at 20:51
  • Sorry - are these Custom Field Groups created through the CiviCRM UI, with SQL tables that start with civicrm_value_? Or are these completely custom tables you created directly in the SQL database? Aug 16 at 20:58
  • They are all created thru CiviCRM UI, Thanks a lot Aug 17 at 7:45

Your Answer

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

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