Creating a Client

Once you've set your user up to send out invoices, you can easily add the client that your user wishes to bill. This client's information can be easily re-used for future invoices, including keeping a card on file.

1. Getting the user's existing clients

First, you should retrieve a list of the user's clients. Be sure to include that user's access_token in the headers.

curl \
  --request GET \
  --url https://sandbox.hurdlr.com/rest/v5/clientMgmt/clients \
  --header 'Authorization: Bearer ${access_token}' \
  --header 'Content-Type: application/json' \

The response from GET /clients contains an array of the user's clients:

[
  {
    "id": 805609,
    "businessId": "416080",
    "name": "Bill Tanner",
    "status": "OPEN",
    "email": "[email protected]",
    "ccEmails": [],
    "bccEmails": [],
    "lastUpdatedDate": "2020-09-02T21:31:49.000Z"
  }
]

2. Adding or updating a client

You should update the following fields for any new or existing client:

FieldDescriptionFormat
idId of the client record, if this is an updateNumeric
businessIdId of the business that this should be billed fromString
nameName of the clientAny string
statusStatus of the client; use "OPEN" in most casesMust be one of the following: "OPEN", "ARCHIVED"
emailClient's email address; new invoices created for this client will be sent to this email by defaultWell-formatted string
ccEmailsEmails that should be cc'ed on invoices created for this client by defaultArray of strings
bccEmailsEmails that should be bcc'ed on invoices created for this client by defaultArray of strings

To add or update a client, simply POST the client's JSON object to the /client endpoint:

curl \
  --request POST \
  --url https://sandbox.hurdlr.com/rest/v5/clientMgmt/client \
  --header 'Authorization: Bearer ${access_token}' \
  --header 'Content-Type: application/json' \
  --data '{
    "businessId": "416080",
    "name": "Joe the Client",
    "status": "OPEN",
    "email": "their_client@their_domain.com",
    "ccEmails": [],
    "bccEmails": []
  }'