API help needed Trying to POST multiple contacts when uploading clients

I have been having an issue. Can i send mutlplie contacts up via POST with the one client? is the a sample format i can use as a reference? as nothing in the API doc or Swagger.

Or do you have a sample script for send up just the contacts linked to a client?

Yes, it’s supported. You’d need to send an array of contacts, there’s an example for invoices which is similar.

https://invoice-ninja.readthedocs.io/en/latest/api.html#creating-data

Ok i can’t get it to work for clients with multiple contacts. i have had no issues uploading clients with single contacts, with the following json:-

{“account_key”:"",“address1”:“xx Solquest Way”,“address2”:"",“archived_at”:"",“balance”:"",“city”:“Cooloongup”,“contacts”:{“0”:{“account_key”:"",“archived_at”:"",“contact_key”:"",“custom_value1”:"",“custom_value2”:"",“email”:“pauk@xxxxxxx.com.au”,“first_name”:“Paul”,“id”:"",“is_owner”:"",“is_primary”:"",“last_login”:"",“last_name”:“Mellor”,“phone”:“9555555”,“send_invoice”:"",“updated_at”:""}},“country_id”:36,“credit_number_counter”:"",“currency_id”:"",“custom_value1”:"",“custom_value2”:"",“display_name”:"",“id”:"",“id_number”:“CUST00018”,“industry_id”:"",“invoice_number_counter”:"",“is_deleted”:"",“is_owner”:"",“language_id”:"",“last_login”:"",“name”:"",“paid_to_date”:"",“payment_terms”:"",“postal_code”:6168,“private_notes”:"",“public_notes”:"",“quote_number_counter”:"",“send_reminders”:"",“shipping_address1”:“xx Solquest Way”,“shipping_address2”:"",“shipping_city”:“Cooloongup”,“shipping_country_id”:36,“shipping_postal_code”:6168,“shipping_state”:“Western Australia”,“show_tasks_in_portal”:"",“size_id”:"",“state”:“Western Australia”,“task_rate”:"",“updated_at”:"",“vat_number”:"",“website”:"",“work_phone”:""}

This is working correctly i get back the response i would expect.

and for multiple contacts, this is what i am sending:-

{“account_key”:"",“address1”:“xx Solquest Way”,“address2”:"",“archived_at”:"",“balance”:"",“city”:“Cooloongup”,“contacts”:{“0”:{“account_key”:“SrrySfxZZpdmJkm5bNt0GAv6WywTmQgt”,“archived_at”:"",“contact_key”:“vuxcbs1i9e5go6t2g0rgqwykznxryitt”,“custom_value1”:"",“custom_value2”:"",“email”:“pauk@xxxxxxx.com.au”,“first_name”:“Paul”,“id”:"",“is_owner”:"",“is_primary”:"",“last_login”:"",“last_name”:“Mellor”,“phone”:“9555555”,“send_invoice”:"",“updated_at”:""},“1”:{“account_key”:"",“archived_at”:"",“contact_key”:"",“custom_value1”:"",“custom_value2”:"",“email”:“Syliva@xxxxxxx.com.au”,“first_name”:“Sylvia”,“id”:"",“is_owner”:"",“is_primary”:"",“last_login”:"",“last_name”:“Gabs”,“phone”:“555 5555”,“send_invoice”:"",“updated_at”:""}},“country_id”:36,“credit_number_counter”:"",“currency_id”:"",“custom_value1”:"",“custom_value2”:"",“display_name”:"",“id”:"",“id_number”:“CUST00019”,“industry_id”:"",“invoice_number_counter”:"",“is_deleted”:"",“is_owner”:"",“language_id”:"",“last_login”:"",“name”:"",“paid_to_date”:"",“payment_terms”:"",“postal_code”:6168,“private_notes”:"",“public_notes”:"",“quote_number_counter”:"",“send_reminders”:"",“shipping_address1”:“xx Solquest Way”,“shipping_address2”:"",“shipping_city”:“Cooloongup”,“shipping_country_id”:36,“shipping_postal_code”:6168,“shipping_state”:“Western Australia”,“show_tasks_in_portal”:"",“size_id”:"",“state”:“Western Australia”,“task_rate”:"",“updated_at”:"",“vat_number”:"",“website”:"",“work_phone”:""}

I get this response when sending the multiple contacts.
{
“data”: {
“account_key”: “SrrySfxZZpdmJkm5bNt0GAv6WywTmQgt”,
“is_owner”: true,
“user_id”: 1,
“id”: 1,
“name”: “”,
“display_name”: “”,
“balance”: 0,
“paid_to_date”: 0,
“updated_at”: 1552185621,
“archived_at”: null,
“address1”: “”,
“address2”: “”,
“city”: “”,
“state”: “”,
“postal_code”: “”,
“country_id”: 0,
“work_phone”: “”,
“private_notes”: “”,
“public_notes”: “”,
“last_login”: “”,
“website”: “”,
“industry_id”: 0,
“size_id”: 0,
“is_deleted”: false,
“payment_terms”: 1,
“vat_number”: “”,
“id_number”: “CUST00001”,
“language_id”: 0,
“currency_id”: 0,
“custom_value1”: “”,
“custom_value2”: “”,
“invoice_number_counter”: 0,
“quote_number_counter”: 0,
“task_rate”: 0,
“shipping_address1”: “”,
“shipping_address2”: “”,
“shipping_city”: “”,
“shipping_state”: “”,
“shipping_postal_code”: “”,
“shipping_country_id”: 0,
“show_tasks_in_portal”: false,
“send_reminders”: false,
“credit_number_counter”: 0,
“custom_messages”: “{}”,
“contacts”: [
{
“account_key”: “SrrySfxZZpdmJkm5bNt0GAv6WywTmQgt”,
“is_owner”: true,
“id”: 1,
“first_name”: “”,
“last_name”: “”,
“email”: “”,
“contact_key”: “dfdst0jth9t2f5tbwwjy0cgpgty85xbc”,
“updated_at”: 1552185621,
“archived_at”: null,
“is_primary”: true,
“phone”: “”,
“last_login”: “”,
“send_invoice”: true,
“custom_value1”: “”,
“custom_value2”: “”
}
]
}
}

I am lost at what is wrong.
I have Also tried changed the “[]” to “{}” around the contacts array but get a Error.

Thes reason i am asking as i have the exact same settings for the invoicing and can send invoices with multiple line items without issues.

Just not contacts

The contacts are an array so it should be [{contact1},{contact2},…] like the invoice example.

Ok so they should not be numbered?

No, please review the invoice example