Skip to main content

Contact

A Contact specifies a Customer's information. The Contact can be a private person or a Company.

The contact object

Example Response

{
"id": "con_123123123",
"name": "Anna Jensen",
"address": "Kundevej 2",
"appartment": null,
"postalCode": "4321",
"city": "Kundeby",
"countryCode": "DK",
"location" : [ 10.5286863, 56.8039035 ],
"number": null,
"remoteId": null,
"remoteOrderId": null,
"phone": "+452209876543",
"email": "anna@jensen.dk",
"registrationNo": null,
"ean": null,
"accountingMode": null,
"accountingTime": null,
"invoiceDelivery": null,
"notifyBeforeWork": false,
"archived": false,
"agentIds": [],
"meta": {
"hairColor": "Brown"
}
}
FieldTypeRequiredDescription
idstringNo-
namestringYesThe name of the contact. Can be either a company name or a person's name.
addressstringNoThe street address, 'fx. Vesterbro 11'
appartmentstringNoApartment, fx. '1. th.'
postalCodestringNo-
citystringNo-
countryCodestringNo2-letter ISO 3166-1 code, fx. 'DK'
locationnumber[]YesArray of length 2 holding longitude and latitude in specified order. (Fx. [11.543540954589844, 56.703469017862034])
numberstringNoArbitrary number (or string) that contacts can be referred to by.
remoteIdstringNoId of the connected contact in financial system or null.
remoteOrderIdstringNoId of current open order for this contact in financial system or null.
phonestringNoFull international phonenumber, fx. '+4522123456'
emailstringNo-
registrationNostringNoThe contact's EU VAT number, CVR number in Denmark, TIN/EIN/SSN in US.
eanstringNoThe contact's EAN (European Article Number).
accountingModestringNoNone, AddToDraft or AddToInvoice.
accountingTimestringNoBeforeWork or AfterWork.
invoiceDeliverystringNoNone or Email.
payingContactIdstringNoId of another contact that pays assignments for this contact or null.
notestringNo-
notifyBeforeWorkbooleanNoFlag that defines if contact should be notified of work or not.
archivedbooleanNo-
agentIdsstring[]NoIds of the agents that takes care of this contact. Currently always account Ids. Empty list means that it is not specified.
metaobjectNoDictionary of meta value.

Create a contact

Definition

POST https://api.previsto.io/contacts
`

Example Request

curl https://api.previsto.io/contacts \
-u sk_12345: \
-d name="Anna Jensen" \
-d meta[hairColor]=Brown

Example Response

{
"id": "con_123123123",
"name": "Anna Jensen",
"address": "Kundevej 2",
"appartment": null,
"postalCode": "4321",
"city": "Kundeby",
"countryCode": "DK",
"location" : [ 10.5286863, 56.8039035 ],
"number": null,
"remoteId": null,
"remoteOrderId": null,
"phone": "+452209876543",
"email": "anna@jensen.dk",
"registrationNo": null,
"ean": null,
"accountingMode": null,
"accountingTime": null,
"invoiceDelivery": null,
"notifyBeforeWork": false,
"archived": false,
"agentIds": [],
"meta": {
"hairColor": "Brown"
}
}

Creates a new contact.

Arguments

FieldTypeRequiredDescription
namestringYesThe name of the contact. Can be either a company name or a person's name.
addressstringNoThe street address, 'fx. Vesterbro 11'
appartmentstringNoThe apartment, 'fx. 1. th'
postalCodestringNo-
citystringNo-
countryCodestringNo2-letter ISO 3166-1 code, fx. 'DK'
locationnumber[]YesArray of length 2 holding longitude and latitude in specified order. (Fx. [11.543540954589844, 56.703469017862034])
numberintegerNoArbitrary number (or string) that contacts can be referred to by.
phonestringNoFull international phonenumber, fx. '+4522123456'
emailstringNo-
registrationNostringNoThe contact's EU VAT number, CVR number in Denmark, TIN/EIN/SSN in US.
eanstringNoThe contact's EAN (European Article Number).
accountingModestringNoNone, AddToDraft or AddToInvoice.
accountingTimestringNoBeforeWork or AfterWork.
invoiceDeliverystringNoNone or Email.
payingContactIdstringNoId of another contact that pays assignments for this contact or null.
notestringNo-
notifyBeforeWorkbooleanNoFlag that defines if contact should be notified of work or not.
archivedbooleanNo-
metaobjectNoDictionary of meta value.

Returns

Returns an contact object if the call succeeded.

Retrieve a contact

Definition

GET https://api.previsto.io/contacts/{CONTACT_ID}

Example Request

curl https://api.previsto.io/contacts/con_123123123 \
-u sk_12345:

Example Response

{
"id": "con_123123123",
"name": "Anna Jensen",
"address": "Kundevej 2",
"appartment": null,
"postalCode": "4321",
"city": "Kundeby",
"countryCode": "DK",
"location" : [ 10.5286863, 56.8039035 ],
"number": null,
"remoteId": null,
"remoteOrderId": null,
"phone": "+452209876543",
"email": "anna@jensen.dk",
"registrationNo": null,
"ean": null,
"accountingMode": null,
"accountingTime": null,
"invoiceDelivery": null,
"notifyBeforeWork": false,
"archived": false,
"agentIds": [],
"meta": {
"hairColor": "Brown"
}
}

Retrieves the details of an existing contact. You need only supply the unique contact identifier that was returned with the contact object upon a successfull creation.

Arguments

FieldTypeRequiredDescription
idstringYesThe identifier of the contact to be retrieved.

Returns

Returns a contact object if a valid identifier was provided.

Update a contact

Definition

POST https://api.previsto.io/contacts/{CONTACT_ID}

Example Request

curl https://api.previsto.io/contacts/cot_123123123 \
-u sk_12345: \
-d phone=+4522123456

Example Response

{
"id": "con_123123123",
"name": "Anna Jensen",
"address": "Kundevej 2",
"appartment": null,
"postalCode": "4321",
"city": "Kundeby",
"countryCode": "DK",
"location" : [ 10.5286863, 56.8039035 ],
"number": null,
"remoteId": null,
"remoteOrderId": null,
"phone": "+452209876543",
"email": "anna@jensen.dk",
"registrationNo": null,
"ean": null,
"accountingMode": null,
"accountingTime": null,
"invoiceDelivery": null,
"notifyBeforeWork": false,
"archived": false,
"agentIds": [],
"meta": {
"hairColor": "Brown"
}
}

Updates the specified contact by setting the values of the parameters passed. Any parameters not provided will be left unchanged. For example, if you pass the address parameter, that becomes the contact's new address.

This request accepts mostly the same arguments as the contact creation call.

Arguments

FieldTypeRequiredDescription
namestringYesThe name of the contact. Can be either a company name or a person's name.
addressstringNoThe street address, 'fx. Vesterbro 11'
appartmentstringNoThe apartment, 'fx. 1. th'
postalCodestringNo-
citystringNo-
countryCodestringNo2-letter ISO 3166-1 code, fx. 'DK'
locationnumber[]YesArray of length 2 holding longitude and latitude in specified order. (Fx. [11.543540954589844, 56.703469017862034])
numberintegerNoArbitrary number (or string) that contacts can be referred to by.
phonestringNoFull international phonenumber, fx. '+4522123456'
emailstringNo-
registrationNostringNoThe contact's EU VAT number, CVR number in Denmark, TIN/EIN/SSN in US.
eanstringNoThe contact's EAN (European Article Number).
accountingModestringNoNone, AddToDraft or AddToInvoice.
accountingTimestringNoBeforeWork or AfterWork.
invoiceDeliverystringNoNone or Email.
payingContactIdstringNoId of another contact that pays assignments for this contact or null.
notestringNo-
notifyBeforeWorkbooleanNoFlag that defines if contact should be notified of work or not.
metaobjectNoDictionary of meta value.

Returns

Returns the contact object if the update succeeded. Returns an error if update parameters are invalid.

Delete a contact

Definition

DELETE https://api.previsto.io/contacts/{CONTACT_ID}

Example Request

curl https://api.previsto.io/contacts/con_123123123 \
-u sk_12345: \
-X DELETE

Permanently deletes a contact. It cannot be undone.

Arguments

FieldTypeRequiredDescription
idstringYesThe identifier of the contact to be deleted.

Returns

Returns an empty response upon success. If the contact ID does not exist, this call returns an error.

List all contacts

Definition

GET https://api.previsto.io/contacts

Example Request

curl https://api.previsto.io/contacts \
-u sk_12345:

Example Response

[
{
"id": "con_123123123",
"name": "Anna Jensen",
"address": "Kundevej 2",
"appartment": null,
"postalCode": "4321",
"city": "Kundeby",
"countryCode": "DK",
"location" : [ 10.5286863, 56.8039035 ],
"number": null,
"remoteId": null,
"remoteOrderId": null,
"phone": "+452209876543",
"email": "anna@jensen.dk",
"registrationNo": null,
"ean": null,
"accountingMode": null,
"accountingTime": null,
"invoiceDelivery": null,
"notifyBeforeWork": false,
"archived": false,
"agentIds": [],
"meta": {
"hairColor": "Brown"
}
},
{ },
{ },
"... And then as many results as available or requested"

]

Returns a list of your contacts.

Arguments

FieldOptionalExplained
sizeYesA limit on the number of objects to be returned. Size can range between 1 and 100 items. Default size is 20.
pageYesA zero-based cursor for use in pagination. Page is a number that defines your place in the list. For instance, if you make a list request and receive 100 objects, your subsequent call can set page=1 in order to fetch the next page of the list.
searchYesA free text search field. Cannot be used in combination with nearby.
nearbyYesSorts the result by the distance to a given coordinate, fx. '?nearby=-7.437336444854736,62.11042750510291'. Cannot be used in combination with search.

Returns

An array of up to limit contacts, starting after offset. Each entry in the array is a separate contact object. If no more contacts are available, the resulting array will be empty. This request should never return an error.