Skip to main content

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

{
"id": "acct_7B10MYfEnPp6r",
"login": "john",
"name": "John Dow",
"email": "john@doe.com",
"emailValidated": true,
"address": "Kundevej 2",
"appartment": null,
"postalCode": "4321",
"city": "Kundeby",
"countryCode": "DK",
"location": [11.543540954589844, 56.703469017862034],
"languageCode": "da",
"roles": [
"ROLE_USER",
"ORGROLE_org-ZW46jOjfA0rpDZ_USER"
],
"meta": {
"hairColor": "Brown"
}
}
FieldTypeRequiredDescription
loginstringYes-
passwordstringYesCannot not be read. Can only be set via this property when account is created.
namestringYesFull name of user
emailstringYesMust have email syntax, fx. 'john@doe.com'
emailValidatedbooleanNo-
languageCodestringYes2-letter ISO 639-1 code, fx. 'da'
addressstringNoStreet and house number
appartmentstringNoApartment, fx. '1. th.'
postalCodestringNo-
citystringNo-
countryCodestringNo2-letter ISO 3166-1 code, fx. 'DK'
locationnumber[]YesArray of 2 numbers holding longitude and latitude in specified order according to geojson syntax. (Fx. [11.543540954589844, 56.703469017862034])
rolesarrayNoArray of user's system and organization roles.
metaobjectNoDictionary of meta values.

Retrieve current account

Definition

GET https://api.previsto.io/accounts/current

Example Request

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

Example Response

{
"id": "acct_7B10MYfEnPp6r",
"login": "john",
"name": "John Dow",
"email": "john@doe.com",
"emailValidated": true,
"address": "Kundevej 2",
"postalCode": "4321",
"city": "Kundeby",
"countryCode": "DK",
"location": [11.543540954589844, 56.703469017862034],
"languageCode": "da",
"roles": [
"ROLE_USER",
"ORGROLE_org-ZW46jOjfA0rpDZ_USER"
],
"meta": {
"hairColor": "Brown"
}
}

Retrieves the details of the account.

Arguments

FieldTypeRequiredDescription
idstringYesThe identifier of the account to be retrieved.

Returns

Returns an account object if a valid identifier was provided.

Update current account

Definition

POST https://api.previsto.io/accounts/current

Example Request

curl https://api.previsto.io/accounts/current \
-u sk_12345: \
-d email=jane@doe.com

Example Response

{
"id": "acct_7B10MYfEnPp6r",
"login": "john",
"name": "John Dow",
"email": "jane@doe.com",
"emailValidated": true,
"address": "Kundevej 2",
"postalCode": "4321",
"city": "Kundeby",
"countryCode": "DK",
"location": [11.543540954589844, 56.703469017862034],
"languageCode": "da",
"roles": [
"ROLE_USER",
"ORGROLE_org-ZW46jOjfA0rpDZ_USER"
],
"meta": {
"hairColor": "Brown"
}
}

Updates an account by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

Arguments

FieldTypeRequiredDescription
namestringYesFull name of user
emailstringNo-
languageCodestringNo2-letter ISO 639-1 code, fx. 'da'
metaobjectNoDictionary of meta values.

Returns

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

Delete an account

Definition

DELETE https://api.previsto.io/accounts/{ACCOUNT_ID}

Example Request

curl https://api.previsto.io/accounts/acct_7B10MYfEnPp6r \
-u sk_12345: \
-X DELETE

Permanently deletes an account. It cannot be undone.

Arguments

FieldTypeRequiredDescription
idstringYesThe 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.