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.
/contactsLooks 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 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 address, matched without regard to upper or lower case.
emailYour 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"}/contactsFinds an existing contact or creates a new one, in this order of precedence:
id— must exist in your account, otherwise404.external_id— reused if a contact in your account already has it.email— reused if a contact in your account already has it, matched without regard to upper or lower case.- Otherwise a new contact is created, which needs
nameplus eitheremailorphone.
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 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
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"}/contacts/{id}Authorization
accountKey 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
The contact's Chargetree identifier.
uuidResponse 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"}