POST /customers
Register a new customer.
This request is idempotent only if the customer being registered is the same.
If a customer with the same VAT number already exists with different attributes than the one being registered then a Conflict - 409 status code will be returned together with the currently existing customer’s gid in the JSON error object, see server error format.
curl -XPOST \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer 7b53d640bc79eb1c076603a5e65aa0d266623ced13525d8ea84e06eaf704a5b6" \
  https://api.invisiblecollector.com/customers  \
  --data '...'
require "net/https"
require "uri"
require "json"
uri = URI.parse("https://api.invisiblecollector.com/customers")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer 4a415cc660e67d8f4d26d5a7f390183a86fc3a4524ded78dc2448e86c48b2739'
request.body = data.to_json
response = http.request(request)
import com.ic.invisiblecollector.IcApiFacade;
import com.ic.invisiblecollector.model.Customer;
IcApiFacade apiFacade = new IcApiFacade("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");
Customer aNewCustomer = new Customer();
... // set customer info, including mandatory fields and an id or externalId
Customer createdCustomer = apiFacade.registerNewCustomer(customer);
using InvisibleCollectorLib;
using InvisibleCollectorLib.Model;
var ic = new InvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");
var newCustomer = new Customer() {
  // set custoemr fields, including the mandatory ones
};
Customer createdCustomer = await ic.SetNewCustomerAsync(newCustomer);
iC, err := ic.NewInvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98", ic.InvisibleCollectorUri)
model := ic.MakeCustomer()
... // set other fields including the mandatory ones
var channel = make(chan ic.CustomerPair)
go iC.SetNewCustomer(channel, model)
p := <-channel
fmt.Println(p.Customer)
This request can receive, for example, the following JSON data:
{
  "name": "John Doe Inc.",
  "externalId": "123",
  "vatNumber": "PT543219876",
  "address": "Invisible Avenue, 456",
  "zipCode": "1234-543",
  "city": "Lisbon",
  "country": "PT",
  "email": "[email protected]",
  "phone": "55598745",
  "mobile": "55598745",
  "locale": "pt"
}
This request will return, for example, the following JSON response:
{
  "name": "John Doe Inc.",
  "externalId": "123",
  "vatNumber": "PT543219876",
  "address": "Invisible Avenue, 456",
  "zipCode": "1234-543",
  "city": "Lisbon",
  "country": "PT",
  "email": "[email protected]",
  "phone": "55598745",
  "mobile": "55598745",
  "gid": "061d2feb-81c2-4694-a74a-13cecbe7d2ce",
  "locale": "pt"
}
Endpoint
POST https://api.invisiblecollector.com/customers
Request body
| Attribute | Type | Mandatory | Default | Description | 
|---|---|---|---|---|
| name | string | yes | N/A | The name of this customer. | 
| externalId | string | no | N/A | An external identification of this customer. Mainly used to facilitate integration with external systems. | 
| vatNumber | string | yes | N/A | The customer’s unique identification number for tax purposes. | 
| address | string | no | N/A | The customer’s address. | 
| zipCode | string | no | N/A | The customer’s zip code. | 
| city | string | no | N/A | The customer’s city. | 
| country | string | yes | N/A | The customer’s ISO 3166-1 country code. | 
| string | no | N/A | The customer’s email address. Will be used as the destination for email notifications. | |
| phone | string | no | N/A | The customer’s phone number. Will be used as the destination for VMS notifications. | 
| mobile | string | no | N/A | The customer’s mobile phone number. Will be used as the destination for SMS notifications. | 
| locale | string | no | “pt” | The customer’s locale. Only "pt", "es", "en", "fr-fr", "de", "zh-CN" are accepted. Will be used to set the language of notifications sent to the customer. | 
Response body
| Attribute | Type | Description | 
|---|---|---|
| name | string | The name of this customer. | 
| externalId | string | An external identification of this customer. Mainly used to facilitate integration with external systems. | 
| vatNumber | string | The customer’s unique identification number for tax purposes. | 
| address | string | The customer’s address. | 
| zipCode | string | The customer’s zip code. | 
| city | string | The customer’s city. | 
| country | string | The customer’s ISO 3166-1 country code. | 
| string | The customer’s email address. Will be used as the destination for email notifications. | |
| phone | string | The customer’s phone number. Will be used as the destination for VMS notifications. | 
| mobile | string | The customer’s mobile phone number. Will be used as the destination for SMS notifications. | 
| gid | string | An unique identifier of this customer which can be used to retrive it. | 
| locale | string | The customer’s locale. Will be used to set the language of notifications sent to the customer. | 
Errors
This endpoint may return the following errors
| HTTP Code | Description | 
|---|---|
| 401 Unauthorized | Invalid credentials were supplied | 
| 409 Conflict | A customer with the same VAT number already exists for this company | 
| 422 Unprocessable Entity | The request is syntactically correct but not a valid document JSON object or one the sanity checks failed |