NAV Navbar
cURL .NET Java Go PHP Python Ruby

Contacts

Contacts can be attached to customers. A contact could represent an additional email recipient for a customer, or perhaps an address in addition to the billing address, like a shipping address.

Contact Object

Attributes

{
    "address1": null,
    "address2": null,
    "city": null,
    "country": null,
    "created_at": 1463510889,
    "department": null,
    "email": "nancy.talty@example.com",
    "id": 10403,
    "name": "Nancy Talty",
    "object": "contact",
    "phone": null,
    "postal_code": null,
    "primary": true,
    "sms_enabled": null,
    "state": null,
    "title": null,
    "updated_at": 1463510889
}
Parameter Type Description
id integer The contact's unique ID
object string Object type, contact
name string Contact name
title string Job title
email string Email address
phone string Phone number
primary boolean When true the contact will be copied on any account communications
sms_enabled boolean When true the contact can be contacted via text message
department string Department
address1 string First address line
address2 string Optional second address line
city string City
state string State or province
postal_code string Zip or postal code
country string Two-letter ISO code
created_at timestamp Timestamp when created
updated_at timestamp Timestamp when updated

Create a contact

curl "https://api.invoiced.com/customers/:customer_id/contacts" \
  -u {API_KEY}: \
  -d name="Nancy Talty" \
  -d email="nancy.talty@example.com"
customer = invoiced.Customer.retrieve("{CUSTOMER_ID}")
customer.contacts.create(
  :name => "Nancy Talty",
  :email => "nancy.talty@example.com"
)
<?php

$customer = $invoiced->Customer->retrieve("{CUSTOMER_ID}");
$customer->contacts()->create([
  'name' => "Nancy Talty",
  'email' => "nancy.talty@example.com"
]);
customer = client.Customer.retrieve("{CUSTOMER_ID}")
customer.contacts().create(
  name="Nancy Talty",
  email="nancy.talty@example.com"
)
Customer customer = invoiced.newCustomer().retrieve({CUSTOMER_ID});
Contact contact = customer.newContact();
contact.name = "Nancy Talty";
contact.email = "nancy.talty@example.com";
contact.create();
var customer = invoiced.NewCustomer().Retrieve({CUSTOMER_ID});
var contact = customer.NewContact();
contact.Name = "Nancy Talty";
contact.Email = "nancy.talty@example.com";
contact.Create();
contact, err = invoiced.Customer.CreateContact({CUSTOMER_ID}, &invoiced.ContactRequest{
  Name: invoiced.String("Nancy Talty"),
  Email: invoiced.String("nancy.talty@example.com"),
})

The above command returns JSON structured like this:

{
    "address1": null,
    "address2": null,
    "city": null,
    "country": null,
    "created_at": 1463510889,
    "department": null,
    "email": "nancy.talty@example.com",
    "id": 10403,
    "name": "Nancy Talty",
    "object": "contact",
    "phone": null,
    "postal_code": null,
    "primary": true,
    "sms_enabled": null,
    "state": null,
    "title": null,
    "updated_at": 1463510889
}

Create a new contact with this endpoint.

HTTP Request

POST /customers/:customer_id/contacts

Attributes

Parameter Type Description
name string Contact name
title string Job title
email string Email address
phone string Phone number
primary boolean When true the contact will be copied on any account communications
sms_enabled boolean When true the contact can be contacted via text message
department string Department
address1 string First address line
address2 string Optional second address line
city string City
state string State or province
postal_code string Zip or postal code
country string Two-letter ISO code

Retrieve a contact

curl "https://api.invoiced.com/customers/:customer_id/contacts/:id" \
  -u {API_KEY}:
customer = invoiced.Customer.retrieve("{CUSTOMER_ID}")
contact = customer.contacts.retrieve("{CONTACT_ID}")
<?php

$customer = $invoiced->Customer->retrieve("{CUSTOMER_ID}");
$contact = $customer->contacts()->retrieve("{CONTACT_ID}");
customer = client.Customer.retrieve("{CUSTOMER_ID}")
contact = customer.contacts().retrieve("{CONTACT_ID}")
Customer customer = invoiced.newCustomer().retrieve({CUSTOMER_ID});
Contact contact = customer.newContact().retrieve({CONTACT_ID});
var customer = invoiced.NewCustomer().Retrieve({CUSTOMER_ID});
var contact = customer.NewContact().Retrieve({CONTACT_ID});
contact, err := client.Customer.RetrieveContact({CUSTOMER_ID}, {CONTACT_ID})

The above command returns JSON structured like this:

{
    "address1": null,
    "address2": null,
    "city": null,
    "country": null,
    "created_at": 1463510889,
    "department": null,
    "email": "nancy.talty@example.com",
    "id": 10403,
    "name": "Nancy Talty",
    "object": "contact",
    "phone": null,
    "postal_code": null,
    "primary": true,
    "sms_enabled": null,
    "state": null,
    "title": null,
    "updated_at": 1463510889
}

This endpoint retrieves a specific contact.

HTTP Request

GET /customers/:customer_id/contacts/:id

Update a contact

curl "https://api.invoiced.com/customers/:customer_id/contacts/:id" \
  -u {API_KEY}: \
  -d address1="507 Grove Avenue" \
  -d city="Oklahoma City" \
  -d state="OK" \
  -d postal_code="73102" \
  -X PATCH
contact.address1 = "507 Grove Avenue"
contact.city = "Oklahoma City"
contact.state = "OK"
contact.postal_code = "73102"
contact.save
<?php

contact->address1 = "507 Grove Avenue"
contact->city = "Oklahoma City"
contact->state = "OK"
contact->postal_code = "73102"
$contact->save();
contact.address1 = "507 Grove Avenue"
contact.city = "Oklahoma City"
contact.state = "OK"
contact.postal_code = "73102"
contact.save()
contact.address1 = "507 Grove Avenue"
contact.city = "Oklahoma City"
contact.state = "OK"
contact.postalCode = "73102"
contact.save()
contact.Address1 = "507 Grove Avenue";
contact.City = "Oklahoma City";
contact.State = "OK";
contact.PostalCode = "73102";
contact.SaveAll();
contact, err := invoiced.Customer.UpdateContact(&invoiced.ContactRequest{
  Address1: invoiced.String("507 Grove Avenue"),
  City: invoiced.String("Oklahoma City"),
  State: invoiced.String("OK"),
  PostalCode: invoiced.String("73102"),
})

The above command returns JSON structured like this:

{
    "address1": "507 Grove Avenue",
    "address2": null,
    "city": "Oklahoma City",
    "country": null,
    "created_at": 1463510889,
    "department": null,
    "email": "nancy.talty@example.com",
    "id": 10403,
    "name": "Nancy Talty",
    "object": "contact",
    "phone": null,
    "postal_code": "73102",
    "primary": true,
    "sms_enabled": null,
    "state": "OK",
    "title": null,
    "updated_at": 1463510889
}

Use this endpoint to update a contact.

HTTP Request

PATCH /customers/:customer_id/contacts/:id

Request Parameters

Parameter Type Description
name string Contact name
title string Job title
email string Email address
phone string Phone number
primary boolean When true the contact will be copied on any account communications
sms_enabled boolean When true the contact can be contacted via text message
department string Department
address1 string First address line
address2 string Optional second address line
city string City
state string State or province
postal_code string Zip or postal code
country string Two-letter ISO code

Delete a contact

curl "https://api.invoiced.com/customers/:customer_id/contacts/:id" \
  -u {API_KEY}: \
  -X DELETE
contact.delete
<?php

$contact->delete();
contact.delete()
contact.delete();
contact.Delete();
err := client.Customer.DeleteContact({CUSTOMER_ID}, {CONTACT_ID})

The above command returns 204 No Content

This endpoint deletes a specific contact.

HTTP Request

DELETE /customers/:customer_id/contacts/:id

List all contacts

curl "https://api.invoiced.com/customers/:customer_id/contacts" \
  -u {API_KEY}:
customer = invoiced.Customer.retrieve("{CUSTOMER_ID}")
contacts, metadata = customer.contacts.list(:per_page => 3)
<?php

$customer = $invoiced->Customer->retrieve("{CUSTOMER_ID}");
list($contacts, $metadata) = $customer->contacts()->all(['per_page' => 3]);
customer = client.Customer.retrieve("{CUSTOMER_ID}")
contacts, metadata = customer.contacts().list(per_page=3)
Customer customer = conn.newCustomer().retrieve({CUSTOMER_ID});
EntityList<Contact> contacts = customer.newContact().listAll();
var customer = invoiced.NewCustomer().Retrieve({CUSTOMER_ID});
var contacts = customer.NewContact.ListAll();
contacts, err := invoiced.Customer.ListAllContacts({CUSTOMER_ID})

The above command returns JSON structured like this:

[
  {
     "address1": "507 Grove Avenue",
     "address2": null,
     "city": "Oklahoma City",
     "country": null,
     "created_at": 1463510889,
     "department": null,
     "email": "nancy.talty@example.com",
     "id": 10403,
     "name": "Nancy Talty",
     "object": "contact",
     "phone": null,
     "postal_code": "73102",
     "primary": true,
     "sms_enabled": null,
     "state": "OK",
     "title": null,
     "updated_at": 1463510889
 }
]

This endpoint retrieves all contacts.

HTTP Request

GET /customers/:customer_id/contacts

Query Parameters

Parameter Description
sort string Column to sort by, i.e. name asc