Add, Edit, and Delete a Secondary Contact
Learn to add, edit, and delete a contact in a client's profile using the FreshBooks API.
Overview
In this lesson, we’ll see how we can add a secondary contact to our client’s profile, and then edit and delete it.
A client’s profile represents a company. Therefore, secondary contacts are like members of a company. Secondary contacts are useful in situations where we want to send emails or invoices to multiple contacts within the same organization. We can have multiple secondary contacts in a single client.
These operations are performed using the following endpoints:
- Add a contact:
{base_url}/accounting/account/{ACCOUNT_ID}/users/clients/{CLIENT_ID}
- Get all contacts:
{base_url}/accounting/account/{ACCOUNT_ID}/users/contacts
- Update and delete a contact:
{base_url}/accounting/account/{ACCOUNT_ID}/users/contacts/{CONTACT_ID}
Add a secondary contact
In this section, we create a contact in the client profile that we created in the previous lesson. The {base_url}/accounting/account/{ACCOUNT_ID}/users/clients/{CLIENT_ID}
endpoint is similar to the one we used to update a client. In fact, this is an update operation with the difference of the contacts
object.
Request parameters
Our purpose is to create a contact for a client. So, the client
object contains the contacts object having email
, fname
, lname
, phone1
, and phone2
. Let’s see these parameters in the code below and create a contact.
Get hands-on with 1200+ tech skills courses.