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:

Field

Description

Format

id

Id of the client record, if this is an update

Numeric

businessId

Id of the business that this should be billed from

String

name

Name of the client

Any string

status

Status of the client; use "OPEN" in most cases

Must be one of the following: "OPEN", "ARCHIVED"

email

Client's email address

Well-formatted string

ccEmails

Emails that should be cc'ed on invoices sent to this client

Array of strings

bccEmails

Emails that should be bcc'ed on invoices sent to this client

Array 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": "[email protected]_domain.com",
    "ccEmails": [],
    "bccEmails": []
  }'