Create and Update a Client

Learn to create a new client and update it using the FreshBooks API.

Overview

In the previous lesson, we extracted the ACCOUNT_ID of the authenticated user. By ‘user,’ we mean an admin who manages and interacts with the application. A user is responsible for making all API calls. Meanwhile, a client is an entity for which a user maintains records.

This chapter walks us through some of the operations related to clients and contacts. In this lesson, we’ll create a new client and update it using the following endpoints:

  • Create and list clients: {base_url}/accounting/account/{ACCOUNT_ID}/users/clients
  • Update a client: {base_url}/accounting/account/{ACCOUNT_ID}/users/clients/{CLIENT_ID}

Note: These endpoints of clients require user:clients:read and user:clients:write permissions to perform the intended tasks.

Create a client

In this section, we’ll create a new client using the {base_url}/accounting/account/{ACCOUNT_ID}/users/clients endpoint. This endpoint utilizes the HTTP POST method to create a new client in our FreshBooks account. We’ll make payments and send invoices to this client in the next lessons.

Request headers

Mostly, the headers of a request contain the following:

  • Content-Type: This defines the format of our request, and normally its value is applications/json.
  • Authorization: This defines the type of authorization used by FreshBooks endpoints. These endpoints utilize the Bearer token to authenticate whether the request is valid.

Request parameters

This endpoint takes an object client as a parameter. Let’s see the fields of the client object in the table below:

Get hands-on with 1200+ tech skills courses.