Organizations
Organizations are context of all your contacts, assignments etc. On this page, we'll dive into the different organization endpoints you can use to manage organizations programmatically. We'll look at how to query, create, and update organizations.
The organization model
The organization model contains all the information about the organiation you are connected to. Keep ind mind that your user account can be connected to multiple organizations whereas an API key is always only connect to one organization.
The organization object
Example Response
{
"id": "org-123123123",
"name": "Vinduespudser A/S",
"url": "http://vinduespudser.nu",
"address": "Pudservej 111",
"postalCode": "1234",
"city": "Pudserby",
"countryCode": "DK",
"location": [11.543540954589844, 56.703469017862034],
"phone": "+452212341234",
"email": "vindue@pudser.dk",
"registrationNo": "12345678",
"terminated": false,
"terminationTime": null,
"createdDate": "2015-01-01T00:00:00Z",
"trial": true,
"subscriptionPrice": 0,
"subscriptionPeriod": "Monthly",
"subscriptionDiscount": 0.0,
"subscriptionExpires": null,
"subscriptionType": "Free",
"languageCode": "da",
"baseCurrency": "DKK",
"locked": false,
"subjectToVat": true,
"timeZone": "Europe/Copenhagen"
}
Properties
- Name
name
- Type
- string
- Required
required
- Description
- Name of the business, fx. 'Vinduespudser A/S'
- Name
url
- Type
- string
- Description
- -
- Name
address
- Type
- string
- Description
- The street address, 'fx. Vesterbro 11'
- Name
postalCode
- Type
- string
- Description
- -
- Name
city
- Type
- string
- Description
- -
- Name
location
- Type
- number\[\]
- Description
- Array of 2 numbers holding longitude and latitude in specified order according to geojson syntax. (Fx. [11.543540954589844, 56.703469017862034]). Will be resolved by the system from the specified address.
- Name
countryCode
- Type
- string
- Description
- 2-letter ISO 3166-1 code, fx. 'DK'
- Name
phone
- Type
- string
- Description
- Full international phonenumber, fx. '+4522123456'
- Name
email
- Type
- string
- Description
- -
- Name
registrationNo
- Type
- string
- Description
- The business's EU VAT number, CVR number in Denmark, TIN/EIN/SSN in US.
- Name
languageCode
- Type
- string
- Description
- 2-letter ISO 639-1 code, fx. 'da'
- Name
baseCurrency
- Type
- string
- Description
- 3-letter ISO 4217 code, fx. 'DKK'
- Name
subjectToVat
- Type
- boolean
- Description
- -
- Name
timeZone
- Type
- string
- Description
- -
List all organizations
This endpoint allows you to retrieve a paginated list of all your organizations. By default, a maximum of twenty organizations are shown per page.
Optional attributes
- Name
size
- Type
- integer
- Description
Limit the number of organizations returned.
Request
curl -G https://api.previsto.io/organizations \
-u sk_12345 \
-d size=10
Response
[
{
"id": "org-123123123",
"name": "Vinduespudser A/S",
"url": "http://vinduespudser.nu",
"address": "Pudservej 111",
"postalCode": "1234",
"city": "Pudserby",
"countryCode": "DK",
"location": [11.543540954589844, 56.703469017862034],
"phone": "+452212341234",
"email": "vindue@pudser.dk",
"registrationNo": "12345678",
"terminated": false,
"terminationTime": null,
"createdDate": "2015-01-01T00:00:00Z",
"trial": true,
"subscriptionPrice": 0,
"subscriptionPeriod": "Monthly",
"subscriptionDiscount": 0.0,
"subscriptionExpires": null,
"subscriptionType": "Free",
"languageCode": "da",
"baseCurrency": "DKK",
"locked": false,
"subjectToVat": true,
"timeZone": "Europe/Copenhagen"
}
]
Create an organization
This endpoint allows you to create a new organization.
Request
curl https://api.previsto.io/organizations \
-u sk_12345
-d name="Vinduespudser A/S"
Response
{
"id": "org-123123123",
"name": "Vinduespudser A/S",
"url": null,
"address": null,
"postalCode": null,
"city": null,
"countryCode": null,
"location": [0,0],
"phone": null,
"email": null,
"registrationNo": null,
"terminated": false,
"terminationTime": null,
"createdDate": "2023-01-01T00:00:00Z",
"trial": true,
"subscriptionPrice": 0,
"subscriptionPeriod": "Monthly",
"subscriptionDiscount": 0.0,
"subscriptionExpires": null,
"subscriptionType": "Free",
"languageCode": "da",
"baseCurrency": "DKK",
"locked": false,
"subjectToVat": true,
"timeZone": "Europe/Copenhagen"
}
Retrieve an organization
This endpoint allows you to retrieve an organization by providing the Previsto id. Refer to the list at the top of this page to see which properties are included with organization objects.
Request
curl https://api.previsto.io/organizations/org-123123123 \
-u sk_12345
Response
{
"id": "org-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"
}
}
Update an organiation
Request
curl -X PUT https://api.previsto.io/organizations/cont-123123123 \
-u sk_12345 \
-d name="Acme Inc"
Response
{
"id": "org-123123123",
"name": "Acme Inc",
"url": "http://vinduespudser.nu",
"address": "Pudservej 111",
"postalCode": "1234",
"city": "Pudserby",
"countryCode": "DK",
"location": [11.543540954589844, 56.703469017862034],
"phone": "+452212341234",
"email": "vindue@pudser.dk",
"registrationNo": "12345678",
"terminated": false,
"terminationTime": null,
"createdDate": "2015-01-01T00:00:00Z",
"trial": true,
"subscriptionPrice": 0,
"subscriptionPeriod": "Monthly",
"subscriptionDiscount": 0.0,
"subscriptionExpires": null,
"subscriptionType": "Free",
"languageCode": "da",
"baseCurrency": "DKK",
"locked": false,
"subjectToVat": true,
"timeZone": "Europe/Copenhagen"
}