Reference

Contacts

The people and companies you invoice. Contacts are matched rather than blindly duplicated: supply an `id`, `external_id` or `email` and Chargetree reuses the existing record where it can.

GET/contacts

Looks up a single contact by email address or by your own identifier. You must supply at least one of email or external_id; supplying both requires the contact to match both.

Authorization

accountKey
AuthorizationBearer <token>

An account API key, in the form ct_live_ followed by 32 characters. Generate one in the Chargetree dashboard under Settings → API. The plaintext key is shown only once.

Send it as Authorization: Bearer ct_live_....

In: header

Query Parameters

email?string

Email address, matched without regard to upper or lower case.

Formatemail
external_id?string

Your own identifier for this contact, matched exactly.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/contacts"
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "name": "string",  "email": "string",  "phone": "string",  "external_id": "string",  "address": null,  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}
POST/contacts

Finds an existing contact or creates a new one, in this order of precedence:

  1. id — must exist in your account, otherwise 404.
  2. external_id — reused if a contact in your account already has it.
  3. email — reused if a contact in your account already has it, matched without regard to upper or lower case.
  4. Otherwise a new contact is created, which needs name plus either email or phone.

Matching is always scoped to your own account. A contact belonging to another Chargetree account is never returned.

This endpoint honours the Idempotency-Key header.

Authorization

accountKey
AuthorizationBearer <token>

An account API key, in the form ct_live_ followed by 32 characters. Generate one in the Chargetree dashboard under Settings → API. The plaintext key is shown only once.

Send it as Authorization: Bearer ct_live_....

In: header

Header Parameters

Idempotency-Key?string

A unique value of your choosing, typically a UUID, that lets you retry this request safely. Replaying the same key with the same body returns the original response instead of acting twice.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Identifies a contact, either by pointing at an existing one or by describing a new one.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/contacts" \  -H "Idempotency-Key: 0f2a5f1e-9f1a-4e0c-9a4e-2a9b7d1f6c33" \  -H "Content-Type: application/json" \  -d '{    "name": "Acme Pty Ltd",    "email": "ap@acme.example",    "phone": "+61 400 000 000",    "external_id": "crm-4821"  }'
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "name": "string",  "email": "string",  "phone": "string",  "external_id": "string",  "address": null,  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}
GET/contacts/{id}

Authorization

accountKey
AuthorizationBearer <token>

An account API key, in the form ct_live_ followed by 32 characters. Generate one in the Chargetree dashboard under Settings → API. The plaintext key is shown only once.

Send it as Authorization: Bearer ct_live_....

In: header

Path Parameters

id*string

The contact's Chargetree identifier.

Formatuuid

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/contacts/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "name": "string",  "email": "string",  "phone": "string",  "external_id": "string",  "address": null,  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}