Account
This is an object representing your Previsto account. You can retrieve it to see properties on the account like its current e-mail address etc. You are allowed to change parameters for your own account only.
The account object also holds information about the user's authorizations in the property 'roles'. There are 2 kinds of roles: (1) system-wide roles and (2) organization-specific roles. System-wide roles are prefixed with ROLE_ and organization-specific roles are prefixed with ORGROLE_followed by the id of the specific organization.

The account object

Example Response
1
{
2
"id": "acct_7B10MYfEnPp6r",
3
"login": "john",
4
"name": "John Dow",
5
"email": "[email protected]",
6
"emailValidated": true,
7
"address": "Kundevej 2",
8
"appartment": null,
9
"postalCode": "4321",
10
"city": "Kundeby",
11
"countryCode": "DK",
12
"location": [11.543540954589844, 56.703469017862034],
13
"languageCode": "da",
14
"roles": [
15
"ROLE_USER",
16
"ORGROLE_org-ZW46jOjfA0rpDZ_USER"
17
],
18
"meta": {
19
"hairColor": "Brown"
20
}
21
}
Copied!
Field
Type
Required
Description
login
string
Yes
-
password
string
Yes
Cannot not be read. Can only be set via this property when account is created.
name
string
Yes
Full name of user
email
string
Yes
Must have email syntax, fx. '[email protected]'
emailValidated
boolean
No
-
languageCode
string
Yes
2-letter ISO 639-1 code, fx. 'da'
address
string
No
Street and house number
appartment
string
No
Apartment, fx. '1. th.'
postalCode
string
No
-
city
string
No
-
countryCode
string
No
2-letter ISO 3166-1 code, fx. 'DK'
location
number[]
Yes
Array of 2 numbers holding longitude and latitude in specified order according to geojson syntax. (Fx. [11.543540954589844, 56.703469017862034])
roles
array
No
Array of user's system and organization roles.
meta
object
No
Dictionary of meta values.

Retrieve current account

Definition
1
GET https://api.previsto.io/accounts/current
Copied!
Example Request
1
curl https://api.previsto.io/accounts/current \
2
-u sk_12345:
Copied!
Example Response
1
{
2
"id": "acct_7B10MYfEnPp6r",
3
"login": "john",
4
"name": "John Dow",
5
"email": "[email protected]",
6
"emailValidated": true,
7
"address": "Kundevej 2",
8
"postalCode": "4321",
9
"city": "Kundeby",
10
"countryCode": "DK",
11
"location": [11.543540954589844, 56.703469017862034],
12
"languageCode": "da",
13
"roles": [
14
"ROLE_USER",
15
"ORGROLE_org-ZW46jOjfA0rpDZ_USER"
16
],
17
"meta": {
18
"hairColor": "Brown"
19
}
20
}
Copied!
Retrieves the details of the account.

Arguments

Field
Type
Required
Description
id
string
Yes
The identifier of the account to be retrieved.

Returns

Returns an account object if a valid identifier was provided.

Update current account

Definition
1
POST https://api.previsto.io/accounts/current
Copied!
Example Request
1
curl https://api.previsto.io/accounts/current \
2
-u sk_12345: \
Copied!
Example Response
1
{
2
"id": "acct_7B10MYfEnPp6r",
3
"login": "john",
4
"name": "John Dow",
5
"email": "[email protected]",
6
"emailValidated": true,
7
"address": "Kundevej 2",
8
"postalCode": "4321",
9
"city": "Kundeby",
10
"countryCode": "DK",
11
"location": [11.543540954589844, 56.703469017862034],
12
"languageCode": "da",
13
"roles": [
14
"ROLE_USER",
15
"ORGROLE_org-ZW46jOjfA0rpDZ_USER"
16
],
17
"meta": {
18
"hairColor": "Brown"
19
}
20
}
Copied!
Updates an account by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

Arguments

Field
Type
Required
Description
name
string
Yes
Full name of user
email
string
No
-
languageCode
string
No
2-letter ISO 639-1 code, fx. 'da'
meta
object
No
Dictionary of meta values.

Returns

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

Delete an account

Definition
1
DELETE https://api.previsto.io/accounts/{ACCOUNT_ID}
Copied!
Example Request
1
curl https://api.previsto.io/accounts/acct_7B10MYfEnPp6r \
2
-u sk_12345: \
3
-X DELETE
Copied!
Permanently deletes an account. It cannot be undone.

Arguments

Field
Type
Required
Description
id
string
Yes
The identifier of the account to be deletes.

Returns

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