Skip to content

JSON:API Integration

CRM contact entities are available through Drupal core JSON:API when the module is enabled. CRM does not ship custom JSON:API resources, serializers, or optional config — standard entity endpoints apply automatically.

Requirements

  • CRM module enabled.
  • Drupal core JSON:API module enabled (drush pm:enable jsonapi).
  • CRM entity permissions (for example view any crm contact).

What you get

When JSON:API is enabled, contacts are available at standard entity collection and individual endpoints. The URL pattern is /jsonapi/{entity_type}/{bundle}, and the JSON:API resource type uses -- as the separator. CRM ships three default contact bundles:

Bundle Collection endpoint Resource type
person GET /jsonapi/crm_contact/person crm_contact--person
organization GET /jsonapi/crm_contact/organization crm_contact--organization
household GET /jsonapi/crm_contact/household crm_contact--household

Individual contact endpoints follow the same pattern:

GET /jsonapi/crm_contact/person/{uuid}

All standard JSON:API query parameters (fields, filter, sort, page, include) apply without any CRM-specific configuration.

Including contact methods

Contacts reference their contact methods through three relationship fields: emails, telephones, and addresses (see Contact entity). By default, JSON:API returns these as relationship linkage only. Use the include query parameter to populate the top-level included array with the full crm_contact_method resources:

GET /jsonapi/crm_contact/person/{uuid}?include=emails,telephones,addresses

You can include a subset of fields or combine include with other query parameters:

GET /jsonapi/crm_contact/person/{uuid}?include=emails&fields[crm_contact_method--email]=field_email_address

Relationship statistics

JSON:API cannot filter the relationship_statistics field per relationship type. The field is omitted from contact resources unless the viewer may view every relationship type (administer crm or view any crm relationship). See Relationship statistics access.