Skip to main content

Creating and Linking Contacts and Customers

In this tutorial, you'll learn how to work with two of the most fundamental entities in Tribe CRM: Contacts (People) and Customers (Organizations). You'll create new records and establish relationships between them — just like you would in the Tribe CRM interface, but through the API.


Step 2.1 — Check Existing Customers

Before creating anything, let's see what Customers are already in the system.

GET/v1/odata/Relationship_Organization_CommercialRelationship_Customer
Understanding the data model

In Tribe CRM, a Customer is a Relationship — specifically a Relationship_Organization_CommercialRelationship_Customer. Relationships connect a Relation (the directory entry) to a specific role in your CRM. The same organization can be both a Customer and a Supplier at the same time.


Step 2.2 — Filter Results

The previous response was probably overwhelming. Let's learn how to get exactly what we need using OData query options.

GET/v1/odata/Relationship_Organization_CommercialRelationship_Customer?$select=Name
OData optionPurpose
$selectChoose which fields to return
$filterFilter records by a condition
$topLimit the number of results

Step 2.3 — Find Your Organization (Customer Part I)

When you want to add a new customer to Tribe CRM, you first need to link them to your organization. Every customer relationship references the owning organization's Relation ID.

GET/v1/odata/Relationship_Organization_Identity?$expand=Relation($select=ID)&$select=Name

Note the Relation.ID from the response — you'll need it in the next step.


Step 2.4 — Create a Customer (Customer Part II)

Now let's create a new customer organization. This POST request creates a new Relation_Organization and wraps it in a Customer relationship in one call. Add $expand to the request to include the Organization entity in the response (we will need it's ID later).

POST/v1/odata/Relationship_Organization_CommercialRelationship_Customer?$expand=Organization($select=ID)

The response will include the new ID for the Customer relationship. Save it for the cleanup step.


Step 2.5 — Create a Contact

Now let's create a contact person. This request creates a Person entity wrapped in a standard Contact relationship.

POST/v1/odata/Relationship_Person_Contact_Standard?$expand=Person($select=ID)

Save the Person.ID from the response — you'll need it to link the contact to the customer.


Cleanup — Delete Created Entities

Now that you've successfully created and linked your first entities, let's clean up the test data.

Parent-child deletion order

In Tribe CRM, you must delete child records before parent records. Delete the Relationship first, then the underlying Relation.

1. Delete the Contact Person

DELETE/v1/odata/Relation_Person({personId})

2. Delete the Relation_Organization (deletes both the organization and all its relationships)

DELETE/v1/odata/Relation_Organization({organizationId})